Posts: 858
Threads: 196
Joined: Apr 2005
How works?
;\Dialog_Editor
function# hDlg message wParam lParam
if(hDlg) goto messages
;BEGIN DIALOG
;0 "" 0x10C80A44 0x100 0 0 223 135 "Form"
;1 Button 0x54030001 0x4 120 116 48 14 "OK"
;2 Button 0x54030000 0x4 170 116 48 14 "Cancel"
;3 Edit 0x54030080 0x200 34 26 16 14 ""
;4 msctls_updown32 0x54000000 0x0 50 26 6 14 ""
;END DIALOG
;DIALOG EDITOR: "" 0x2010703 "" ""
ret
;messages
sel message
,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 IDOK DT_Ok hDlg
,case IDCANCEL DT_Cancel hDlg
ret 1
Posts: 12,071
Threads: 140
Joined: Dec 2002
Sample dialog (function dialog_with_updown):
\Dialog_Editor
function# hDlg message wParam lParam
if(hDlg) goto messages
str controls = "3"
str e3
if(!ShowDialog("dialog_with_updown" &dialog_with_updown &controls)) ret
;BEGIN DIALOG
;0 "" 0x10C80A44 0x100 0 0 223 135 "Form"
;1 Button 0x54030001 0x4 120 116 48 14 "OK"
;2 Button 0x54030000 0x4 170 116 48 14 "Cancel"
;3 Edit 0x54030080 0x204 34 26 16 14 ""
;4 msctls_updown32 0x54000002 0x4 50 26 11 14 ""
;END DIALOG
;DIALOG EDITOR: "" 0x2010703 "" ""
ret
;messages
sel message
,case WM_INITDIALOG
,DT_Init(hDlg lParam)
,
,InitUpDownControl id(4 hDlg) id(3 hDlg) 0 100 0
,
,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
Function InitUpDownControl:
;/
function hwndUpdown hwndBuddy rangeMin rangeMax [position]
;Initializes up-down control (msctls_updown32).
;Call from dialog procedure, under WM_INITDIALOG.
;Also, include 2 in msctls_updown32 style in dialog definition (eg change 0x54000000 to 0x54000002).
def UDS_SETBUDDYINT 0x0002
def UDM_SETBUDDY (WM_USER+105)
def UDM_SETRANGE32 (WM_USER+111)
def UDM_SETPOS32 (WM_USER+113)
SendMessage hwndUpdown UDM_SETBUDDY hwndBuddy 0
SendMessage hwndUpdown UDM_SETRANGE32 rangeMin rangeMax
SendMessage hwndUpdown UDM_SETPOS32 0 position
All Windows controls are documented in the MSDN Library.
Posts: 858
Threads: 196
Joined: Apr 2005
Thanks.
Edit 0x54230080=msctls_updown32?
Posts: 12,071
Threads: 140
Joined: Dec 2002
It is buddy of msctls_updown32.
Posts: 858
Threads: 196
Joined: Apr 2005
Ok.
def UDS_NOTHOUSANDS ?
Posts: 12,071
Threads: 140
Joined: Dec 2002
Type or click it and look at the status bar. Or press F1 or F2.
Posts: 858
Threads: 196
Joined: Apr 2005
I don't understand. I want:
edit box=1234 not 1.234
Posts: 12,071
Threads: 140
Joined: Dec 2002
UDS_NOTHOUSANDS is 0x80. Include it in msctls_updown32 style. If now style is 0x54000002, change it to 0x54000082. Because 0x54000002|0x00000080 = 0x54000082.
Posts: 858
Threads: 196
Joined: Apr 2005
Posts: 262
Threads: 63
Joined: Nov 2005
I have several issues with this and I think I should use one post for all but I am sorry if I should have used more posts.
I have read the MSDN and I can not seem to find any information on how to use a decimal in an msctls_updown32 control. I would also like to be able to use “ for inches.
I also have one last issue. Because decimal and inches can be quite long and I am not calling this in a normal way like (e1713 = "12.25''[]12.2'') How can I use an array for this?
Posts: 858
Threads: 196
Joined: Apr 2005
InitUpDownControl Increment
note: edit UdIncrement
_s=_d;_s+"''";_s.setwintext(buddy)
Posts: 262
Threads: 63
Joined: Nov 2005
Thank You - Lucas
I was looking at this yesterday and for some reason I did not connect the dots. I made some changes but I think that there is a better way to do the changes but that will be for another day.
Function dialog_with_updown2
\Dialog_Editor
function# hDlg message wParam lParam
if(hDlg) goto messages
str controls = "3"
str e3
e3=0
if(!ShowDialog("dialog_with_updown2" &dialog_with_updown2 &controls)) ret
;BEGIN DIALOG
;0 "" 0x10C80A44 0x100 0 0 223 135 "Form"
;1 Button 0x54030001 0x4 120 116 48 14 "OK"
;2 Button 0x54030000 0x4 170 116 48 14 "Cancel"
;3 Edit 0x54030080 0x204 16 28 32 13 ""
;4 msctls_updown32 0x54000082 0x4 50 26 11 14 ""
;END DIALOG
;DIALOG EDITOR: "" 0x2010703 "" ""
ret
;messages
sel message
,case WM_INITDIALOG
,_s="0''"; _s.setwintext(id(3 win("Form" "#32770")))
,case WM_DESTROY
,case WM_COMMAND goto messages2
,case WM_NOTIFY goto messages3
ret
;messages2
sel wParam
,case IDOK
,case IDCANCEL
ret 1
;messages3
NMHDR* nh=+lParam
sel nh.idFrom
,case 4
,sel nh.code
,,case UDN_DELTAPOS
,,str a.getwintext(id(3 win("Form" "#32770")))
,,if(a = "12.25''")
,,,_s="12.3''"; _s.setwintext(id(3 win("Form" "#32770")))
,,ret UdIncrement(nh 3 0.1 0 12.25) ;;0.01 is step. change it
,,
Function UdIncrement
;/
function# NMHDR*nh idEdit double'step [double'rangeMin] [double'rangeMax]
NMUPDOWN* nu=+nh
;out "%i %i" nu.iPos nu.iDelta ;; :)
int hDlg=GetParent(nh.hwndFrom)
int buddy=id(idEdit hDlg)
double _d=val(_s.getwintext(buddy) 2)
_d-step*nu.iDelta
if(rangeMin or rangeMax)
,if(_d<rangeMin) _d=rangeMin
,if(_d>rangeMax) _d=rangeMax
,_s=_d;_s+"''";_s.setwintext(buddy)
/_s=_d; _s.setwintext(buddy)
ret DT_Ret(hDlg 1)
/_s=_d;_s+"''";_s.setwintext(buddy)
|