Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
select combobox item from ini file
#3
To select combo box items using a variable, call CB_SelectItem or CB_SelectString in dialog procedure, under case WM_INITDIALOG.

Or before ShowDialog insert & in the dialog variable. This function makes it easier.
Function CB_InitDialogVariable
Code:
Copy      Help
;/
function str&cbVar selItem [$items]

;Formats cbVar to be passed to ShowDialog as a combo box variable.
;Inserts & depending on selItem.

;cbVar - combo box variable. Should not have lines that begin with &.
;selItem - 0-based item index.
;items - if used, adds to cbVar (then cbVar can be empty).


if(!empty(items)) cbVar.addline(items)
if(selItem<0) ret
selItem=findl(cbVar selItem); if(selItem<0) ret
cbVar.insert("&" selItem)
Macro Macro2571
Code:
Copy      Help
ARRAY(str) Use_S.createlb(10 1)
Use_S[1]="2" ;;2 is 0-based index
str cb20
cb20 = "1[]2[]3[]4[]5"
CB_InitDialogVariable cb20 val(Use_S[1])
out cb20


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)