Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Populate ComboBox at runtime
#1
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
Code:
Copy      Help
;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
#2
In System folder functions I use function TO_CBFill. The same as your code. Not faster.

Function Dialog162
Code:
Copy      Help
\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
#3
As a matter of fact it is more elegant. Thanks once more ...


Forum Jump:


Users browsing this thread: 1 Guest(s)