Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Dialog Edit
#1
I think I did something like this before but I can't remember what I did and it's driving me crazy. In a dialog, how would I get the information I put into an edit box, to insert itself into somewhere else I want it. Like if I were to type: Macro1 into the edit box and hit OK, how would I get it to transfer that information into another macro or that macro itself?
#2
Heres my code. Maybe this will help give a better idea of what I want.


Dis_Enable Options:
Code:
Copy      Help
str controls = "4 5 6 10 11 12"
str e4 c5Ena c6Dis e10 c11Ena c12Dis
if(!ShowDialog("Disable_Macros_Folders" &Disable_Macros_Folders &controls)) ret




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

;BEGIN DIALOG
;0 "" 0x90C80A44 0x100 0 0 215 98 "Disable/Enable"
;1 Button 0x54030001 0x4 160 56 48 14 "OK"
;2 Button 0x54030000 0x4 160 76 48 14 "Cancel"
;3 Static 0x54000000 0x0 10 12 60 8 "Macro or Function:"
;4 Edit 0x54030080 0x200 78 10 90 13 ""
;5 Button 0x54012003 0x0 78 28 36 13 "Enable"
;6 Button 0x54012003 0x0 124 28 38 13 "Disable"
;9 Static 0x54000000 0x0 8 62 24 8 "Folder:"
;10 Edit 0x54030080 0x200 42 58 96 14 ""
;11 Button 0x54012003 0x0 42 76 38 13 "Enable"
;12 Button 0x54012003 0x0 90 76 38 13 "Disable"
;8 Button 0x54020007 0x0 2 50 146 42 "Name"
;7 Button 0x54020007 0x0 2 0 180 46 "Name"
;END DIALOG
;DIALOG EDITOR: "" 0x2010808 "" ""


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


I hope this helps understand what i'm wanting... For this to be able to disable and enable macros, functions, or folders that I type into the edit box. I just can't seem to remember how to grab that information. Any help would be great. Thanks
#3
Code:
Copy      Help
str controls = "4 5 6 10 11 12"
str e4 c5Ena c6Dis e10 c11Ena c12Dis
if(!ShowDialog("Disable_Macros_Folders" &Disable_Macros_Folders &controls)) ret
out e4
out e10
pi
#4
it might be a good idea to use option buttons instead of check box.

Code:
Copy      Help
str controls = "4 10 13 14 5 6"
str e4 e10 o13Ena o14Dis o5Ena o6Dis
if(!ShowDialog("Disable_Macros_Folders" &Disable_Macros_Folders &controls)) ret
out e4
out e10

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

;BEGIN DIALOG
;0 "" 0x90C80A44 0x100 0 0 213 95 "Disable/Enable"
;1 Button 0x54030001 0x4 160 56 48 14 "OK"
;2 Button 0x54030000 0x4 160 76 48 14 "Cancel"
;3 Static 0x54000000 0x0 10 12 60 8 "Macro or Function:"
;4 Edit 0x54030080 0x200 78 10 90 13 ""
;9 Static 0x54000000 0x0 8 62 24 8 "Folder:"
;10 Edit 0x54030080 0x200 42 58 96 14 ""
;13 Button 0x54032009 0x0 42 30 42 12 "Enable"
;14 Button 0x54002009 0x0 94 30 42 12 "Disable"
;5 Button 0x54032009 0x0 44 76 42 13 "Enable"
;6 Button 0x54002009 0x0 94 76 44 13 "Disable"
;8 Button 0x54020007 0x0 2 50 146 42 "Name"
;7 Button 0x54020007 0x0 2 0 180 46 "Name"
;END DIALOG
;DIALOG EDITOR: "" 0x202000B "" ""


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
pi
#5
Thanks for the help.
#6
Hmmmm, for some reason its not working?


Dis_Enable Options:

Code:
Copy      Help
str controls = "4 10 5 6 11 12"
str e4 e10 o5Ena o6Ena o11Dis o12Dis
if(!ShowDialog("Disable_Macros_Folders" &Disable_Macros_Folders &controls)) ret


Disable_Macros_Folders:

Code:
Copy      Help
;\Dialog_Editor

function# hDlg message wParam lParam
if(hDlg) goto messages

str controls = "4 10 5 6 11 12"
str e4 e10 o5Ena o6Ena o11Dis o12Dis

;BEGIN DIALOG
;0 "" 0x90C80A44 0x100 0 0 215 98 "Disable/Enable"
;1 Button 0x54030001 0x4 160 56 48 14 "OK"
;2 Button 0x54030000 0x4 160 76 48 14 "Cancel"
;3 Static 0x54000000 0x0 10 12 60 8 "Macro or Function:"
;4 Edit 0x54030080 0x200 78 10 90 13 ""
;9 Static 0x54000000 0x0 8 62 24 8 "Folder:"
;10 Edit 0x54030080 0x200 42 58 96 14 ""
;5 Button 0x54032009 0x0 80 28 38 10 "Enable"
;6 Button 0x54032009 0x0 44 76 36 10 "Enable"
;11 Button 0x54002009 0x0 124 28 38 10 "Disable"
;12 Button 0x54002009 0x0 86 76 40 10 "Disable"
;8 Button 0x54020007 0x0 2 50 146 42 "Name"
;7 Button 0x54020007 0x0 2 0 180 46 "Name"
;END DIALOG
;DIALOG EDITOR: "" 0x2010808 "" ""



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 5
,,dis- e4
,case 11
,,dis+ e4
,case 6
,,dis- e10 1
,case 12
,,dis+ e10 1
,case IDOK DT_Ok hDlg
,case IDCANCEL DT_Cancel hDlg
ret 1


What am I doing wrong? I tested the dis+ e4 in the trigger macro and it worked but then I tried it in the actual Dialog and it wouldn't work?
#7
These variables are not valid in dialog function. Use getwintext.
#8
Hmmm, I tried something else yet i still can't get it. Any help would be greatly appreciated.

Macro3:
Code:
Copy      Help
str controls = "5 6 7 8 9 10 12 13 14 16 18 19 20 17 21 22 23"
str e5 e6 c7Ena c8Ena c9Dis c10Dis e12 c13Mac c14Fun e16 c18Fol c19Men c20Too e17 e21 e22 e23
if(!ShowDialog("DisableEnableDelete" &DisableEnableDelete &controls)) ret



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


;BEGIN DIALOG
;0 "" 0x90C80A44 0x100 0 0 239 135 "Disable/Enable"
;1 Button 0x54030001 0x4 124 118 48 14 "OK"
;2 Button 0x54030000 0x4 176 118 48 14 "Cancel"
;5 Edit 0x54030080 0x200 14 16 96 14 ""
;6 Edit 0x54030080 0x200 14 74 96 14 ""
;7 Button 0x54012003 0x0 16 38 34 12 "Enable"
;8 Button 0x54012003 0x0 14 96 34 12 "Enable"
;9 Button 0x54012003 0x0 62 96 34 12 "Disable"
;10 Button 0x54012003 0x0 64 38 34 12 "Disable"
;12 Edit 0x54030080 0x200 128 16 96 14 ""
;13 Button 0x54012003 0x0 126 46 36 8 "Macro:"
;14 Button 0x54012003 0x0 126 60 40 8 "Function:"
;16 Edit 0x54030080 0x200 166 44 58 14 ""
;18 Button 0x54012003 0x0 126 74 36 8 "Folder:"
;19 Button 0x54012003 0x0 126 88 32 8 "Menu:"
;20 Button 0x54012003 0x0 126 102 38 8 "Toolbar:"
;17 Edit 0x54030080 0x200 166 58 58 14 ""
;21 Edit 0x54030080 0x200 166 72 58 14 ""
;22 Edit 0x54030080 0x200 166 86 58 14 ""
;23 Edit 0x54030080 0x200 166 100 58 14 ""
;15 Button 0x54020007 0x0 122 36 106 80 "Create New:"
;11 Button 0x54020007 0x0 124 6 104 28 "Delete Files or Folders:"
;3 Button 0x54020007 0x0 10 62 104 54 "Folder and Others:"
;4 Button 0x54020007 0x0 10 6 104 52 "Macro and Functions:"
;END DIALOG
;DIALOG EDITOR: "" 0x2010808 "" ""



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 13
,,men 32995 "Quick Macros" ;;New Macro
,case 14
,,men 32978 "Quick Macros" ;;New Function
,case 18
,,men 32999 "Quick Macros" ;;New Folder
,case 19
,,men 32979 "Quick Macros" ;;New Menu
,case 20
,,men 32980 "Quick Macros" ;;New Toolbar
,case 7
,,str s.getwintext(id(5 "Disable/Enable"))
,,dis- s
,case 10
,,dis+ s
,case 8
,,str d.getwintext(id(5 "Disable/Enable"))
,,dis- d
,case 9
,,dis+ d
,case IDOK DT_Ok hDlg
,case IDCANCEL DT_Cancel hDlg
ret 1
#9
You call dis+ s, and dis+ d, but don't call getwintext before.
#10
Yep, you're right. Thanks for the help.
#11
Hey, sorry for bothering with this macro so much. I just really want to get it working and I seem to be having a major brainfart and just can't get it to work.

I got it set up to when you check a macro, function, menu, toolbar, folder etc. it will create one, but I can't seem to be able to get the naming part of it to work. Also if possible I would like to get it set up so that it doesn't create the macro, function etc. until after I hit the OK button. Sorry for the bother and Thank you for all the help.


Attached Files
.qml   Toolbars.qml (Size: 3.2 KB / Downloads: 507)
#12
Close dialog when you press OK, or leave it running?

Naming part: I don't know what does not work. To create macros and other items, also can be used function newitem.
#13
Sorry for the confusion, for the creating macros, I want it to not create the macro, function etc. until after I hit OK, but with the naming part, I want to name the macros, functions etc. but whichever option I check, it creates the macro immediately and doesnt grab the name I typed in, and I don't want it to create it until after I click OK.
#14
These codes after case run when you click checkboxes. If you need to create macros etc when dialog is closed, remove all these codes and write code in Macro3, after ShowDialog line. Then variables e5 and others are valid.
#15
Thats what I had tried originally, but then I had trouble grabbing the window text for the name of the macro.
When I run this to create a macro:

Macro3:
Code:
Copy      Help
str controls = "5 6 7 8 9 10 12 13 14 16 18 19 20 17 21 22 23"
str e5 e6 c7Ena c8Ena c9Dis c10Dis e12 c13Mac c14Fun e16 c18Fol c19Men c20Too e17 e21 e22 e23
if(!ShowDialog("DisableEnableDelete" &DisableEnableDelete &controls)) ret
if(c13Mac=1)
,str a.getwintext(id(16 "Disable/Enable"))
,men 32995 "Quick Macros" ;;New Macro
,men 32990 "Quick Macros" ;;Rename
,a.setwintext(id(1 "Quick"))


I get an Error:
Error (RT) in Macro3: window not found
Code:
Copy      Help
,str a.getwintext(id(16 "Disable/Enable"))
on that part of the macro.
#16
You don't need str a.getwintext(id(16 "Disable/Enable")). The text is in e16.
#17
Oh, I see what your saying, but then how would I grab the information from e16? Would I just use
Code:
Copy      Help
,outp e16
.
#18
e16 is normal str variable, like a. You can do with it everything you can do with a. Or copy it to a:

str a=e16
#19
Okay, Thank you for all of your help.


Forum Jump:


Users browsing this thread: 1 Guest(s)