Posts: 160
Threads: 43
Joined: Sep 2007
hi,
Is there a way to make a dialogue where u can only check 1 of the check buttons. Then press ok and it will run a diff function for each you checked and pressed ok. I dont want it to be able 2 check like 2 out of the 4 check buttons. I only want them to be able to check 1, sorry iv not done any dialogue before and trying to understand it heres what i have and i dnt think im anywhere near understanding how 2 do this right its in smart dialogue if that helps
function# hDlg message wParam lParam
if(hDlg) goto messages
;BEGIN DIALOG
;0 "" 0x90C80A44 0x190 0 0 90 95 "Form"
;1 Button 0x54030001 0x4 0 82 48 13 "OK"
;3 Button 0x54012003 0x0 0 3 98 15 "1"
;4 Button 0x54012003 0x0 0 20 108 23 "2"
;5 Button 0x54012003 0x0 0 46 108 15 "3"
;6 Button 0x54012003 0x0 0 64 108 15 "4"
;10 Static 0x54000010 0x20000 0 44 95 2 ""
;9 Static 0x54000010 0x20000 2 18 95 1 ""
;8 Static 0x54000010 0x20000 0 62 95 1 ""
;END DIALOG
;DIALOG EDITOR: "" 0x202000B "" ""
str controls = "3 4 5 6"
str c3Che c4Che c5Che c6Che
if(!ShowDialog("C_CPUD" &C_CPUD &controls)) ret
ret
;messages
if(message=WM_INITDIALOG) DT_Init(hDlg lParam)
;int param=DT_GetParam(hDlg)
sel message
,case WM_INITDIALOG
,ret 1
,case WM_DESTROY DT_DeleteData(hDlg)
,case WM_COMMAND goto messages2
ret
;messages2
sel wParam
,case IDOK DT_Ok hDlg
,case IDCANCEL DT_Cancel hDlg
ret 1
Posts: 160
Threads: 43
Joined: Sep 2007
sorry i double posted this some how
Posts: 12,140
Threads: 142
Joined: Dec 2002
Why don't use Option buttons?
Posts: 160
Threads: 43
Joined: Sep 2007
Gintaras Wrote:Why don't use Option buttons? im not sure how to do anything on dialogue iv read up on it but cnt understand it much ill try and find them now ty
Posts: 473
Threads: 33
Joined: Aug 2007
Just use "Other Option."
Function ( C_CPUD )
function# hDlg message wParam lParam
if(hDlg) goto messages
;BEGIN DIALOG
;0 "" 0x90C80A44 0x190 0 0 90 95 "Form"
;1 Button 0x54030001 0x4 0 82 48 13 "OK"
;3 Button 0x54002009 0x0 0 3 98 15 "1"
;4 Button 0x54002009 0x0 0 20 108 23 "2"
;5 Button 0x54002009 0x0 0 46 108 15 "3"
;6 Button 0x54002009 0x0 0 64 108 15 "4"
;10 Static 0x54000010 0x20000 0 44 95 2 ""
;9 Static 0x54000010 0x20000 2 18 95 1 ""
;8 Static 0x54000010 0x20000 0 62 95 1 ""
;END DIALOG
;DIALOG EDITOR: "" 0x202000B "" ""
str controls = "3 4 5 6"
str c3Che c4Che c5Che c6Che
if(!ShowDialog("C_CPUD" &C_CPUD &controls)) ret
if(c3Che=1)
,out "1"
if(c4Che=1)
,out "2"
if(c5Che=1)
,out "3"
if(c6Che=1)
,out "4"
ret
;messages
if(message=WM_INITDIALOG) DT_Init(hDlg lParam)
;int param=DT_GetParam(hDlg)
sel message
,case WM_INITDIALOG
,ret 1
,case WM_DESTROY DT_DeleteData(hDlg)
,case WM_COMMAND goto messages2
ret
;messages2
sel wParam
,case IDOK DT_Ok hDlg
,case IDCANCEL DT_Cancel hDlg
ret 1
Taking on Quick Macros one day at a time
Posts: 1,338
Threads: 61
Joined: Jul 2006
if u want it 2 peform an action immediately when one something is checked u need a case statement
2 do this go back in the dialog editor and click on each button then click events and select
BN_CLICKED(button clicked) the editor will place the code for the case statement in your dialog and move the cursor right there so u can put in your code of what u want it 2 do when that particular button is clicked
Posts: 160
Threads: 43
Joined: Sep 2007
ok tyvm all i didnt realise that c3Che c4Che was the variables of the controls and still not sure they are but if they are im starting to understand it a little and will probly catch on soon great help much apriciated
Posts: 1,338
Threads: 61
Joined: Jul 2006
here is an example of what i am talking about
;\Dialog_Editor
function# hDlg message wParam lParam
if(hDlg) goto messages
;BEGIN DIALOG
;0 "" 0x90C80A44 0x190 0 0 89 94 "Form"
;1 Button 0x54030001 0x4 0 82 48 13 "OK"
;3 Button 0x54012003 0x0 0 3 98 15 "1"
;4 Button 0x54012003 0x0 0 20 108 23 "2"
;5 Button 0x54012003 0x0 0 46 108 15 "3"
;6 Button 0x54012003 0x0 0 64 108 15 "4"
;10 Static 0x54000010 0x20000 0 44 94 2 ""
;9 Static 0x54000010 0x20000 2 18 94 1 ""
;8 Static 0x54000010 0x20000 0 62 94 1 ""
;END DIALOG
;DIALOG EDITOR: "" 0x2010901 "" ""
str controls = "3 4 5 6"
str c3 c4 c5 c6
if(!ShowDialog("C_CPUD" &C_CPUD &controls)) ret
ret
;messages
if(message=WM_INITDIALOG) DT_Init(hDlg lParam)
;int param=DT_GetParam(hDlg)
sel message
,case WM_INITDIALOG
,ret 1
,case WM_DESTROY DT_DeleteData(hDlg)
,case WM_COMMAND goto messages2
ret
;messages2
sel wParam
,case 6 ;;<----button4 clicked
,out "#4 is Checked";;;<--- example action
,clo hDlg;; dialog will be closed using this
,case 5 ;;<----button3 clicked
,out "#3 is Checked";;;<--- example action
,clo hDlg;; dialog will be closed using this
,case 4 ;;<----button2 clicked
,out "#2 is Checked";;;<--- example action
,clo hDlg;; dialog will be closed using this
,case 3 ;;<-----button1 clicked
,out "#1 is Checked";;;<--- example action
,clo hDlg;; dialog will be closed using this
,case IDOK DT_Ok hDlg
,case IDCANCEL DT_Cancel hDlg
ret 1
Posts: 160
Threads: 43
Joined: Sep 2007
Kevin Wrote:if u want it 2 peform an action immediately when one something is checked u need a case statement
2 do this go back in the dialog editor and click on each button then click events and select
BN_CLICKED(button clicked) the editor will place the code for the case statement in your dialog and move the cursor right there so u can put in your code of what u want it 2 do when that particular button is clicked cool i will try that but if i understand correctly u could click the wrong one by mistake and it would run instantly i dnt want it to do anything till ok is pressed but ty
Posts: 1,338
Threads: 61
Joined: Jul 2006
look around the forum there are alot of examples of what your trying to do
this is 1
Dialog Radio Buttons
Posts: 473
Threads: 33
Joined: Aug 2007
Also in the QM reference just search for "Dialog." That will help you understand all the variables and what not.
Taking on Quick Macros one day at a time
Posts: 576
Threads: 97
Joined: Aug 2007
just search around the forum for "check dialog" and you will gt enough posts to figure everything you need to know out.
Posts: 160
Threads: 43
Joined: Sep 2007
sorry i cant find out how to do this anywhere but im sure you can do it i just think im doing it wrong i want to make a main window dialogue that will run my other dialogues when a button is pressed iv layed it out and thought i knew how to do this but it dont seem to work its probly something simple im getting wrong function# hDlg message wParam lParam
if(hDlg) goto messages
;BEGIN DIALOG
;0 "" 0x90C80A44 0x100 0 0 223 135 "MAIN WINDOW"
;1 Button 0x54030001 0x4 36 114 48 14 "OK"
;2 Button 0x54030000 0x4 140 114 48 14 "CANEL"
;3 Static 0x54000000 0x0 5 1 58 17 ""
;4 Static 0x54000000 0x0 72 1 23 17 ""
;5 Static 0x54000000 0x0 114 1 48 15 ""
;6 Static 0x54000000 0x0 173 1 48 15 ""
;8 Button 0x54032000 0x0 10 18 48 14 "1"
;9 Button 0x54032000 0x0 62 18 48 14 "2"
;10 Button 0x54032000 0x0 114 18 48 14 "3"
;11 Button 0x54032000 0x0 166 18 48 14 "4"
;12 Edit 0x54230844 0x20000 12 34 200 78 ""
;END DIALOG
;DIALOG EDITOR: "" 0x202000B "" ""
str controls = "8 9 10 11"
str MWD MWD1 MWD2 MWD3
if(!ShowDialog("C_MWD" &C_MWD &controls)) ret
if(MWD=1)
,mac "C_CPUD"
if(MWD1=1)
,mac "C_RBWD"
if(MWD2=1)
,mac "C_TSD"
if(MWD3=1)
,mac "C_D1"
ret
;messages
if(message=WM_INITDIALOG) DT_Init(hDlg lParam)
;int param=DT_GetParam(hDlg)
sel message
,case WM_LBUTTONUP
,case WM_INITDIALOG
,ret 1
,case WM_DESTROY DT_DeleteData(hDlg)
,case WM_COMMAND goto messages2
ret
;messages2
sel wParam
,case IDOK DT_Ok hDlg
,case IDCANCEL DT_Cancel hDlg
ret 1
im sorry if this is allready posted but everytime i type dialogue in the search box nothing comes up
Posts: 1,271
Threads: 399
Joined: Mar 2003
you have to search for 'dialog' ...
C_MWD
\Dialog_Editor
function# hDlg message wParam lParam
if(hDlg) goto messages
str controls = "8 9 10 11"
str MWD MWD1 MWD2 MWD3
if(!ShowDialog("C_MWD" &C_MWD &controls)) ret
;BEGIN DIALOG
;0 "" 0x90C80A44 0x100 0 0 223 135 "MAIN WINDOW"
;1 Button 0x54030001 0x4 36 114 48 14 "OK"
;2 Button 0x54030000 0x4 140 114 48 14 "CANEL"
;3 Static 0x54000000 0x0 5 1 58 17 ""
;4 Static 0x54000000 0x0 72 1 23 17 ""
;5 Static 0x54000000 0x0 114 1 48 15 ""
;6 Static 0x54000000 0x0 173 1 48 15 ""
;8 Button 0x54032000 0x0 10 18 48 14 "1"
;9 Button 0x54032000 0x0 62 18 48 14 "2"
;10 Button 0x54032000 0x0 114 18 48 14 "3"
;11 Button 0x54032000 0x0 166 18 48 14 "4"
;12 Edit 0x54230844 0x20000 12 34 200 78 ""
;END DIALOG
;DIALOG EDITOR: "" 0x202000B "" ""
ret
;messages
sel message
,case WM_LBUTTONUP
,case WM_INITDIALOG DT_Init(hDlg lParam)
,ret 1
,case WM_DESTROY DT_DeleteData(hDlg)
,case WM_COMMAND goto messages2
ret
;messages2
sel wParam
,case 8
,,out "MWD ";; mac "C_CPUD"
,case 9
,,out "MWD1";; mac "C_RBWD"
,case 10
,,out "MWD2";; mac "C_TSD"
,case 11
,,out "MWD3";; mac "C_D1"
,case IDOK DT_Ok hDlg
,case IDCANCEL DT_Cancel hDlg
ret 1
Posts: 160
Threads: 43
Joined: Sep 2007
sorry i always misspell that f** word it curses me lol
Posts: 160
Threads: 43
Joined: Sep 2007
and ty i will try this now
Posts: 160
Threads: 43
Joined: Sep 2007
yep worked great with a few adjustments i didnt need the variables outputing to qm so i removed them and just made it run the macs instead real big help ty
|