Thread Rating:
  • 1 Vote(s) - 2 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to set control text
#1
I am a newbie. I am learning programming. I want to implement a simple function.

When I click the button(est edit text), the control(edit) displays the character "hello world"

I hope someone can tell me how to write code, thanks in advance

Macro Macro1
Trigger SF9     Help - how to add the trigger to the macro
Code:
Copy      Help
str dd=
;BEGIN DIALOG
;0 "" 0x90C80AC8 0x0 0 0 320 166 "Dialog"
;3 Edit 0x54030080 0x200 48 36 128 13 "edt"
;4 Button 0x54032000 0x0 52 136 62 14 "set edit text"
;1 Button 0x54030001 0x4 192 136 48 14 "OK"
;2 Button 0x54030000 0x4 256 136 48 14 "Cancel"
;END DIALOG
;DIALOG EDITOR: "" 0x2040700 "*" "" "" ""

str controls = "3"
str e3edt
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 IDOK
,case IDCANCEL
,case 4 ;;set edit text
,?????????????
ret 1
#2
str s="text"; s.setwintext(id(3 hDlg))

or

DT_SetControl(hDlg 3 "text")

or

EditReplaceSel(hDlg 3 "text" 1)
#3
Thanks for your help

I inserted the browser control. I want to make the browser display full screen. Pressing F11 is invalid. I added a button. How do I write the code and make the browser control full screen? How to define the hot key F11? Thanks again Smile

str dd=
 BEGIN DIALOG
 0 "" 0x90C80AC8 0x0 0 0 340 192 "Dialog"
 3 Button 0x54032000 0x0 128 164 48 14 "google"
 4 ActiveX 0x54030000 0x0 8 8 324 150 "SHDocVw.WebBrowser {8856F961-340A-11D0-A96B-00C04FD705A2}"
 5 Button 0x54032000 0x0 52 164 48 14 "fullscreen"
 1 Button 0x54030001 0x4 216 164 48 14 "OK"
 2 Button 0x54030000 0x4 276 164 48 14 "Cancel"
 END DIALOG
 DIALOG EDITOR: "" 0x2040700 "*" "" "" ""

str controls = "4"
str ax4SHD
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 IDOK
case IDCANCEL
case 3
DT_SetControl(hDlg 4 "http://www.google.com");;fullscreen;;fullscreen
case 5 ;;fullscreen
??????????????
ret 1
#4
this should get you started in the right direction
 need this function 


Function DT_AutoSizeControls
Code:
Copy      Help
;/
function hDlg message $controls

;Moves or resizes dialog controls when you resize the dialog.
;Call this function from dialog function, before sel message.

;hDlg, message - hDlg, message.
;controls - space-separated list of controls.
;;;Syntax for a control: IdActionDirection
;;;;;Id - control id.
;;;;;Action - m (move) or s (resize).
;;;;;Direction - h (horizontally) or v (vertically) or none (horizontally and vertically).

;EXAMPLE
;;...
;;messages
;DT_AutoSizeControls hDlg message "1m 2m 3sh 4mv 5s"
;sel message
,;case WM_INITDIALOG
,;;...


type ASC_CONTROL hwnd !action !direction horz vert
ASC_CONTROL* p
int i j k x y
RECT r rc

sel message
,case WM_INITDIALOG
,GetClientRect hDlg &rc
,
,ARRAY(lpstr) a
,tok controls a
,p._new(a.len)
,SetProp hDlg "asc_controls" p
,
,for i 0 a.len
,,ASC_CONTROL& c=p[i]
,,lpstr s=a[i] ;;out s
,,j=val(s 0 k); s+k
,,c.hwnd=id(j hDlg); if(!c.hwnd) out "Warning: control %i not found." j; continue
,,c.action=s[0]; c.direction=s[1]
,,
,,GetWindowRect c.hwnd &r; MapWindowPoints 0 hDlg +&r 2
,,sel c.action
,,,case 'm' c.horz=rc.right-r.left; c.vert=rc.bottom-r.top
,,,case 's' c.horz=rc.right-r.right; c.vert=rc.bottom-r.bottom
,
,case WM_SIZE
,GetClientRect hDlg &rc
,
,p=+GetProp(hDlg "asc_controls")
,
,for i 0 p._len
,,&c=p[i]
,,j=0; sel(c.direction) case 'h' j|2; case 'v' j|1
,,sel c.action
,,,case 'm'
,,,x=rc.right-c.horz; y=rc.bottom-c.vert
,,,mov x y c.hwnd j; err
,,,
,,,case 's'
,,,GetWindowRect c.hwnd &r; MapWindowPoints 0 hDlg +&r 2
,,,x=rc.right-r.left-c.horz; y=rc.bottom-r.top-c.vert
,,,siz x y c.hwnd j; err
,
,case WM_DESTROY
,p=+RemoveProp(hDlg "asc_controls")
,p._delete

and the dialog example

Function Dialog3
Code:
Copy      Help
str dd=
;BEGIN DIALOG
;0 "" 0x90080AC8 0x0 0 0 224 140 "Dialog"
;1 Button 0x54030001 0x4 116 116 48 14 "OK"
;2 Button 0x54030000 0x4 168 116 48 14 "Cancel"
;3 Button 0x54030F00 0x0 4 116 48 14 "google"
;5 Button 0x54030F00 0x0 60 116 48 14 "fullscreen"
;4 ActiveX 0x54030000 0x0 0 0 222 112 "SHDocVw.WebBrowser {8856F961-340A-11D0-A96B-00C04FD705A2}"
;END DIALOG
;DIALOG EDITOR: "" 0x2040500 "*" "" "" ""

str controls = "4"
str ax4SHD="http://www.quickmacros.com/forum"
if(!ShowDialog(dd &sub.DlgProc &controls)) ret


#sub DlgProc
function# hDlg message wParam lParam
DT_AutoSizeControls hDlg message "1m 2m 3m 4s 5m"
sel message
,case WM_INITDIALOG
,SHDocVw.WebBrowser-- we4
,we4._getcontrol(id(4 hDlg))
,case WM_DESTROY
,case WM_COMMAND goto messages2
ret
;messages2
sel wParam
,case IDOK
,case IDCANCEL
,case 5 ;;fullscreen
,max hDlg
,case 3 ;;google
,we4.Navigate("https://www.google.com")
,
ret 1
#5
(04-04-2018, 09:09 PM)Kevin Wrote: this should get you started in the right direction
 need this function 


Function DT_AutoSizeControls
Code:
Copy      Help
;/
function hDlg message $controls

;Moves or resizes dialog controls when you resize the dialog.
;Call this function from dialog function, before sel message.

;hDlg, message - hDlg, message.
;controls - space-separated list of controls.
;;;Syntax for a control: IdActionDirection
;;;;;Id - control id.
;;;;;Action - m (move) or s (resize).
;;;;;Direction - h (horizontally) or v (vertically) or none (horizontally and vertically).

;EXAMPLE
;;...
;;messages
;DT_AutoSizeControls hDlg message "1m 2m 3sh 4mv 5s"
;sel message
,;case WM_INITDIALOG
,;;...


type ASC_CONTROL hwnd !action !direction horz vert
ASC_CONTROL* p
int i j k x y
RECT r rc

sel message
,case WM_INITDIALOG
,GetClientRect hDlg &rc
,
,ARRAY(lpstr) a
,tok controls a
,p._new(a.len)
,SetProp hDlg "asc_controls" p
,
,for i 0 a.len
,,ASC_CONTROL& c=p[i]
,,lpstr s=a[i] ;;out s
,,j=val(s 0 k); s+k
,,c.hwnd=id(j hDlg); if(!c.hwnd) out "Warning: control %i not found." j; continue
,,c.action=s[0]; c.direction=s[1]
,,
,,GetWindowRect c.hwnd &r; MapWindowPoints 0 hDlg +&r 2
,,sel c.action
,,,case 'm' c.horz=rc.right-r.left; c.vert=rc.bottom-r.top
,,,case 's' c.horz=rc.right-r.right; c.vert=rc.bottom-r.bottom
,
,case WM_SIZE
,GetClientRect hDlg &rc
,
,p=+GetProp(hDlg "asc_controls")
,
,for i 0 p._len
,,&c=p[i]
,,j=0; sel(c.direction) case 'h' j|2; case 'v' j|1
,,sel c.action
,,,case 'm'
,,,x=rc.right-c.horz; y=rc.bottom-c.vert
,,,mov x y c.hwnd j; err
,,,
,,,case 's'
,,,GetWindowRect c.hwnd &r; MapWindowPoints 0 hDlg +&r 2
,,,x=rc.right-r.left-c.horz; y=rc.bottom-r.top-c.vert
,,,siz x y c.hwnd j; err
,
,case WM_DESTROY
,p=+RemoveProp(hDlg "asc_controls")
,p._delete

and the dialog example

Function Dialog3
Code:
Copy      Help
str dd=
;BEGIN DIALOG
;0 "" 0x90080AC8 0x0 0 0 224 140 "Dialog"
;1 Button 0x54030001 0x4 116 116 48 14 "OK"
;2 Button 0x54030000 0x4 168 116 48 14 "Cancel"
;3 Button 0x54030F00 0x0 4 116 48 14 "google"
;5 Button 0x54030F00 0x0 60 116 48 14 "fullscreen"
;4 ActiveX 0x54030000 0x0 0 0 222 112 "SHDocVw.WebBrowser {8856F961-340A-11D0-A96B-00C04FD705A2}"
;END DIALOG
;DIALOG EDITOR: "" 0x2040500 "*" "" "" ""

str controls = "4"
str ax4SHD="http://www.quickmacros.com/forum"
if(!ShowDialog(dd &sub.DlgProc &controls)) ret


#sub DlgProc
function# hDlg message wParam lParam
DT_AutoSizeControls hDlg message "1m 2m 3m 4s 5m"
sel message
,case WM_INITDIALOG
,SHDocVw.WebBrowser-- we4
,we4._getcontrol(id(4 hDlg))
,case WM_DESTROY
,case WM_COMMAND goto messages2
ret
;messages2
sel wParam
,case IDOK
,case IDCANCEL
,case 5 ;;fullscreen
,max hDlg
,case 3 ;;google
,we4.Navigate("https://www.google.com")
,
ret 1

Thank you very much for your help, I want to achieve the effect of Internet Explorer F11 hotkey, use your code, the window does not have a title bar, after the window is full-screen, the control buttons are displayed below, in addition to pressing the hot key F11 can not be between normal and full-screen Switching, thank you very much in advance, I hope that programming experts can help me improve, thanks
#6
Function dialog_full_screen
Code:
Copy      Help
str dd=
;BEGIN DIALOG
;0 "" 0x90CC0AC8 0x0 0 0 224 136 "Dialog"
;3 ActiveX 0x54030000 0x0 0 16 224 94 "SHDocVw.WebBrowser {8856F961-340A-11D0-A96B-00C04FD705A2}"
;4 Button 0x54032000 0x0 0 0 70 14 "Full screen (F11)"
;1 Button 0x54030001 0x4 116 116 48 14 "OK"
;2 Button 0x54030000 0x4 168 116 48 14 "Cancel"
;END DIALOG
;DIALOG EDITOR: "" 0x2040701 "*" "" "" ""

str controls = "3"
str ax3SHD
if(!ShowDialog(dd &sub.DlgProc &controls)) ret


#sub DlgProc
function# hDlg message wParam lParam

sel message
,case WM_INITDIALOG
,DT_SetAutoSizeControls hDlg "1m 2m 3s"
,DT_SetAccelerators hDlg "4 F11"
,
,case WM_DESTROY
,case WM_COMMAND goto messages2
ret
;messages2
sel wParam
,case IDOK
,case IDCANCEL
,case 4
,int-- t_full; t_full=!t_full
,sub.FullScreen hDlg t_full
ret 1


#sub FullScreen
function w full

if full
,max w
else
,res w

;This code just makes the window maximized or not.
;Replace it with code that makes the window really full-screen or not.
;I don't know a simple way, probably need to resize the window etc.
#7
(04-19-2018, 04:51 AM)Gintaras Wrote: Function dialog_full_screen
Code:
Copy      Help
str dd=
;BEGIN DIALOG
;0 "" 0x90CC0AC8 0x0 0 0 224 136 "Dialog"
;3 ActiveX 0x54030000 0x0 0 16 224 94 "SHDocVw.WebBrowser {8856F961-340A-11D0-A96B-00C04FD705A2}"
;4 Button 0x54032000 0x0 0 0 70 14 "Full screen (F11)"
;1 Button 0x54030001 0x4 116 116 48 14 "OK"
;2 Button 0x54030000 0x4 168 116 48 14 "Cancel"
;END DIALOG
;DIALOG EDITOR: "" 0x2040701 "*" "" "" ""

str controls = "3"
str ax3SHD
if(!ShowDialog(dd &sub.DlgProc &controls)) ret


#sub DlgProc
function# hDlg message wParam lParam

sel message
,case WM_INITDIALOG
,DT_SetAutoSizeControls hDlg "1m 2m 3s"
,DT_SetAccelerators hDlg "4 F11"
,
,case WM_DESTROY
,case WM_COMMAND goto messages2
ret
;messages2
sel wParam
,case IDOK
,case IDCANCEL
,case 4
,int-- t_full; t_full=!t_full
,sub.FullScreen hDlg t_full
ret 1


#sub FullScreen
function w full

if full
,max w
else
,res w

;This code just makes the window maximized or not.
;Replace it with code that makes the window really full-screen or not.
;I don't know a simple way, probably need to resize the window etc.

Thank you very much for your help, F11 full-screen code, I do not understand, I have a friend, he learned electron, the use of hot keys to control the full-screen code is very simple, I hope the developers can refer to the implementation in future versions,

electron code:

function setShortcut()
{
  globalShortcut.register('F11', () =>
  {
    activeWin.setFullScreen(!activeWin.isFullScreen());
  });
}
#8
(04-19-2018, 04:51 AM)Gintaras Wrote: Function dialog_full_screen
Code:
Copy      Help
str dd=
;BEGIN DIALOG
;0 "" 0x90CC0AC8 0x0 0 0 224 136 "Dialog"
;3 ActiveX 0x54030000 0x0 0 16 224 94 "SHDocVw.WebBrowser {8856F961-340A-11D0-A96B-00C04FD705A2}"
;4 Button 0x54032000 0x0 0 0 70 14 "Full screen (F11)"
;1 Button 0x54030001 0x4 116 116 48 14 "OK"
;2 Button 0x54030000 0x4 168 116 48 14 "Cancel"
;END DIALOG
;DIALOG EDITOR: "" 0x2040701 "*" "" "" ""

str controls = "3"
str ax3SHD
if(!ShowDialog(dd &sub.DlgProc &controls)) ret


#sub DlgProc
function# hDlg message wParam lParam

sel message
,case WM_INITDIALOG
,DT_SetAutoSizeControls hDlg "1m 2m 3s"
,DT_SetAccelerators hDlg "4 F11"
,
,case WM_DESTROY
,case WM_COMMAND goto messages2
ret
;messages2
sel wParam
,case IDOK
,case IDCANCEL
,case 4
,int-- t_full; t_full=!t_full
,sub.FullScreen hDlg t_full
ret 1


#sub FullScreen
function w full

if full
,max w
else
,res w

;This code just makes the window maximized or not.
;Replace it with code that makes the window really full-screen or not.
;I don't know a simple way, probably need to resize the window etc.
I would like to feedback a bug, press the hotkey ctrl+shift+R without any response, can not be compiled into an exe file, hold down the ctrl, and then click the compile button is OK, I tried both computers are the problem Huh

(04-20-2018, 02:02 AM)win Wrote:
(04-19-2018, 04:51 AM)Gintaras Wrote: Function dialog_full_screen
Code:
Copy      Help
str dd=
;BEGIN DIALOG
;0 "" 0x90CC0AC8 0x0 0 0 224 136 "Dialog"
;3 ActiveX 0x54030000 0x0 0 16 224 94 "SHDocVw.WebBrowser {8856F961-340A-11D0-A96B-00C04FD705A2}"
;4 Button 0x54032000 0x0 0 0 70 14 "Full screen (F11)"
;1 Button 0x54030001 0x4 116 116 48 14 "OK"
;2 Button 0x54030000 0x4 168 116 48 14 "Cancel"
;END DIALOG
;DIALOG EDITOR: "" 0x2040701 "*" "" "" ""

str controls = "3"
str ax3SHD
if(!ShowDialog(dd &sub.DlgProc &controls)) ret


#sub DlgProc
function# hDlg message wParam lParam

sel message
,case WM_INITDIALOG
,DT_SetAutoSizeControls hDlg "1m 2m 3s"
,DT_SetAccelerators hDlg "4 F11"
,
,case WM_DESTROY
,case WM_COMMAND goto messages2
ret
;messages2
sel wParam
,case IDOK
,case IDCANCEL
,case 4
,int-- t_full; t_full=!t_full
,sub.FullScreen hDlg t_full
ret 1


#sub FullScreen
function w full

if full
,max w
else
,res w

;This code just makes the window maximized or not.
;Replace it with code that makes the window really full-screen or not.
;I don't know a simple way, probably need to resize the window etc.
I would like to feedback a bug, press the hotkey ctrl+shift+R without any response, can not be compiled into an exe file, hold down the ctrl, and then click the compile button is OK, I tried both computers are the problem Huh

In addition, if I can customize some of the system's shortcuts, it would be great.

I want to change:
Press ctrl+E to export item (add this function)
Press ctrl+ALT+SHIFT+T to generate the AutoText for the selected text (add this function)
Press F5 to run (replace the current ctrl+R)
Press F7 to compile (replace the current ctrl+SHIFT+R)  Idea
#9
ctrl+shift+R does not compile into an exe. its checks the function or macro for errors.
and its works as it is expected for me on all my laptops and pc's 
if nothing happens when compiling a function or macro  the code does not have syntax errors!
 read more here http://www.quickmacros.com/help/QM_Help/IDH_DEBUG.html

 Please try and take the time to read the built in QM Help file!  
Gintaras has taken a lot of time to give us lots of information about qm and its capabilities.

to learn how to make an exe read here 
http://www.quickmacros.com/help/QM_Help/...KEEXE.html

again all this information is in the help file in the qm PROGRAM as well as online.
#10
(04-20-2018, 03:41 AM)Kevin Wrote: ctrl+shift+R does not compile into an exe. its checks the function or macro for errors.
and its works as it is expected for me on all my laptops and pc's 
 read more here http://www.quickmacros.com/help/QM_Help/IDH_DEBUG.html

 Please try and take the time to read the built in QM Help file!  
Gintaras has taken a lot of time to give us lots of information about qm and its capabilities.

to learn how to make an exe read here 
http://www.quickmacros.com/help/QM_Help/...KEEXE.html

again all this information is in the help file in the qm PROGRAM as well as online.

Thanks for your reminding, I'm too stupid, Tongue I just contacted QM in my friend's introduction, for a few days

After a few days of learning, QM was found to be very powerful, but there are some places in the dialog editor that I hope to improve.

E.g: Exclamation

1 window, control adjustment can not directly drag the lower right corner to change the size

2 can not select multiple controls at the same time, the width, height and other properties of the precise adjustment, movement, alignment, distribution and other operations

3 after the window full screen, the control can not automatically adapt to use the function to set, some tedious

Suggest: Idea

1 controls can drag the lower right corner to adjust the size, drag the box to select multiple controls, can align the control, distribution operation

2 Double-click the control to pop up the style settings dialog, hold down Ctrl and double-click the control to set the event

3 add controls to automatically adapt to the window size options

Finally wish, QM software is more and more simple, more and more powerful
#11
im not trying nor ever did i imply your stupid

again some of what your are trying to do can be done  check out QM Help
http://www.quickmacros.com/help/User/IDH...DITOR.html
 or click the help button in the dialog editor
as far as your comments 
1 yes you can  right click right corner and drag
2 multiple controls can be moved at the same time but their is a condition
3 not exactly sure what you mean 


qm dialogs are simple but can be very powerful
Gintaras made them simple but also gave us the ability to make them very powerful but need some coding knowledge


Forum Jump:


Users browsing this thread: 1 Guest(s)