Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Combo selection from menu
#1
In a menu, among other choices, I want to select an item from a combo box. I wrote the code attached. I wonder whether there exists any other more elegant technique. Any advice will be much appreciated. Thanks in advance.

Menu Menu34_Combo
Code:
Copy      Help
Line 1 :mes "Line1" *
Combo :mac "Dialog34_Combo" *

Function Dialog34_Combo
Code:
Copy      Help
\Dialog_Editor

str dd=
;BEGIN DIALOG
;0 "" 0x90000AC8 0x0 0 0 58 14 "Dialog"
;3 ComboBox 0x54230243 0x0 6 1 49 212 ""
;END DIALOG
;DIALOG EDITOR: "" 0x2040202 "*" "" "" ""

str controls = "3"
str cb3
cb3=
;1991
;1992
;1993
;1994
;1995

if(!ShowDialog(dd &sub.DlgProc &controls)) 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 [CBN_SELCHANGE<<16|3]
,,CB_SelectedItem(id(3 hDlg) _s)
,,_s.setclip
,,DT_Ok hDlg
,case IDOK
,case IDCANCEL
ret 1
#2
Function ListDialog can replace this dialog.
#3
Many thanks indeed for a useful advice. I wish I had it before writing this code. I will find it and I will try to apply. Best regards.
#4
Dear Gintaras,

I used function ListDialog, I found it excellent and extremely helpful. Furthermore, I found it useful to add two minor improvements, namely :
(a) Possibility to attach a toolbar to ListDialog's window.
(b) Possibility to increase or decrease ListDialog's window (width & height).

I attach herewith the function modified as above, for any comments.
Best regards.


Attached Files
.qml   ListDialog_F.qml (Size: 10 KB / Downloads: 355)


Forum Jump:


Users browsing this thread: 1 Guest(s)