Multiple Dimension Array in Combobox

Re: Multiple Dimension Array in Combobox

Postby TimStone » Wed Aug 28, 2019 9:23 pm

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.
Tim Stone
http://www.MasterLinkSoftware.com
http://www.autoshopwriter.com
timstone@masterlinksoftware.com
Using: FWH 23.10 with Harbour 3.2.0 / Microsoft Visual Studio Community 2022-24 32/64 bit
User avatar
TimStone
 
Posts: 2945
Joined: Fri Oct 07, 2005 1:45 pm
Location: Trabuco Canyon, CA USA

Re: Multiple Dimension Array in Combobox

Postby TimStone » Wed Aug 28, 2019 11:19 pm

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.
Tim Stone
http://www.MasterLinkSoftware.com
http://www.autoshopwriter.com
timstone@masterlinksoftware.com
Using: FWH 23.10 with Harbour 3.2.0 / Microsoft Visual Studio Community 2022-24 32/64 bit
User avatar
TimStone
 
Posts: 2945
Joined: Fri Oct 07, 2005 1:45 pm
Location: Trabuco Canyon, CA USA

Re: Multiple Dimension Array in Combobox

Postby Silvio.Falconi » Wed Aug 28, 2019 11:53 pm

TimStone 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.


yes, there is an error on your source

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.
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
User avatar
Silvio.Falconi
 
Posts: 7075
Joined: Thu Oct 18, 2012 7:17 pm

Re: Multiple Dimension Array in Combobox

Postby Silvio.Falconi » Wed Aug 28, 2019 11:56 pm

make a small sample test to try
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
User avatar
Silvio.Falconi
 
Posts: 7075
Joined: Thu Oct 18, 2012 7:17 pm

Re: Multiple Dimension Array in Combobox

Postby Silvio.Falconi » Thu Aug 29, 2019 12:01 am

Image

I have this combobox with two element array
when I select one element search on another array (xbrowse) the pricelist of the first array
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
User avatar
Silvio.Falconi
 
Posts: 7075
Joined: Thu Oct 18, 2012 7:17 pm

Re: Multiple Dimension Array in Combobox

Postby TimStone » Thu Aug 29, 2019 12:42 am

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.
Tim Stone
http://www.MasterLinkSoftware.com
http://www.autoshopwriter.com
timstone@masterlinksoftware.com
Using: FWH 23.10 with Harbour 3.2.0 / Microsoft Visual Studio Community 2022-24 32/64 bit
User avatar
TimStone
 
Posts: 2945
Joined: Fri Oct 07, 2005 1:45 pm
Location: Trabuco Canyon, CA USA

Re: Multiple Dimension Array in Combobox

Postby Silvio.Falconi » Thu Aug 29, 2019 12:47 am

good Dinner
here 2.45 of Night
if you not create a small sample to try none cannot help you
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
User avatar
Silvio.Falconi
 
Posts: 7075
Joined: Thu Oct 18, 2012 7:17 pm

Re: Multiple Dimension Array in Combobox

Postby TimStone » Thu Aug 29, 2019 4:24 pm

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
Tim Stone
http://www.MasterLinkSoftware.com
http://www.autoshopwriter.com
timstone@masterlinksoftware.com
Using: FWH 23.10 with Harbour 3.2.0 / Microsoft Visual Studio Community 2022-24 32/64 bit
User avatar
TimStone
 
Posts: 2945
Joined: Fri Oct 07, 2005 1:45 pm
Location: Trabuco Canyon, CA USA

Re: Multiple Dimension Array in Combobox

Postby Silvio.Falconi » Thu Aug 29, 2019 5:16 pm

If you not post a small sample we cannot help you
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
User avatar
Silvio.Falconi
 
Posts: 7075
Joined: Thu Oct 18, 2012 7:17 pm

Re: Multiple Dimension Array in Combobox

Postby TimStone » Thu Aug 29, 2019 10:09 pm

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 ...
Tim Stone
http://www.MasterLinkSoftware.com
http://www.autoshopwriter.com
timstone@masterlinksoftware.com
Using: FWH 23.10 with Harbour 3.2.0 / Microsoft Visual Studio Community 2022-24 32/64 bit
User avatar
TimStone
 
Posts: 2945
Joined: Fri Oct 07, 2005 1:45 pm
Location: Trabuco Canyon, CA USA

Previous

Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 91 guests