babaorom Posted March 4, 2012 Share Posted March 4, 2012 Hi, How is it possible to increment a decimal value inside an input Ctrl ? for example : the InputCtrl contains 22.9 and after a click on the Up arrow the InputCtrl contains 23.0 ; 23.1 ; 23.2 ....... Thanks a lot for your help. Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted March 4, 2012 Moderators Share Posted March 4, 2012 babaorom, You cannot show a decimal value in the input directly - you have to cheat. Here are 2 snippets taken from one of my scripts - the top one shows hh:mm in 5 min increments; the lower a decimal as you require: expandcollapse popup#include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <UpDownConstants.au3> #include <StaticConstants.au3> #include <EditConstants.au3> $hGUI = GUICreate("Test", 500, 500) $cInput_Hour = GUICtrlCreateInput("0", 70, 37, 19, 20) GUICtrlSetState(-1, $GUI_HIDE) Local $cUpDown_Hour = GUICtrlCreateUpdown($cInput_Hour, BitOR($UDS_WRAP, $UDS_ALIGNLEFT)) GUICtrlSetLimit($cUpDown_Hour, 9, 0) $cInput_Min = GUICtrlCreateInput("0", 125, 37, 19, 20) GUICtrlSetState(-1, $GUI_HIDE) Local $cUpDown_Min = GUICtrlCreateUpdown($cInput_Min, $UDS_WRAP) GUICtrlSetLimit($cUpDown_Min, 11, 0) $cHours_Label = GUICtrlCreateLabel("0:00", 90, 38, 30, 18, BitOR($SS_CENTER, $SS_CENTERIMAGE)) $cInput_Dec = GUICtrlCreateInput("0", 70, 137, 19, 20) GUICtrlSetState(-1, $GUI_HIDE) Local $cUpDown_Dec = GUICtrlCreateUpdown($cInput_Dec, BitOR($UDS_WRAP, $UDS_ALIGNLEFT)) $cDec_Label = GUICtrlCreateLabel("0.0", 90, 138, 30, 18, BitOR($SS_CENTER, $SS_CENTERIMAGE)) GUISetState() GUIRegisterMsg($WM_COMMAND, "_WM_COMMAND") While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd Func _WM_COMMAND($hWnd, $iMsg, $wParam, $lParam) #forceref $hWnd, $iMsg, $lParam ; If it was an update message from the inputs If BitShift($wParam, 16) = $EN_CHANGE Then ; Check which it was Switch BitAND($wParam, 0xFFFF) Case $cInput_Hour, $cInput_Min ; Set the label to the new total GUICtrlSetData($cHours_Label, GUICtrlRead($cInput_Hour) & ":" & StringFormat("%02i", 5 * GUICtrlRead($cInput_Min))) Case $cInput_Dec ; Set the label to the formatted value GUICtrlSetData($cDec_Label, StringFormat("%.1f", GUICtrlRead($cInput_Dec) / 10)) EndSwitch EndIf EndFunc ;==>_WM_COMMAND Please ask if anything is unclear. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
babaorom Posted March 5, 2012 Author Share Posted March 5, 2012 Your answer is clear I studied it, I did'nt known this possibility Thanks Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now