Thread Rating:
  • 1 Vote(s) - 2 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to set control text
#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


Messages In This Thread
How to set control text - by win - 04-04-2018, 11:02 AM
RE: How to set control text - by Gintaras - 04-04-2018, 12:44 PM
RE: How to set control text - by win - 04-04-2018, 01:10 PM
RE: How to set control text - by Kevin - 04-04-2018, 09:09 PM
RE: How to set control text - by win - 04-18-2018, 11:55 PM
RE: How to set control text - by Gintaras - 04-19-2018, 04:51 AM
RE: How to set control text - by win - 04-19-2018, 06:38 AM
RE: How to set control text - by win - 04-20-2018, 02:02 AM
RE: How to set control text - by Kevin - 04-20-2018, 03:41 AM
RE: How to set control text - by win - 04-20-2018, 03:52 AM
RE: How to set control text - by Kevin - 04-20-2018, 04:12 AM

Forum Jump:


Users browsing this thread: 2 Guest(s)