Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Get which option was pressed
#1
You use CB_GetItemText to get the combo box text (or maybe you call it populate it).

Function Function4
Code:
Copy      Help
\Dialog_Editor
function# hDlg message wParam lParam
if(hDlg) goto messages

str controls = "3 7 8 9"
str cb3 o7Wan o8Wil o9No
rget cb3 "cb" "\test\test"
if(!ShowDialog("Function4" &Function4 &controls)) ret

;BEGIN DIALOG
;0 "" 0x90C80A44 0x100 0 0 223 135 "Name List"
;1 Button 0x54030001 0x4 2 110 48 14 "OK"
;2 Button 0x54030000 0x4 60 110 48 14 "Cancel"
;3 ComboBox 0x54230641 0x0 6 16 96 56 ""
;5 Button 0x54032000 0x0 104 16 18 14 "+"
;6 Button 0x54032000 0x0 104 32 18 14 "-"
;7 Button 0x54032009 0x0 148 6 135 12 "Wants you to call"
;8 Button 0x54002009 0x0 148 22 135 12 "Will call back"
;9 Button 0x54002009 0x0 148 38 135 12 "No message"
;4 Button 0x54020007 0x0 2 2 126 96 "Employee Names "
;END DIALOG
;DIALOG EDITOR: "" 0x2030001 "" "" ""

ret
;messages
sel message
,case WM_INITDIALOG
,case WM_COMMAND goto messages2
ret
;messages2
sel wParam
,case 5 ;;+
,str s.getwintext(id(3 hDlg))
,s.trim; if(!s.len) ret
,CB_Add id(3 hDlg) s
,;SendMessage id(3 hDlg) CB_ADDSTRING 0 s ;;use this instead of the above line if CB_Add is unavailable
,
,case 6 ;;-
,int i=CB_SelectedItem(id(3 hDlg))
,if(i<0) ret
,SendMessage id(3 hDlg) CB_DELETESTRING i 0
,
,case IDOK
,int j h=id(3 hDlg); str s1
,ARRAY(str) a
,for j 0 CB_GetCount(h)
,,CB_GetItemText h j s1
,,a[]=s1
,out a
,
,case IDCANCEL
ret 1

Is there a way to get an option (out of a group of options) such as option 1, option 2 or option 3 and put in an array? I think that this is possible because you use option first option next to group options in your dialogs. I know that my example does not work but maybe someone can give me an example that does.

Function Function5
Code:
Copy      Help
\Dialog_Editor
function# hDlg message wParam lParam
if(hDlg) goto messages

str controls = "3 7 8 9"
str cb3 o7Wan o8Wil o9No
rget cb3 "cb" "\test\test"
if(!ShowDialog("Function5" &Function5 &controls)) ret

;BEGIN DIALOG
;0 "" 0x90C80A44 0x100 0 0 223 135 "Name List"
;7 Button 0x54032009 0x0 10 6 135 12 "Option 1"
;8 Button 0x54002009 0x0 10 22 135 12 "Option 2"
;1 Button 0x54030001 0x4 2 110 48 14 "OK"
;2 Button 0x54030000 0x4 60 110 48 14 "Cancel"
;9 Button 0x54002009 0x0 10 38 135 12 "Option 3"
;END DIALOG
;DIALOG EDITOR: "" 0x2030001 "" "" ""

ret
;messages
sel message
,case WM_INITDIALOG
,case WM_COMMAND goto messages2
ret
;messages2
sel wParam
,case 5 ;;+
,str s.getwintext(id(3 hDlg))
,s.trim; if(!s.len) ret
,CB_Add id(3 hDlg) s
,;SendMessage id(3 hDlg) CB_ADDSTRING 0 s ;;use this instead of the above line if CB_Add is unavailable
,
,case 6 ;;-
,int i=CB_SelectedItem(id(3 hDlg))
,if(i<0) ret
,SendMessage id(3 hDlg) CB_DELETESTRING i 0
,
,case IDOK
,int j h=id(3 hDlg) or h=id(4 hDlg) or h=id(5 hDlg); str s1
,ARRAY(str) a
,for j 0 GetOption(h)
,,GetOption h j s1
,,a[]=s1
,out a
,
,case IDCANCEL
ret 1


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)