JohnnyVolcom5 Posted November 5, 2013 Share Posted November 5, 2013 Hello All, Im having troubles getting an UpDown Ctrl to function the way i want it to. Here is the code. $Gui = GUICreate ("",150,150) $MaxLS = GUICtrlCreateInput ("410.0",40,10,70,-1,$ES_RIGHT) $Level = GUICtrlCreateUpdown ($MaxLS) GUICtrlSetLimit ($Level,510.0,200.0) So I want the Input to initially read "410.0" and when i press the up or down arrow i would like the input to increase by "1.0" (so clicking the up arrow 10 times would make the input read "420.0") Right now when i click the up arrow, the input changes to "200" and then goes up by 1. I think im missing something somewhere, or im just not getting how the up down works...... Any help is greatly appreciated. Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted November 5, 2013 Moderators Share Posted November 5, 2013 JohnnyVolcom5,It is the decimal point and place that is confusing the UpDown - it reads the initially set value as invalid and so starts at the set minimum value. As you want it to increase by a full unit each time, is the decimal display really necessary? If it is required then we need to do a bit of trickery. 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...
JohnnyVolcom5 Posted November 5, 2013 Author Share Posted November 5, 2013 JohnnyVolcom5, It is the decimal point and place that is confusing the UpDown - it reads the initially set value as invalid and so starts at the set minimum value. As you want it to increase by a full unit each time, is the decimal display really necessary? If it is required then we need to do a bit of trickery. M23 Hi M23, It isnt required on this particular input box (would like to leave the decimal if its not too difficult) , but i will be creating two more input boxes with UpDowns that will be in the range of 0.10 - 0.90. (those i would like to increase by 0.10) Thanks for the quick response! Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted November 5, 2013 Moderators Share Posted November 5, 2013 JohnnyVolcom,Then we need to do the trickery! Give me a while to knock up an example for you - it is not an easy thing to do. M23 JohnnyVolcom5 1 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...
JohnnyVolcom5 Posted November 5, 2013 Author Share Posted November 5, 2013 JohnnyVolcom, Then we need to do the trickery! Give me a while to knock up an example for you - it is not an easy thing to do. M23 Ok. Thanks Melba! Link to comment Share on other sites More sharing options...
mikell Posted November 5, 2013 Share Posted November 5, 2013 Sorry Melba for interfering $Gui = GUICreate ("",150,150) $MaxLS = GUICtrlCreateInput("",110,10,1,20) $Level = GUICtrlCreateUpdown ($MaxLS) GUICtrlSetLimit($Level,100,-210) $display = GUICtrlCreateInput ("410.0",40,10,55,20) GuiSetState() while 1 $msg = GuiGetMsg() If $msg = -3 Then Exit If $msg = $Level Then GuiCtrlSetData($display, StringFormat("%.01f", GuiCtrlRead($MaxLS)+410)) wend JohnnyVolcom5 1 Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted November 5, 2013 Moderators Share Posted November 5, 2013 (edited) JohnnyVolcom,Easier than I remembered: expandcollapse popup#include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <MsgBoxConstants.au3> #include <StaticConstants.au3> #include <EditConstants.au3> $hGUI = GUICreate("Test", 500, 500) GUISetBkColor(0xC4C4C4) $cDummy_Input = GUICtrlCreateLabel("410.0 ", 40, 10, 50, 20, BitOr($SS_RIGHT, $SS_CENTERIMAGE)) GUICtrlSetBkColor($cDummy_Input, 0xFFFFFF) $MaxLS = GUICtrlCreateInput("410", 90, 10, 20, 20) $Level = GUICtrlCreateUpdown($MaxLS) GUICtrlSetLimit($Level, 510, 200) 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 input If BitShift($wParam, 16) = $EN_CHANGE Then Switch BitAND($wParam, 0xFFFF) Case $MaxLS ; Set the label to the new total GUICtrlSetData($cDummy_Input, GUICtrlRead($MaxLS) & ".0 ") EndSwitch EndIf EndFunc ;==>_WM_COMMANDI hope everything is clear, but please ask if not. M23Edit:mikell,Never a problem to offer a solution - and yours is much simpler. Edited November 5, 2013 by Melba23 JohnnyVolcom5 1 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...
mikell Posted November 5, 2013 Share Posted November 5, 2013 (edited) BTW ... Gui = GUICreate ("",150,150) $MaxLS = GUICtrlCreateInput("0",110,10,1,20) $Level = GUICtrlCreateUpdown ($MaxLS) GUICtrlSetLimit($Level,4,-4) $display = GUICtrlCreateInput ("0.50",40,10,55,20) GuiSetState() while 1 $msg = GuiGetMsg() If $msg = -3 Then Exit If $msg = $Level Then GuiCtrlSetData($display, StringFormat("%.02f", GuiCtrlRead($MaxLS)/10+0.5)) wend Edited November 5, 2013 by mikell Link to comment Share on other sites More sharing options...
JohnnyVolcom5 Posted November 5, 2013 Author Share Posted November 5, 2013 (edited) Sorry Melba for interfering $Gui = GUICreate ("",150,150) $MaxLS = GUICtrlCreateInput("",110,10,1,20) $Level = GUICtrlCreateUpdown ($MaxLS) GUICtrlSetLimit($Level,100,-210) $display = GUICtrlCreateInput ("410.0",40,10,55,20) GuiSetState() while 1 $msg = GuiGetMsg() If $msg = -3 Then Exit If $msg = $Level Then GuiCtrlSetData($display, StringFormat("%.01f", GuiCtrlRead($MaxLS)+410)) wend Thanks Mikell! This one is a little easier for me to understand. JohnnyVolcom, Easier than I remembered: expandcollapse popup#include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <MsgBoxConstants.au3> #include <StaticConstants.au3> #include <EditConstants.au3> $hGUI = GUICreate("Test", 500, 500) GUISetBkColor(0xC4C4C4) $cDummy_Input = GUICtrlCreateLabel("410.0 ", 40, 10, 50, 20, BitOr($SS_RIGHT, $SS_CENTERIMAGE)) GUICtrlSetBkColor($cDummy_Input, 0xFFFFFF) $MaxLS = GUICtrlCreateInput("410", 90, 10, 20, 20) $Level = GUICtrlCreateUpdown($MaxLS) GUICtrlSetLimit($Level, 510, 200) 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 input If BitShift($wParam, 16) = $EN_CHANGE Then Switch BitAND($wParam, 0xFFFF) Case $MaxLS ; Set the label to the new total GUICtrlSetData($cDummy_Input, GUICtrlRead($MaxLS) & ".0 ") EndSwitch EndIf EndFunc ;==>_WM_COMMAND I hope everything is clear, but please ask if not. M23 Edit: mikell, Never a problem to offer a solution - and yours is much simpler. Thanks again Melba! I think most of it is pretty clear. I will play around with both examples. If i come across anymore problems i will report back. Thanks Again Melba and Mikell! Edit: Thanks for the help on the other input boxes Mikell! Edited November 5, 2013 by JohnnyVolcom5 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