Jump to content

_GUICtrlSlider_Create


ohgod
 Share

Recommended Posts

_GUICtrlSlider_Create($hWnd, $iX, $iY[, $iWidth = 100[, $iHeight = 20[, $iStyle = 0x0001[, $iExStyle = 0x00000000]]]])

Can't figure out what are these for:

$TBS_REVERSED - Smaller number indicates "higher" and a larger number indicates "lower"

$TBS_DOWNISLEFT - Down equal left and up equal right

All I want to see is a vertical slider with 0 for the bottom and 100 at the top (the default has 0 on the top 100 at the bottom) with a realtime tooltip, and all thin in oneventmode.

I was able to reverse the slide with negative values but can't adjust the tooltip according to that (it shows the negative values).

WM_NOTIFY escapes me.

Link to comment
Share on other sites

Hope this helps.

#include <GuiConstants.au3>

;Global Const $WM_HSCROLL = 0x0114
;Global Const $WM_VSCROLL = 0x0115

$Gui = GuiCreate("Slider Update Demo", 250, 200)

GUIRegisterMsg($WM_HSCROLL, "WM_HVSCROLL")
GUIRegisterMsg($WM_VSCROLL, "WM_HVSCROLL")

$Vertical_Label = GUICtrlCreateLabel("Vertical Slider Read: 0", 20, 20, 200)
$Horizontal_Label = GUICtrlCreateLabel("Horizontal Slider Read: 0", 80, 120, 200)

$Vertical_Slider = GUICtrlCreateSlider(20, 50, 30, 120,BitOr($GUI_SS_DEFAULT_SLIDER, $TBS_VERT))
GUICtrlSetData($Vertical_Slider,100)
$Horizontal_Slider = GUICtrlCreateSlider(60, 150, 160, 30)

GUISetState()

While 1
    $Msg = GUIGetMsg()
    Switch $Msg
        Case -3
            Exit
    EndSwitch
WEnd

Func WM_HVSCROLL($hWndGUI, $MsgID, $WParam, $LParam)
    Switch $LParam
        Case GUICtrlGetHandle($Vertical_Slider)
            $Vertical_val=100-GUICtrlRead($Vertical_Slider)
            ConsoleWrite($Vertical_val&@LF)
            GUICtrlSetData($Vertical_Label, "Vertical Slider Read: " & $Vertical_val)
            
        Case GUICtrlGetHandle($Horizontal_Slider)
            GUICtrlSetData($Horizontal_Label, "Horizontal Slider Read: " & GUICtrlRead($Horizontal_Slider))
            
    EndSwitch
EndFunc
Edited by Aceguy
Link to comment
Share on other sites

  • 4 months later...

When I try to run the script, I get that undeclared variable error* for $GUI_SS_DEFAULT_SLIDER in line 17. I think I'm probably missing something here, but I definitely don't see it declared in the script either...

*(Error: Variable used without being declared.)

Christianity: In the beginning, there was God, who always was there and created everything.Atheism: In the beginning, there was nothing, which exploded. Both sides look bad...

Link to comment
Share on other sites

When I try to run the script, I get that undeclared variable error* for $GUI_SS_DEFAULT_SLIDER in line 17. I think I'm probably missing something here, but I definitely don't see it declared in the script either...

*(Error: Variable used without being declared.)

You may need to add one or all of these.

#include <GUIConstantsEX.au3>
#include <WindowsConstants.au3>
#include <StaticConstants.au3>
Link to comment
Share on other sites

Hmm, no I copied them all in exactly as they were on here and I get the same error...

Christianity: In the beginning, there was God, who always was there and created everything.Atheism: In the beginning, there was nothing, which exploded. Both sides look bad...

Link to comment
Share on other sites

He didn't mean you may, he meant you will need those includeds for the script to work.

So using the above code that Aceguy posted, add the following to the top. Should then work.

#include <GUIConstantsEX.au3>
#include <WindowsConstants.au3>
#include <SliderConstants.au3>

Cheers

Brett

Quick Edit- Remove the existing include.

Edited by BrettF
Link to comment
Share on other sites

yes, I've done that, I'm still trying to run the code with those in it and I get the same error message

Christianity: In the beginning, there was God, who always was there and created everything.Atheism: In the beginning, there was nothing, which exploded. Both sides look bad...

Link to comment
Share on other sites

yes, I've done that, I'm still trying to run the code with those in it and I get the same error message

You must bo doing something really stupid in that case because the variable is in SliderConstants.au3 exactly as Brett stated. Open SciTe and go to "search>find in files" and search your includes directory and see for yourself. ;)

And btw why did't you do that in the beginning? That would have taken far less time than to post at the forum.... :D

Link to comment
Share on other sites

Got it, thanks. And... I didn't use it before because I didn't even know I could. I'm a little green at this. Thanks

Christianity: In the beginning, there was God, who always was there and created everything.Atheism: In the beginning, there was nothing, which exploded. Both sides look bad...

Link to comment
Share on other sites

Got it, thanks. And... I didn't use it before because I didn't even know I could. I'm a little green at this. Thanks

No worries mate, you will learn this kind of stuff over time..... hopefully ;)
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...