Sign in to follow this  
Followers 0
birdofprey

Can I replace Slider with a Progressbar ?

15 posts in this topic

I'm looking for a progressbar that's keen for input from my mouse, but I guess it's all said in the title and description.

If it can't be done natively, maybe I could just draw a transparent something over it and drag that and link the two together, or just keep an eye on the cursor, but that would just add code to my script. If I overlooked a similar topic, links are more than welcome. Thanks !

Share this post


Link to post
Share on other sites



GUIGetCursorInfo and some simple math would do it...

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

like this??

#include <GuiConstants.au3>
#include <Misc.au3>
Opt("MouseCoordMode",0)
GuiCreate("test", 550, 38,-1, -1 , BitOR($WS_OVERLAPPEDWINDOW, $WS_CLIPSIBLINGS))

$Progress_1 = GuiCtrlCreateProgress(10, 10, 530, 20)
GUICtrlSetData($Progress_1,10)
GuiSetState()
While 1
    sliderprobar()
    $msg = GuiGetMsg()
    Select
    Case $msg = $GUI_EVENT_CLOSE
        ExitLoop
    Case Else
        ;;;
    EndSelect
WEnd
Exit

Func sliderprobar()
    $test = _IsPressed("01")
    if $test = 1 then
        $pos = MouseGetPos()
        if $pos[1] > 33 and $pos[1] < 53 then
            $pos = MouseGetPos()
            $num = $pos[0] - 10
            $t = 530/100
            $num = $num/$t
            GUICtrlSetData($Progress_1, $num)
            GUISetState()
        EndIf
    EndIf
EndFunc

there is porberly a easyer way to do this.

Edited by Alek

[font="Impact"]Never fear, I is here.[/font]

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

yeah.. but you could of also did this

#include <GuiConstants.au3>
$gui = GuiCreate("test", 550, 38,-1, -1 , BitOR($WS_OVERLAPPEDWINDOW, $WS_CLIPSIBLINGS))

$Progress_1 = GuiCtrlCreateProgress(10, 10, 530, 20)
GUICtrlSetData($Progress_1,10)
GuiSetState()
While 1
    sliderprobar()
    $msg = GuiGetMsg()
    Select
    Case $msg = $GUI_EVENT_CLOSE
        ExitLoop
    Case Else
        ;;;
    EndSelect
WEnd
Exit


Func sliderprobar()
    $pos = GUIGetCursorInfo ($gui)
    $cpos = ControlGetPos ($gui, "",  $Progress_1)
    If $pos[2] = 1 And $pos[4] = $Progress_1 then
        $num = $pos[0] - 10
        $t = $cpos[2]/100
        $num = $num/$t
        GUICtrlSetData($Progress_1, $num)
        GUISetState()
    EndIf
EndFunc
Edited by mrRevoked

Don't bother, It's inside your monitor!------GUISetOnEvent should behave more like HotKeySet()

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

or this

#include <GuiConstants.au3>
#include <Misc.au3>
$IDC = 0
Opt("MouseCoordMode",0)
GuiCreate("test", 550, 38,-1, -1 , BitOR($WS_OVERLAPPEDWINDOW, $WS_CLIPSIBLINGS))

$Progress_1 = GuiCtrlCreateProgress(10, 10, 530, 20)
GUICtrlSetData($Progress_1,10)
GuiSetState()
While 1
    sliderprobar()
    $msg = GuiGetMsg()
    Select
    Case $msg = $GUI_EVENT_CLOSE
        ExitLoop
    Case Else
        ;;;
    EndSelect
WEnd
Exit

Func sliderprobar()
    $a=GUIGetCursorInfo()
    if $a[4] = 3 and _IsPressed("01") then
        $t = 530/100
        guictrlsetdata($Progress_1, $a[0]/$t-1)
    EndIf
EndFunc
 oÝ÷ ÚÚºÚ"µÍÚ[ÛYH ÑÝZPÛÛÝ[Ë]LÉÝÂÌÍÙÝZHHÝZPÜX]J ][ÝÝÝ    ][ÝË
MLÎLKLH]Ô ÌÍÕÔ×ÓÕTTQÒSÕË    ÌÍÕÔ×ÐÓTÒPSÔÊJBÌÍÔÙÜÜ×ÌHHÝZPÝÜX]TÙÜÜÊLL
LÌ
BÕRPÝÙ]]J    ÌÍÔÙÜÜ×ÌKL
BÝZTÙ]Ý]J
BÚ[HBÛYØ
B   ÌÍÛÙÈHÝZQÙ]ÙÊ
BÙ[XÝØÙH    ÌÍÛÙÈH ÌÍÑÕRWÑUSÐÓÔÑB^]ÛÜØÙH[ÙBÎÎÂ[Ù[XÝÑ[^][ÈÛYØ
B   ÌÍØOQÕRQÙ]ÝÛÜ[Ê
BIÌÍØÜÜÈHÛÛÛÙ]ÜÊ    ÌÍÙÝZK  ][ÝÉ][ÝË    ÌÍÔÙÜÜ×ÌJBZY    ÌÍØVÍHHÈ[ÒÔÜÙY
    ][ÝÌI][ÝÊH[BIÌÍÝH    ÌÍØÜÜÖÌKÌLBYÝZXÝÙ]]J ÌÍÔÙÜÜ×ÌK   ÌÍØVÌKÉÌÍÝLJBQ[Y[[Â

Battle of the geeks :whistle:

Edited by Alek

[font="Impact"]Never fear, I is here.[/font]

Share this post


Link to post
Share on other sites

not to be out done, hah!

#include <GuiConstants.au3>
GuiCreate("test", 550, 38,-1, -1 , BitOR($WS_OVERLAPPEDWINDOW, $WS_CLIPSIBLINGS))
$Progress_1 = GuiCtrlCreateProgress(10, 10, 530, 20)
GUICtrlSetData($Progress_1,10)
GuiSetState()
While 1
    $msg = GuiGetMsg()
    Select
    Case $msg = $GUI_EVENT_CLOSE
        ExitLoop
        
        
    Case Else
        $a = GUIGetCursorInfo()
        $cpos = ControlGetPos ('', '',  $Progress_1)
        If $a[4] = $Progress_1 and $a[2] = 1 then GuiCtrlSetdata($Progress_1, ($a[0] / ($cpos[2] /100)) -1)
    EndSelect
WEnd
Exit

Don't bother, It's inside your monitor!------GUISetOnEvent should behave more like HotKeySet()

Share this post


Link to post
Share on other sites

ok, there is alot of ways to make a progress bar into a slider some better then other's


[font="Impact"]Never fear, I is here.[/font]

Share this post


Link to post
Share on other sites

ok, there is alot of ways to make a progress bar into a slider some better then other's

Just curious..why use IsPressed when GUIGetCursorInfo gives you all you need need ? Including states for mouse-buttons.

Share this post


Link to post
Share on other sites

Just curious..why use IsPressed when GUIGetCursorInfo gives you all you need need ? Including states for mouse-buttons.

more flexiblity?


Don't bother, It's inside your monitor!------GUISetOnEvent should behave more like HotKeySet()

Share this post


Link to post
Share on other sites

#10 ·  Posted (edited)

more flexiblity?

Wah ? I'm extra tired on Fridays so please explain what you mean, as I don't understand it at all....

Where is more flexibility needed in this case ?

Edit : And most importantly..how does it add more flexibility ?

Edited by Helge

Share this post


Link to post
Share on other sites

Just curious..why use IsPressed when GUIGetCursorInfo gives you all you need need ? Including states for mouse-buttons.

I always do things more complicated then needed :whistle:


[font="Impact"]Never fear, I is here.[/font]

Share this post


Link to post
Share on other sites

Wah ? I'm extra tired on Fridays so please explain what you mean, as I don't understand it at all....

Where is more flexibility needed in this case ?

probably not needed, but i would of modified to also use it for the left, right controls, (keyboard) ect but thats just me.


Don't bother, It's inside your monitor!------GUISetOnEvent should behave more like HotKeySet()

Share this post


Link to post
Share on other sites

not to be out done, hah!

#include <GuiConstants.au3>
GuiCreate("test", 550, 38,-1, -1 , BitOR($WS_OVERLAPPEDWINDOW, $WS_CLIPSIBLINGS))
$Progress_1 = GuiCtrlCreateProgress(10, 10, 530, 20)
GUICtrlSetData($Progress_1,10)
GuiSetState()
While 1
    $msg = GuiGetMsg()
    Select
    Case $msg = $GUI_EVENT_CLOSE
        ExitLoop
        
        
    Case Else
        $a = GUIGetCursorInfo()
        $cpos = ControlGetPos ('', '',  $Progress_1)
        If $a[4] = $Progress_1 and $a[2] = 1 then GuiCtrlSetdata($Progress_1, ($a[0] / ($cpos[2] /100)) -1)
    EndSelect
WEnd
Exit

Nice competition... and good job Revoked

8)


NEWHeader1.png

Share this post


Link to post
Share on other sites

#15 ·  Posted

I wanted a vertical progress too. I had to modify the code a bit more than I expected. Actually I overdid that part. But if you need the code, or an example, you might want to click Here

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