Sign in to follow this  
Followers 0
Ahmed97

Question about slider

14 posts in this topic

Hii, Why The Slider max is in down not in the up.

if i want get slider to max .e.g limit max is 100 and min limit is 0

why ? No. 100 is under, and it is not above And the 0 is above not in under ?

Share this post


Link to post
Share on other sites



If you want it to work the other way around, instead of taking the value returned by reading the control, do something like this:

$return = 100 - guictrlread($slider)

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Share this post


Link to post
Share on other sites

can u make an example please ? i dont understand ^^

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

$Form2 = GUICreate("Trans Window", 116, 317, 403, 214)
            $Group22 = GUICtrlCreateGroup("Transperancy", 16, 0, 89, 313)
            $slider = GUICtrlCreateSlider(40, 16, 43, 269, BitOR($TBS_VERT, $TBS_AUTOTICKS, $TBS_BOTH))
            GUICtrlSetLimit(-1, 255, 65)
            GUICtrlSetData(1, 255)
            $Label = GUICtrlCreateLabel("255", 34, 288, 52, 17, $SS_CENTER)
            GUICtrlCreateGroup("", -99, -99, 1, 1)
            GUISetState(@SW_SHOW)


            $Prev = GUICtrlRead($slider)
            While 1
                $Data = 100 - GUICtrlRead($slider);;;;;;;;; Here ;;;;;;;;;;
                If $Data <> $Prev Then
                    GUICtrlSetData($Label, $Data)
                    If $Data < 256 Then
                        WinSetTrans($Directory, "", $Data)
                        If $Data > 65 Then
                            WinSetTrans($Directory, "", $Data)
                            $Prev = $Data
                        EndIf
                    EndIf
                EndIf

                $Msg = GUIGetMsg()
                Switch $Msg
                    Case $GUI_EVENT_CLOSE
                        GUIDelete($Form2)
                        ExitLoop
                EndSwitch
            WEnd

i reaplaced ur code with this ;;

but dont working

$Data = GuiCtrlRead($Slider)
Edited by TheMaster

Share this post


Link to post
Share on other sites

i think OP is asking why the slider is at the bottem rather than the top of the slider. and im not sure how to fix that. you'd have to invert the slider somehow


[spoiler]My UDFs: Login UDF[/spoiler]

Share this post


Link to post
Share on other sites

Try this:

#include <GUIConstantsEx.au3>
#include <SliderConstants.au3>
#include <StaticConstants.au3>
$Form2 = GUICreate("Trans Window", 116, 317, 403, 214)
$Group22 = GUICtrlCreateGroup("Transperancy", 16, 0, 89, 313)
$slider = GUICtrlCreateSlider(40, 16, 43, 269, BitOR($TBS_VERT, $TBS_AUTOTICKS, $TBS_BOTH))
GUICtrlSetLimit(-1, 255, 0)
;~ GUICtrlSetData(1, 255)
$Label = GUICtrlCreateLabel("255", 34, 288, 52, 17, $SS_CENTER)
GUICtrlCreateGroup("", -99, -99, 1, 1)
GUISetState(@SW_SHOW)


$Prev = GUICtrlRead($slider)
While 1
    $Data = 255 - GUICtrlRead($slider);;;;;;;;; Here ;;;;;;;;;;
    If $Data <> $Prev Then
        GUICtrlSetData($Label, $Data)
        If $Data < 256 And $Data > 65 Then
            WinSetTrans($Form2, "", $Data)
;~          If $Data > 65 Then
;~              WinSetTrans($Form2, "", $Data)
                $Prev = $Data
;~          EndIf
        EndIf
    EndIf

    $Msg = GUIGetMsg()
    Switch $Msg
        Case $GUI_EVENT_CLOSE
            GUIDelete($Form2)
            ExitLoop
    EndSwitch
WEnd

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Share this post


Link to post
Share on other sites

Try this:

#include <GUIConstantsEx.au3>
#include <SliderConstants.au3>
#include <StaticConstants.au3>
$Form2 = GUICreate("Trans Window", 116, 317, 403, 214)
$Group22 = GUICtrlCreateGroup("Transperancy", 16, 0, 89, 313)
$slider = GUICtrlCreateSlider(40, 16, 43, 269, BitOR($TBS_VERT, $TBS_AUTOTICKS, $TBS_BOTH))
GUICtrlSetLimit(-1, 255, 0)
;~ GUICtrlSetData(1, 255)
$Label = GUICtrlCreateLabel("255", 34, 288, 52, 17, $SS_CENTER)
GUICtrlCreateGroup("", -99, -99, 1, 1)
GUISetState(@SW_SHOW)


$Prev = GUICtrlRead($slider)
While 1
    $Data = 255 - GUICtrlRead($slider);;;;;;;;; Here ;;;;;;;;;;
    If $Data <> $Prev Then
        GUICtrlSetData($Label, $Data)
        If $Data < 256 And $Data > 65 Then
            WinSetTrans($Form2, "", $Data)
;~          If $Data > 65 Then
;~              WinSetTrans($Form2, "", $Data)
                $Prev = $Data
;~          EndIf
        EndIf
    EndIf

    $Msg = GUIGetMsg()
    Switch $Msg
        Case $GUI_EVENT_CLOSE
            GUIDelete($Form2)
            ExitLoop
    EndSwitch
WEnd

Awesome it's working :huh2: Thnxx

Share this post


Link to post
Share on other sites

i think OP is asking why the slider is at the bottem rather than the top of the slider. and im not sure how to fix that. you'd have to invert the slider somehow

he did it :huh2:

Share this post


Link to post
Share on other sites

#9 ·  Posted (edited)

there's mini problem

#include <GUIConstantsEx.au3>
#include <SliderConstants.au3>
#include <StaticConstants.au3>
$Form2 = GUICreate("Trans Window", 116, 317, 403, 214)
$Group22 = GUICtrlCreateGroup("Transperancy", 16, 0, 89, 313)
$slider = GUICtrlCreateSlider(40, 16, 43, 269, BitOR($TBS_VERT, $TBS_AUTOTICKS, $TBS_BOTH))
GUICtrlSetLimit(-1, 255, 50) ;;;;;;;;;;;; Here ;;;;;;;;;;;

$Label = GUICtrlCreateLabel("255", 34, 288, 52, 17, $SS_CENTER)
GUICtrlCreateGroup("", -99, -99, 1, 1)
GUISetState(@SW_SHOW)


$Prev = GUICtrlRead($slider)
While 1
    $Data = 255 - GUICtrlRead($slider)
    If $Data <> $Prev Then
        GUICtrlSetData($Label, $Data)
        If $Data < 256 And $Data > 0 Then
            WinSetTrans($Form2, "", $Data)

            $Prev = $Data
        EndIf
    EndIf

    $Msg = GUIGetMsg()
    Switch $Msg
        Case $GUI_EVENT_CLOSE
            GUIDelete($Form2)
            ExitLoop
    EndSwitch
WEnd

There ;;;;;

i want set min limit is 50 but it's descrase from the max limit 50

what should i do ?

Edited by TheMaster

Share this post


Link to post
Share on other sites

#10 ·  Posted (edited)

If you see how I set it in my example, I didn't use the limits in GUICtrlSetLimit I adjusted the minimum setting using the If comparison. You'd need to change this line

If $Data < 256 And $Data > 0 Then

To this

If $Data < 256 And $Data > 50 Then

And delete the GUICtrlSetLimit line completely.

EDIT: Just wanted to make it clear that even though the slider value may go under 50, the transparency never will, with that change to the line above.

Edited by BrewManNH

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Share this post


Link to post
Share on other sites

#11 ·  Posted (edited)

ok thnx :huh2: But the problem is in the label... wrong reading from label i think

min is 155, its must be 50 !!

Here's the code

#include <GUIConstantsEx.au3>
#include <SliderConstants.au3>
#include <StaticConstants.au3>
$Form2 = GUICreate("Trans Window", 116, 317, 403, 214)
$Group22 = GUICtrlCreateGroup("Transperancy", 16, 0, 89, 313)
$slider = GUICtrlCreateSlider(40, 16, 43, 269, BitOR($TBS_VERT, $TBS_AUTOTICKS, $TBS_BOTH))


$Label = GUICtrlCreateLabel("255", 34, 288, 52, 17, $SS_CENTER)
GUICtrlCreateGroup("", -99, -99, 1, 1)
GUISetState(@SW_SHOW)


$Prev = GUICtrlRead($slider)
While 1

    $Data = 255 - GUICtrlRead($slider)
    If $Data <> $Prev Then
        GUICtrlSetData($Label, $Data)
        If $Data < 256 And $Data > 50 Then
            WinSetTrans($Form2, "", $Data)

            $Prev = $Data
        EndIf
    EndIf

    $Msg = GUIGetMsg()
    Switch $Msg
        Case $GUI_EVENT_CLOSE
            GUIDelete($Form2)
            ExitLoop
    EndSwitch
WEnd
Edited by TheMaster

Share this post


Link to post
Share on other sites

Sorry about that, I completely mislead you by mistake when I told you to delete the GUICtrlSetLimit line. What needs to be there instead of what you had for the limits is the correct code below. I was reading what you were looking to do incorrectly, and now this should be more towards what you're looking for.

#include <GUIConstantsEx.au3>
#include <SliderConstants.au3>
#include <StaticConstants.au3>
$Form2 = GUICreate("Trans Window", 116, 317, 403, 214)
$Group22 = GUICtrlCreateGroup("Transperancy", 16, 0, 89, 313)
$slider = GUICtrlCreateSlider(40, 16, 43, 269, BitOR($TBS_VERT, $TBS_AUTOTICKS, $TBS_BOTH))
GUICtrlSetLimit(-1, 255, 50)

$Label = GUICtrlCreateLabel("255", 34, 288, 52, 17, $SS_CENTER)
GUICtrlCreateGroup("", -99, -99, 1, 1)
GUISetState(@SW_SHOW)


$Prev = GUICtrlRead($slider)
While 1

    $Data = 305 - GUICtrlRead($slider)
    If $Data <> $Prev Then
        If $Data < 256 Then
            WinSetTrans($Form2, "", $Data)
            GUICtrlSetData($Label, $Data)
            $Prev = $Data
        EndIf
    EndIf
    $Msg = GUIGetMsg()
    Switch $Msg
        Case $GUI_EVENT_CLOSE
            GUIDelete($Form2)
            Exit
    EndSwitch
WEnd

If there's any questions, please feel free to ask.


If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Share this post


Link to post
Share on other sites

Thank you for your trouble with me, it's working 100% :huh2:

Share this post


Link to post
Share on other sites

I'm sorry it took me so many tries to get it right, I can only blame it on being up far too late and trying to write scripts at the same time. :huh2:


If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0