Page 1 of 1

DCCOMBOBOX ... REFRESH

Posted: Fri Jun 15, 2012 5:38 am
by Tom
Hi, Roger.

If a DCCOMBOBOX/DROPDOWNLIST has a REFRESH clause, something strange is happening if the items for the listbox are somehow similar. As you can see in this sample, the items are "Tom 2", "Tom 21" and "Tom". With REFRESH on, it's almost impossible to briefly select "Tom" - the listbox shows "Tom 2" anyway, but "Tom" IS selected (look at the DCSAY). I was wondering if this has something to do with SET EXACT (see button), but this seems to be not true. I already looked through functions used like DC_VarFromListBox() and DC_GetDatalink, but I didn't find any code comparing portions.

Code: Select all

FUNCTION Main()
LOCAL GetList := {}, oDialog, aTest := {'Tom 2', 'Tom 21', 'Tom'}, cTest := aTest[1], lExact := .F.

@ 1,1 DCCOMBOBOX cTest LIST aTest SIZE 25,15 TYPE XBPCOMBO_DROPDOWNLIST REFRESH /* ITEMSELECTED {||DC_GetRefresh(GetList)} */

@ 3,1 DCSAY {||cTest} SIZE 10,1

@ 4,1 DCSAY {||'EXACT is '+IF(Set(_SET_EXACT),'on','off')} SIZE 10,1

@ 6,1 DCPUSHBUTTON CAPTION {||IF(lExact,'Exact off','Exact on')} SIZE 12,1 ;
      ACTION {||lExact := !lExact,Set(_SET_EXACT,lExact),DC_GetRefresh(GetList)}

DCREAD GUI ADDBUTTONS TITLE 'Test' FIT PARENT @oDialog

RETURN nil

PROC AppSys() ; RETURN

Re: DCCOMBOBOX ... REFRESH

Posted: Fri Jun 15, 2012 5:19 pm
by rdonnay
Tom -

I cannot reproduce the behavior you described.

Roger

Re: DCCOMBOBOX ... REFRESH

Posted: Tue Jun 19, 2012 1:06 am
by Tom
Hi, Roger.

Strange. If I select "Tom" in the combobox, it jumps back to "Tom 2", although "Tom" is selected, as the SLE below shows:

Re: DCCOMBOBOX ... REFRESH

Posted: Tue Jun 19, 2012 3:40 am
by Wolfgang Ciriack
Hi Tom,
i can confirm this. If you change the array to

Code: Select all

aTest := {'Tom 2 ', 'Tom 21', 'Tom  '}
that all items have the same lenght, than it works.

Re: DCCOMBOBOX ... REFRESH

Posted: Tue Jun 19, 2012 7:34 am
by Tom
Hi, Wolfgang.

Thanks for the workaround. :) The strange thing is, this happens only with the REFRESH clause.

Re: DCCOMBOBOX ... REFRESH

Posted: Tue Jun 19, 2012 7:43 am
by rdonnay
I will look more into this.