lilx Posted March 16, 2009 Share Posted March 16, 2009 hello, i am working on a slider to work with a input control. now what i want is that the digit insert into input control the slider reacts to it. now i have come to the following problem. my slider has a limit from 25 to 255, now i wanted to add a check control in my source so when to value insert in the input is smaller then 25 or greater then 255 it brings the number back to the minimum or maximum now because the returned value of guictrlread on a input is a string value I can't work with greater of less then. Can someone help with this problem? Or what is the best solution to this. Thank you in advance, lilx Link to comment Share on other sites More sharing options...
Robjong Posted March 16, 2009 Share Posted March 16, 2009 (edited) int() ? If Int($iSlider) >= 25 And Int($iSlider) <= 255 Then Edited March 16, 2009 by Robjong Link to comment Share on other sites More sharing options...
lilx Posted March 16, 2009 Author Share Posted March 16, 2009 int() ? If Int($iSlider) >= 25 And Int($iSlider) <= 255 Then thx for the response will look at it now Link to comment Share on other sites More sharing options...
lilx Posted March 16, 2009 Author Share Posted March 16, 2009 i am not really having luck with it, i hope you guys can look at it a maybe a new pair of eyes can see the problem, expandcollapse popup#Include <Constants.au3> #include <GUIConstantsEx.au3> #include <EditConstants.au3> Local $Slider, $button, $msg, $input, $trans = 255, $dummy, $dummy1 GUICreate("Change Trans", 220, 115, 100, 200) $text1 = GUICtrlCreateLabel ( "Transparent", 1, 5, 60, 20 ) $text2 = GUICtrlCreateLabel ( "Solid", 190, 5, 30, 20 ) $Slider = GUICtrlCreateSlider(10, 20, 200, 30) GUICtrlSetLimit(-1, 255, 25) ; min/max value $text = GUICtrlCreateLabel ( "New transparency level", 25, 65, 135, 20 ) $input = GUICtrlCreateInput($trans, 165, 60, 30, 20, $ES_NUMBER) $button = GUICtrlCreateButton("Apply new transparency", 45, 90, 125, 20) GUISetState() GUICtrlSetData($Slider, $trans) While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE Exit Case $msg = $button GUICtrlSetData ($Slider, $input) $trans = GUICtrlRead ( $Slider ) MsgBox ( 48, "box", $trans ) Case $msg = $Slider $dummy = GUICtrlRead ( $Slider ) GUICtrlSetData ($input, $dummy) WinSetTrans ( "Change Trans", "", $dummy ) Case $msg = $input $dummy1 = GUICtrlRead ($input) If Int($dummy1) > 255 Then GUICtrlSetData ( $input, "255" ) ElseIf Int($dummy1) < 25 Then GUICtrlSetData ( $input, "25" ) EndIf MsgBox ( 48, "Dummy1", $dummy1 ) GUICtrlSetData ($Slider, Int($input)) EndSelect WEnd it's not the cleanest code but it works so far only now having much trouble with combining the input with the slider. Link to comment Share on other sites More sharing options...
Mat Posted March 16, 2009 Share Posted March 16, 2009 If $Input > 255 Then GUICtrlSetData ($Slider, "255") GUICtrlSetData ($Input, "255" ElseIf $Input < 25 Then GUICtrlSetData ($Slider, "25") GUICtrlSetData ($Input, "25" Else GUICtrlSetData ($Slider, $Input) EndIf Probably not the most efficient method, but it should work. MDiesel AutoIt Project Listing Link to comment Share on other sites More sharing options...
martin Posted March 16, 2009 Share Posted March 16, 2009 i am not really having luck with it, i hope you guys can look at it a maybe a new pair of eyes can see the problem, expandcollapse popup#Include <Constants.au3> #include <GUIConstantsEx.au3> #include <EditConstants.au3> Local $Slider, $button, $msg, $input, $trans = 255, $dummy, $dummy1 GUICreate("Change Trans", 220, 115, 100, 200) $text1 = GUICtrlCreateLabel ( "Transparent", 1, 5, 60, 20 ) $text2 = GUICtrlCreateLabel ( "Solid", 190, 5, 30, 20 ) $Slider = GUICtrlCreateSlider(10, 20, 200, 30) GUICtrlSetLimit(-1, 255, 25); min/max value $text = GUICtrlCreateLabel ( "New transparency level", 25, 65, 135, 20 ) $input = GUICtrlCreateInput($trans, 165, 60, 30, 20, $ES_NUMBER) $button = GUICtrlCreateButton("Apply new transparency", 45, 90, 125, 20) GUISetState() GUICtrlSetData($Slider, $trans) While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE Exit Case $msg = $button GUICtrlSetData ($Slider, $input) $trans = GUICtrlRead ( $Slider ) MsgBox ( 48, "box", $trans ) Case $msg = $Slider $dummy = GUICtrlRead ( $Slider ) GUICtrlSetData ($input, $dummy) WinSetTrans ( "Change Trans", "", $dummy ) Case $msg = $input $dummy1 = GUICtrlRead ($input) If Int($dummy1) > 255 Then GUICtrlSetData ( $input, "255" ) ElseIf Int($dummy1) < 25 Then GUICtrlSetData ( $input, "25" ) EndIf MsgBox ( 48, "Dummy1", $dummy1 ) GUICtrlSetData ($Slider, Int($input)) EndSelect WEnd it's not the cleanest code but it works so far only now having much trouble with combining the input with the slider.Would probably work if you had this GUICtrlSetData ($Slider, Int(GUICtrlRead($input))) instead of GUICtrlSetData ($Slider, Int($input)) Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script. Link to comment Share on other sites More sharing options...
lilx Posted March 16, 2009 Author Share Posted March 16, 2009 If $Input > 255 Then GUICtrlSetData ($Slider, "255") GUICtrlSetData ($Input, "255" ElseIf $Input < 25 Then GUICtrlSetData ($Slider, "25") GUICtrlSetData ($Input, "25" Else GUICtrlSetData ($Slider, $Input) EndIf Probably not the most efficient method, but it should work. MDiesel well the main problem is.. that input give a value as a string so you can't use > or < because it will always give a negative value, so this didn't work Link to comment Share on other sites More sharing options...
lilx Posted March 16, 2009 Author Share Posted March 16, 2009 @ martin, sorry didn't refresh window x ), but the probleem was indeed in what you said GUICtrlSetData ($Slider, Int(GUICtrlRead($input))) and got it working now 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