Multiple Dimension Array in Combobox
Re: Multiple Dimension Array in Combobox
I would never waste someone's time by making a joke with a question. I did fully explore your suggestion, and I also had enacted the ON CHANGE language. Here is what I am working with:
aSrc := { { "N", "New" }, {"R", "Rebuilt"}, {"U", "Used"} }
Then the code:
REDEFINE COMBOBOX oCbx VAR cSource ITEMS arrTranspose( aSrc )[2] ;
ON CHANGE ( cSource := aSrc[oCbx][1], oCbx:update() ) ID 2504 OF oDlg UPDATE
The combobox displays the 2nd element of the array as desired, but it also returns that element to the combobox rather than the value of element 1.
There are other issues that may contribute to this. 1). I used a variable here, but actually the VAR is a field of a data object, and 2) the dialog is actually on a folder page.
I have also tried this using the DBCOMBO variant, with two arrays, using ITEMS and LIST. Again, it displays correctly but returns the value of the dropdown list rather than the single letter code. Also, all my builds are with Harbour and Microsoft Visual C 2019
Obviously I can write a new routine to handle this directly, and as I want, but I was attempting to utilize capabilities already included in FWH.
aSrc := { { "N", "New" }, {"R", "Rebuilt"}, {"U", "Used"} }
Then the code:
REDEFINE COMBOBOX oCbx VAR cSource ITEMS arrTranspose( aSrc )[2] ;
ON CHANGE ( cSource := aSrc[oCbx][1], oCbx:update() ) ID 2504 OF oDlg UPDATE
The combobox displays the 2nd element of the array as desired, but it also returns that element to the combobox rather than the value of element 1.
There are other issues that may contribute to this. 1). I used a variable here, but actually the VAR is a field of a data object, and 2) the dialog is actually on a folder page.
I have also tried this using the DBCOMBO variant, with two arrays, using ITEMS and LIST. Again, it displays correctly but returns the value of the dropdown list rather than the single letter code. Also, all my builds are with Harbour and Microsoft Visual C 2019
Obviously I can write a new routine to handle this directly, and as I want, but I was attempting to utilize capabilities already included in FWH.
Tim Stone
http://www.MasterLinkSoftware.com
timstone@masterlinksoftware.com
Using: FWH 19.06 with Harbour 3.2.0 / Microsoft Visual Studio Community 2019
http://www.MasterLinkSoftware.com
timstone@masterlinksoftware.com
Using: FWH 19.06 with Harbour 3.2.0 / Microsoft Visual Studio Community 2019
Re: Multiple Dimension Array in Combobox
As I suspected, the problem has to do with the complexity of the data object.
The combo box does return the correct value, but it does not display it in the field. The field is a buffer value of a data object, and that does not refresh on the screen after the selection..
By saving the returned value to the record, it is there, and a skip of the record then browse back will display it correctly. So the issue is in getting the buffer to hold, and refresh, the value.
I'll make that happen.
The combo box does return the correct value, but it does not display it in the field. The field is a buffer value of a data object, and that does not refresh on the screen after the selection..
By saving the returned value to the record, it is there, and a skip of the record then browse back will display it correctly. So the issue is in getting the buffer to hold, and refresh, the value.
I'll make that happen.
Tim Stone
http://www.MasterLinkSoftware.com
timstone@masterlinksoftware.com
Using: FWH 19.06 with Harbour 3.2.0 / Microsoft Visual Studio Community 2019
http://www.MasterLinkSoftware.com
timstone@masterlinksoftware.com
Using: FWH 19.06 with Harbour 3.2.0 / Microsoft Visual Studio Community 2019
- Silvio.Falconi
- Posts: 4956
- Joined: Thu Oct 18, 2012 7:17 pm
Re: Multiple Dimension Array in Combobox
yes, there is an error on your sourceTimStone wrote:REDEFINE COMBOBOX oCbx VAR cSource ITEMS arrTranspose( aSrc )[2] ;
ON CHANGE ( cSource := aSrc[oCbx][1], oCbx:update() ) ID 2504 OF oDlg UPDATE
The combobox displays the 2nd element of the array as desired, but it also returns that element to the combobox rather than the value of element 1.
try with
REDEFINE COMBOBOX oCbx VAR cSource ITEMS arrTranspose( aSrc )[2] ;
ON CHANGE yourfunction(oCbx) ID 2504 OF oDlg UPDATE
Last edited by Silvio.Falconi on Thu Aug 29, 2019 12:07 am, edited 1 time in total.
I use : FiveWin for Harbour August 2020 (Revision) - Harbour 3.2.0dev (r1712141320) - Bcc7.30 - xMate ver. 1.15.3 - PellesC
- Silvio.Falconi
- Posts: 4956
- Joined: Thu Oct 18, 2012 7:17 pm
Re: Multiple Dimension Array in Combobox
make a small sample test to try
I use : FiveWin for Harbour August 2020 (Revision) - Harbour 3.2.0dev (r1712141320) - Bcc7.30 - xMate ver. 1.15.3 - PellesC
- Silvio.Falconi
- Posts: 4956
- Joined: Thu Oct 18, 2012 7:17 pm
Re: Multiple Dimension Array in Combobox
I have this combobox with two element array
when I select one element search on another array (xbrowse) the pricelist of the first array
I use : FiveWin for Harbour August 2020 (Revision) - Harbour 3.2.0dev (r1712141320) - Bcc7.30 - xMate ver. 1.15.3 - PellesC
Re: Multiple Dimension Array in Combobox
Silvio,
I have tested each step.
The combobox returns the correct value.
When I save the value returned to the data object ( in the buffer ), the correct value is used in the field, and reading the field shows the correct value.
The issue is getting the control to update itself with the new value for the field in the object buffer. I will study the code tomorrow carefully tomorrow and see how I can push this through.
I could do a SAVE() of all values entered so far, and then reload the object. It's fast, but I don't want all those values committed back to the actual record until the user actually hits the Save button. So, I only want to update the one control.
I have no doubt I'll figure this out tomorrow. Maybe Rao will have some ideas on a method in the control that can push this to happen. oCbx:update() and oCbx:refresh() don't do it.
Meanwhile dinner is on the way. Tonight it's Chinese. Yesterday it was Mexican. Maybe tomorrow will be Italian. All are favorites.
I have tested each step.
The combobox returns the correct value.
When I save the value returned to the data object ( in the buffer ), the correct value is used in the field, and reading the field shows the correct value.
The issue is getting the control to update itself with the new value for the field in the object buffer. I will study the code tomorrow carefully tomorrow and see how I can push this through.
I could do a SAVE() of all values entered so far, and then reload the object. It's fast, but I don't want all those values committed back to the actual record until the user actually hits the Save button. So, I only want to update the one control.
I have no doubt I'll figure this out tomorrow. Maybe Rao will have some ideas on a method in the control that can push this to happen. oCbx:update() and oCbx:refresh() don't do it.
Meanwhile dinner is on the way. Tonight it's Chinese. Yesterday it was Mexican. Maybe tomorrow will be Italian. All are favorites.
Tim Stone
http://www.MasterLinkSoftware.com
timstone@masterlinksoftware.com
Using: FWH 19.06 with Harbour 3.2.0 / Microsoft Visual Studio Community 2019
http://www.MasterLinkSoftware.com
timstone@masterlinksoftware.com
Using: FWH 19.06 with Harbour 3.2.0 / Microsoft Visual Studio Community 2019
- Silvio.Falconi
- Posts: 4956
- Joined: Thu Oct 18, 2012 7:17 pm
Re: Multiple Dimension Array in Combobox
good Dinner
here 2.45 of Night
if you not create a small sample to try none cannot help you
here 2.45 of Night
if you not create a small sample to try none cannot help you
I use : FiveWin for Harbour August 2020 (Revision) - Harbour 3.2.0dev (r1712141320) - Bcc7.30 - xMate ver. 1.15.3 - PellesC
Re: Multiple Dimension Array in Combobox
Silvio,
I wasn't asking for further help unless someone has a COMBOBOX call that will refresh the edit box with the value found in a record memory buffer that changed.
I have a suspicion that ON CHANGE may not be the right option to use. Why ? ON CHANGE provides steps to take but it appears that occurs after the value has been returned to the edit box. That is why I need to study the source code this morning.
Timing is everything ....
And yes, dinner was good last night.
Tim
I wasn't asking for further help unless someone has a COMBOBOX call that will refresh the edit box with the value found in a record memory buffer that changed.
I have a suspicion that ON CHANGE may not be the right option to use. Why ? ON CHANGE provides steps to take but it appears that occurs after the value has been returned to the edit box. That is why I need to study the source code this morning.
Timing is everything ....
And yes, dinner was good last night.
Tim
Tim Stone
http://www.MasterLinkSoftware.com
timstone@masterlinksoftware.com
Using: FWH 19.06 with Harbour 3.2.0 / Microsoft Visual Studio Community 2019
http://www.MasterLinkSoftware.com
timstone@masterlinksoftware.com
Using: FWH 19.06 with Harbour 3.2.0 / Microsoft Visual Studio Community 2019
- Silvio.Falconi
- Posts: 4956
- Joined: Thu Oct 18, 2012 7:17 pm
Re: Multiple Dimension Array in Combobox
If you not post a small sample we cannot help you
I use : FiveWin for Harbour August 2020 (Revision) - Harbour 3.2.0dev (r1712141320) - Bcc7.30 - xMate ver. 1.15.3 - PellesC
Re: Multiple Dimension Array in Combobox
As I said, I had an alternative method. I have a simple lookup function that shows a browse of the code/description. Double click on the right one and it returns the correct value to the field.
I do lookups throughout my program without any difficulty. In this case, I was simply exploring an alternate option with a combo box. As inspiration strikes me, I will continue the quest, but for now I do have a working solution ... click the lookup icon ( in the field rather than the down arrow ), from the popup ( rather than a dropdown ) double ( rather than single ) click on the desired value, and it's done. All works fine, as usual.
If someone does have a thought on what I've presented, the code is still in place ( though commented out so it's inactive ) and I can test their input.
Have a wonderful weekend ...
I do lookups throughout my program without any difficulty. In this case, I was simply exploring an alternate option with a combo box. As inspiration strikes me, I will continue the quest, but for now I do have a working solution ... click the lookup icon ( in the field rather than the down arrow ), from the popup ( rather than a dropdown ) double ( rather than single ) click on the desired value, and it's done. All works fine, as usual.
If someone does have a thought on what I've presented, the code is still in place ( though commented out so it's inactive ) and I can test their input.
Have a wonderful weekend ...
Tim Stone
http://www.MasterLinkSoftware.com
timstone@masterlinksoftware.com
Using: FWH 19.06 with Harbour 3.2.0 / Microsoft Visual Studio Community 2019
http://www.MasterLinkSoftware.com
timstone@masterlinksoftware.com
Using: FWH 19.06 with Harbour 3.2.0 / Microsoft Visual Studio Community 2019