Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
select combobox item from ini file
#1
Hi~ Gintaras~!

I don't know the way to select combobox item from ini file when execute.

I tried like this...

Code:
Copy      Help
str+ inifile = "c:\Setting.ini"
ARRAY(str) Use_S.createlb(10 1)

rget Use_S[1] "Use_S1" "Tab1" inifile
.....
20 ComboBox 0x54230243 0x0 80 54 30 50 ""
.....
str controls = "cb20"
......
cb20 = "&1[]2[]3[]4[]5"

and Next I want cb20 selected by Use_S[1].

What should I do?

I tried CB.SelectItem but failed.

thanks in advance~!
#2
Maybe this is what you need:
Save dialog control values
#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
#4
Thank You Again Gintaras~!


Forum Jump:


Users browsing this thread: 1 Guest(s)