I want the 2nd Listbox items to change based on the selection of the first.
I have also tried oLbx2:REFRESH(),oDlg:UPDATE(),sysrefresh() in the ON CHANGE for oLbx1 - the second listbox just won't change.
The code below is a complete selfcontained example.
- Code: Select all Expand view RUN
PROCEDURE LISTBOXTEST()
LOCAL oDlg
LOCAL aitems1,aitems2,aitems3, cValue1, cValue2, cValue3
aItems1:={"1","2"}
cValue1:=aItems1[2]
aItems2:={"3","4","5"}
cValue2:=aItems2[2]
DEFINE DIALOG oDlg FROM 5,10 TO 24, 55 TITLE "ListBoxTest"
@ 1, 2 LISTBOX oLbx1 VAR cValue1 ITEMS aItems1 SIZE 45, 95 OF oDlg UPDATE ;
ON CHANGE (IF(cValue1="1",aItems2:={"a","b","c"},aItems2:={"X","Y","Z"}),oDlg:UPDATE())
@ 1, 14 LISTBOX oLbx2 VAR cValue2 ITEMS aItems2 SIZE 45, 95 OF oDlg UPDATE
@ 7, 7 BUTTON "&OK" OF oDlg SIZE 40, 12 ;
ACTION oDlg:End() DEFAULT
@ 7, 17 BUTTON "&Cancel" OF oDlg SIZE 40, 12 ;
ACTION ( cValue1 := nil, oDlg:End() )
ACTIVATE DIALOG oDlg CENTERED
RETURN