04-16-2013, 10:33 PM
Hi, I have two combo boxes on a dialog(A, B, C) and (1, 2, 3) What is displayed in combo box 2 needs to be dependent on what is chosen in combo box 1 - this all needs to be done in the dialog itself before the macro is run.
So if B in combo box one is chosen then combo box two should have its contents changed from 1,2,3 to 4,5,6
I have tried to piece this together using the forum posts, but I can't get it to work.
Function combo
Any help would be greatly appreciated.
Matt
So if B in combo box one is chosen then combo box two should have its contents changed from 1,2,3 to 4,5,6
I have tried to piece this together using the forum posts, but I can't get it to work.
Function combo
\Dialog_Editor
function# hDlg message wParam lParam
if(hDlg) goto messages
;BEGIN DIALOG
;0 "" 0x90C80AC8 0x0 0 0 223 135 "Dialog"
;3 ComboBox 0x54230243 0x0 12 18 96 213 ""
;4 ComboBox 0x54230243 0x0 14 40 96 213 ""
;1 Button 0x54030001 0x4 120 116 48 14 "OK"
;2 Button 0x54030000 0x4 170 116 48 14 "Cancel"
;END DIALOG
;DIALOG EDITOR: "" 0x2030408 "" "" "" ""
str controls = "3 4"
str cb3 cb4
cb3="&A[]B[]C"
cb4="&1[]2[]3"
if(!ShowDialog("combo" 0 &controls)) ret
ret
;messages
sel message
,case WM_INITDIALOG
,case WM_DESTROY
,case WM_COMMAND goto messages2
,case WM_APP
ret
;messages2
sel wParam
,case CBN_SELENDOK<<16|3
,int selected = CB_SelectedItem(id(3 hDlg))
,int othercombo = (id(4hDlg))
,if selected=1
,,SendMessage othercombo CB_RESETCONTENT 0 0
,,CB_Add othercombo "4" 0
,,CB_Add othercombo "5" 1
,,CB_Add othercombo "6" 2
,case IDCANCEL
ret 1
Any help would be greatly appreciated.
Matt