Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Listbox
#1
My dialog box has four list box. First listbox contains 5 items on the basis of its selection I want the second listbox to show remaining 4 items and so on.
#2
this is my take on it.

Function Dialog2
Trigger F12     Help - how to add the trigger to the macro
Code:
Copy      Help
;\Dialog_Editor
function# hDlg message wParam lParam
if(hDlg) goto messages
str controls = "3 4 5 6"
str lb3 lb4 lb5 lb6

lb3 = "hey[]you[]how[]are[]u"
if(!ShowDialog("Dialog2" &Dialog2 &controls)) ret
;BEGIN DIALOG
;0 "" 0x90C80A44 0x100 0 0 223 135 "Dialog"
;1 Button 0x54030001 0x4 120 116 48 14 "OK"
;2 Button 0x54030000 0x4 170 116 48 14 "Cancel"
;3 ListBox 0x54230101 0x200 0 0 96 48 ""
;4 ListBox 0x54230101 0x200 100 0 96 48 ""
;5 ListBox 0x54230101 0x200 0 52 96 48 ""
;6 ListBox 0x54230101 0x200 100 52 96 48 ""
;END DIALOG
;DIALOG EDITOR: "" 0x203000A "" "" ""

ret
;messages
sel message
,case WM_INITDIALOG
,case WM_DESTROY
,case WM_COMMAND goto messages2
ret
;messages2
sel wParam
,case [LBN_SELCHANGE<<16|3 ,LBN_SELCHANGE<<16|4 ,LBN_SELCHANGE<<16|5, LBN_SELCHANGE<<16|6]
,_i=LB_SelectedItem(lParam)
,str s = LB_GetList(lParam)
,int t=GetWinId(lParam)
,sel t
,,case 3
,,,SendMessage(id(4 hDlg) LB_RESETCONTENT 0 0)
,,,SendMessage(id(5 hDlg) LB_RESETCONTENT 0 0)
,,,SendMessage(id(6 hDlg) LB_RESETCONTENT 0 0)
,,case 4
,,,SendMessage(id(6 hDlg) LB_RESETCONTENT 0 0)

,LB_AutoComplete(id(t+1 hDlg) _i s)

,case IDOK
,case IDCANCEL
ret 1

Function LB_GetList
Code:
Copy      Help
function~ hDlg
int i
ARRAY(str) s
int count=LB_GetCount(hDlg)
for i 0 count
,LB_GetItemText(hDlg i _s)
,s[]= _s
ret s

Function LB_AutoComplete
Code:
Copy      Help
function hDlg index str'lis

ARRAY(str) s = lis

s.remove(index)
int i
SendMessage(hDlg LB_RESETCONTENT 0 0)
for i 0 s.len
,SendMessage(hDlg LB_ADDSTRING 0 s[i])


Forum Jump:


Users browsing this thread: 2 Guest(s)