04-22-2009, 02:22 AM
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
Function UdIncrement
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)