birdofprey Posted March 14, 2007 Posted March 14, 2007 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 !
Helge Posted March 14, 2007 Posted March 14, 2007 GUIGetCursorInfo and some simple math would do it...
Alek Posted March 16, 2007 Posted March 16, 2007 (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 March 16, 2007 by Alek [font="Impact"]Never fear, I is here.[/font]
WeMartiansAreFriendly Posted March 16, 2007 Posted March 16, 2007 (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 March 16, 2007 by mrRevoked Don't bother, It's inside your monitor!------GUISetOnEvent should behave more like HotKeySet()
Alek Posted March 16, 2007 Posted March 16, 2007 (edited) or this expandcollapse popup#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 Edited March 16, 2007 by Alek [font="Impact"]Never fear, I is here.[/font]
WeMartiansAreFriendly Posted March 16, 2007 Posted March 16, 2007 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()
Alek Posted March 16, 2007 Posted March 16, 2007 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]
Helge Posted March 17, 2007 Posted March 17, 2007 ok, there is alot of ways to make a progress bar into a slider some better then other'sJust curious..why use IsPressed when GUIGetCursorInfo gives you all you need need ? Including states for mouse-buttons.
WeMartiansAreFriendly Posted March 17, 2007 Posted March 17, 2007 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()
Helge Posted March 17, 2007 Posted March 17, 2007 (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 March 17, 2007 by Helge
Alek Posted March 17, 2007 Posted March 17, 2007 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 [font="Impact"]Never fear, I is here.[/font]
WeMartiansAreFriendly Posted March 17, 2007 Posted March 17, 2007 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()
birdofprey Posted March 17, 2007 Author Posted March 17, 2007 I can't thank enough all of you. At first sight, this: 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) EndSelectlooks the most appealing to me.
Valuater Posted March 17, 2007 Posted March 17, 2007 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)
birdofprey Posted May 1, 2007 Author Posted May 1, 2007 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
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