Posts: 1,058
Threads: 367
Joined: Oct 2007
Supposed that you need to change the content of a ComboBox at runtime in a dialogue. The following procedure works properly. I wonder whether there exists another one more effective procedure to populate the ComboBox.
Many thanks in advance.
Function
tempf14
;messages2
sel wParam
,case 5
,int hcb=id(4 hDlg)
,SendMessage hcb CB_RESETCONTENT 0 0
,str s2="a[]b[]c"
,str s
,foreach s s2
,,CB_Add hcb s
Posts: 12,135
Threads: 142
Joined: Dec 2002
In System folder functions I use function TO_CBFill. The same as your code. Not faster.
Function
Dialog162
\Dialog_Editor
str dd=
;BEGIN DIALOG
;0 "" 0x90C80AC8 0x0 0 0 224 136 "Dialog"
;4 ComboBox 0x54230243 0x0 0 0 96 213 ""
;5 Button 0x54032000 0x0 52 16 48 14 "Button"
;END DIALOG
;DIALOG EDITOR: "" 0x2040202 "*" "" "" ""
if(!ShowDialog(dd &sub.DlgProc 0)) ret
#sub DlgProc
function# hDlg message wParam lParam
sel message
,case WM_INITDIALOG
,case WM_DESTROY
,case WM_COMMAND goto messages2
ret
;messages2
sel wParam
,case 5
,TO_CBFill id(4 hDlg) "a[]b[]c" ;;DT_SetControls uses it too
ret 1
Posts: 1,058
Threads: 367
Joined: Oct 2007
As a matter of fact it is more elegant. Thanks once more ...