Luigi Posted December 2, 2011 Share Posted December 2, 2011 In this script, I can limite the values for $x, it can not be <10 or > 60. Its work fine. The $y, can't be > 60 or < $x, but here is the problem, it can! Some one can help-me? Thanks! #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> Opt('MustDeclareVars', 1) Example() Func Example() Local $x, $y, $UpDownX, $UpDownY, $msg GUICreate("My GUI UpDown", -1, -1, -1, -1, $WS_SIZEBOX) $x = GUICtrlCreateInput(11, 10, 10, 60, 30) $y = GUICtrlCreateInput(11, 10, 50, 60, 30) GUICtrlCreateLabel("x",80,10,20,20) GUICtrlCreateLabel("y",80,50,20,20) $UpDownX = GUICtrlCreateUpdown($x) $UpDownY = GUICtrlCreateUpdown($y) GUISetState() While 1 If GUICtrlRead($x) < 10 Then GuiCtrlSetData($x,10) If GUICtrlRead($x) > 60 Then GuiCtrlSetData($x,60) If GUICtrlRead($y) > 60 Then GuiCtrlSetData($y,60) If GUICtrlRead($y) < GUICtrlRead($x) Then GuiCtrlSetData($y,GUICtrlRead($x)) $msg = GUIGetMsg() If $msg = $GUI_EVENT_CLOSE Then ExitLoop WEnd EndFunc ;==>Example Visit my repository Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted December 2, 2011 Moderators Share Posted December 2, 2011 (edited) detefon,Someone needs to read up on GUICtrlSetLimit! Take a look at this: expandcollapse popup#include <guiconstantsex.au3> #include <windowsconstants.au3> Opt('MustDeclareVars', 1) Example() Func Example() Local $x, $y, $UpDownX, $UpDownY, $msg GUICreate("My GUI UpDown", -1, -1, -1, -1, $WS_SIZEBOX) $x = GUICtrlCreateInput(11, 10, 10, 60, 30) $UpDownX = GUICtrlCreateUpdown($x) GUICtrlSetLimit(-1, 60, 10) $y = GUICtrlCreateInput(11, 10, 50, 60, 30) $UpDownY = GUICtrlCreateUpdown($y) GUICtrlSetLimit(-1, 60, 10) GUICtrlCreateLabel("x", 80, 10, 20, 20) GUICtrlCreateLabel("y", 80, 50, 20, 20) GUISetState() While 1 ; Set the limit for $y depending on $x GUICtrlSetLimit($UpDownY, 60, Number(GUICtrlRead($x))) ; And adjust $y if $x in increased If Number(GUICtrlRead($y)) < Number(GUICtrlRead($x)) Then GUICtrlSetData($y, GUICtrlRead($x)) EndIf $msg = GUIGetMsg() If $msg = $GUI_EVENT_CLOSE Then ExitLoop WEnd EndFunc ;==>ExampleGive me a moment and I will produce a sexy one which does not poll the loop. M23Edit: And here it is: expandcollapse popup#include <guiconstantsex.au3> #include <windowsconstants.au3> #include <editconstants.au3> #include <winapi.au3> Opt('MustDeclareVars', 1) Global $x, $y, $UpDownX, $UpDownY Example() Func Example() Local $msg GUICreate("My GUI UpDown", -1, -1, -1, -1, $WS_SIZEBOX) $x = GUICtrlCreateInput(11, 10, 10, 60, 30) $UpDownX = GUICtrlCreateUpdown($x) GUICtrlSetLimit(-1, 60, 10) $y = GUICtrlCreateInput(11, 10, 50, 60, 30) $UpDownY = GUICtrlCreateUpdown($y) GUICtrlSetLimit(-1, 60, 10) GUICtrlCreateLabel("x", 80, 10, 20, 20) GUICtrlCreateLabel("y", 80, 50, 20, 20) GUISetState() GUIRegisterMsg($WM_COMMAND, "_WM_COMMAND") While 1 $msg = GUIGetMsg() If $msg = $GUI_EVENT_CLOSE Then ExitLoop WEnd EndFunc Func _WM_COMMAND($hWHnd, $iMsg, $wParam, $lParam) If _WinAPI_HiWord($wParam) = $EN_CHANGE And _WinAPI_LoWord($wParam) = $x Then ; Set the limit for $y depending on $x GUICtrlSetLimit($UpDownY, 60, Number(GUICtrlRead($x))) If Number(GUICtrlRead($y)) < Number(GUICtrlRead($x)) Then GUICtrlSetData($y, GUICtrlRead($x)) EndIf EndIf EndFunc ;==>WM_COMMAND Edited December 2, 2011 by Melba23 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...
Luigi Posted December 2, 2011 Author Share Posted December 2, 2011 Ahhhhh Melba... that is not funny!!!!!! I thinking is problem is mega hard dificults (for me was) and you solved it in one reply! 8( One day I have a unsolved topic with more a hundred replys... but, not today! Thanks Melba! ^^ Visit my repository Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted December 2, 2011 Moderators Share Posted December 2, 2011 detefon, Make sure you look at the second script I posted as well. 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...
Luigi Posted December 2, 2011 Author Share Posted December 2, 2011 (edited) Hum.... For example... If I write a main GUI, with many buttons and each button open a child GUI... Like this... The main GUI have: *add user; *add computer; *add phone; and more... more... more... For each button, is opened a child GUI... And for each child GUI I have a logic's validation... If I correct, You write above a way to validate each funcion (child GUI) out the main GUI... Each validation's process run out the main process, and run only when the have a current secondary GUI... It's work? This is great for me, I am here to solve one problem, and gain another solution! I am happy! Irrrrrrrrrrrrrrrrrrrrrrrrrruuuuuuu! ^^ Edited December 2, 2011 by detefon Visit my repository Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted December 2, 2011 Moderators Share Posted December 2, 2011 detefon,It's work?Perhaps. It should work if you use the same variables to store the ControlIDs of the Inputs and UpDowns in each child AND you only have one child open at a time. 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...
Luigi Posted December 2, 2011 Author Share Posted December 2, 2011 Melba! Everything is work fine! But for a new UpDown does not work... I have create a new control, Port, with limts (1024, 65535), and it show crazy values... The limt1s value is very high to GUICtrlSetLimit or is not this? expandcollapse popup#include <guiconstantsex.au3> #include <windowsconstants.au3> #include <editconstants.au3> #include <winapi.au3> Opt('MustDeclareVars', 1) Global $x, $y, $port, $UpDownX, $UpDownY, $UpDownPort Example() Func Example() Local $msg GUICreate("My GUI UpDown", -1, -1, -1, -1, $WS_SIZEBOX) $x = GUICtrlCreateInput(11, 10, 10, 60, 30) $UpDownX = GUICtrlCreateUpdown($x) GUICtrlSetLimit(-1, 60, 10) $y = GUICtrlCreateInput(11, 10, 50, 60, 30) $UpDownY = GUICtrlCreateUpdown($y) GUICtrlSetLimit(-1, 60, 10) GUICtrlCreateLabel("x", 80, 10, 20, 20) GUICtrlCreateLabel("y", 80, 50, 20, 20) GUICtrlCreateLabel("Port", 80, 90, 90, 20) $port = GUICtrlCreateInput(1200, 10, 90, 60, 30) $UpDownPort = GUICtrlCreateUpdown($port) GUICtrlSetLimit(-1, 65535, 1024) GUISetState() GUIRegisterMsg($WM_COMMAND, "_WM_COMMAND") While 1 $msg = GUIGetMsg() If $msg = $GUI_EVENT_CLOSE Then ExitLoop WEnd EndFunc Func _WM_COMMAND($hWHnd, $iMsg, $wParam, $lParam) If _WinAPI_HiWord($wParam) = $EN_CHANGE And _WinAPI_LoWord($wParam) = $x Then ; Set the limit for $y depending on $x GUICtrlSetLimit($UpDownY, 60, Number(GUICtrlRead($x))) If Number(GUICtrlRead($y)) < Number(GUICtrlRead($x)) Then GUICtrlSetData($y, GUICtrlRead($x)) EndIf EndIf EndFunc ;==>WM_COMMAND Visit my repository Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted December 2, 2011 Moderators Share Posted December 2, 2011 detefon,It looks as if the UpDown top limit is (surprise, surprise) 32767 - it is the signed integer limit. You might have to make your own "UpDown" controls. Here is a rough idea of how to do it: expandcollapse popup#include <guiconstantsex.au3> #include <windowsconstants.au3> #include <editconstants.au3> #include <winapi.au3> #include <StaticConstants.au3> #include <Misc.au3> ;Opt('MustDeclareVars', 1) Global $x, $y, $port, $UpDownX, $UpDownY, $UpDownPort Example() Func Example() Local $msg GUICreate("My GUI UpDown", -1, -1, -1, -1, $WS_SIZEBOX) $x = GUICtrlCreateInput(11, 10, 10, 60, 30) $UpDownX = GUICtrlCreateUpdown($x) GUICtrlSetLimit(-1, 60, 10) $y = GUICtrlCreateInput(11, 10, 50, 60, 30) $UpDownY = GUICtrlCreateUpdown($y) GUICtrlSetLimit(-1, 60, 10) GUICtrlCreateLabel("x", 80, 10, 20, 20) GUICtrlCreateLabel("y", 80, 50, 20, 20) GUICtrlCreateLabel("Port", 80, 90, 90, 20) $port = GUICtrlCreateInput(65000, 10, 90, 40, 30) GUICtrlCreateLabel("", 50, 90, 20, 15, $SS_BLACKFRAME) GUICtrlSetState(-1, $GUI_DISABLE) GUICtrlCreateLabel("", 50, 105, 20, 15, $SS_BLACKFRAME) GUICtrlSetState(-1, $GUI_DISABLE) $portup = GUICtrlCreateLabel("U", 51, 91, 18, 13, $SS_CENTER) $portdn = GUICtrlCreateLabel("D", 51, 106, 18, 13, $SS_CENTER) GUISetState() GUIRegisterMsg($WM_COMMAND, "_WM_COMMAND") While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop Case $portup While _IsPressed("01") GUICtrlSetData($port, GUICtrlRead($port) + 1) If Number(GUICtrlRead($port)) > 65535 Then GUICtrlSetData($port, 65535) EndIf Sleep(50) WEnd Case $portdn While _IsPressed("01") GUICtrlSetData($port, GUICtrlRead($port) - 1) If Number(GUICtrlRead($port)) < 1024 Then GUICtrlSetData($port, 1024) EndIf Sleep(50) WEnd EndSwitch WEnd EndFunc ;==>Example Func _WM_COMMAND($hWHnd, $iMsg, $wParam, $lParam) If _WinAPI_HiWord($wParam) = $EN_CHANGE And _WinAPI_LoWord($wParam) = $x Then ; Set the limit for $y depending on $x GUICtrlSetLimit($UpDownY, 60, Number(GUICtrlRead($x))) If Number(GUICtrlRead($y)) < Number(GUICtrlRead($x)) Then GUICtrlSetData($y, GUICtrlRead($x)) EndIf EndIf EndFunc ;==>_WM_COMMANDI know you will ask if you have any questions.... 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...
Luigi Posted December 3, 2011 Author Share Posted December 3, 2011 Thank you Melba! You help me! ^^ Visit my repository 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