isolation Posted January 28, 2009 Share Posted January 28, 2009 Hi thereI've a BIG problem:I have to create an indipendent scrollbar(it musn't be attached with a control or with the gui)I created 3 pic controls and I used GuiRegisterMsghttp://img440.imageshack.us/img440/5817/scrolleb0.th.pngthe 2 buttons(up and down) works... they move the scroll...The problem is ... how can I move the scroll with the mouse and get/set its position? Link to comment Share on other sites More sharing options...
Valuater Posted January 28, 2009 Share Posted January 28, 2009 Welcome to the Forums isolation. That is not a great first post. We can help. but we don't like to guess and.. we don't read minds ( Well, I can't ) you need to post code for us to see the direction and make reasonable efforts to assist you 8) Link to comment Share on other sites More sharing options...
isolation Posted January 29, 2009 Author Share Posted January 29, 2009 (edited) Sorry This is my code: expandcollapse popup#include <GUIConstantsEx.au3> #include <WindowsConstants.au3> HotKeySet("{Esc}", "Esc") Opt("GUICoordMode",1) Opt("GUIOnEventMode",1) Global $scroll[2] Global $edown,$eup,$ecl=0 global $enum=7 Global $E_gui=GUICreate("Scrollabr",400,300,200,300) createdw() createup() createscr() GUISetState() GUIRegisterMsg($WM_COMMAND ,"MY_WM_COMMAND") while 1 WEnd Func esc() Exit EndFunc Func createup() $up=guictrlcreatepic("scrollu.bmp",200,25,16,16) Assign("eup",$up) EndFunc Func createdw() $dw=guictrlcreatepic("scrolld.bmp",200,270,16,16) Assign("edown",$dw) EndFunc Func deletescr() GUICtrlDelete($scroll[0]) $scroll[0]=0 $scroll[0]=0 EndFunc Func createscr() $dw=guictrlcreatepic("scroll.bmp",200,41,16,(229*2)/$enum) Dim $h[2] $h[0]=$dw $h[1]=0 Assign("scroll",$h) EndFunc Func updater($msg="") Select case $msg="d" if $enum <=1 then return 0 if $ecl=$enum-2 then return 0 $ecl=$ecl+1 $cicon=10 $r=229-(229*2/$enum) $e=($r/($enum-2)) GUICtrlSetPos($scroll[0],200,($e*$ecl)+41,16,(229*2)/$enum) $scroll[1]=$e case $msg="u" if $ecl=0 then return 0 $ecl=$ecl-1 $r=229-(229*2/$enum) $e=($r/($enum-2)) GUICtrlSetPos($scroll[0],200,($e*$ecl)+41,16,(229*2)/$enum) $scroll[1]=$e $cicon=10 EndSelect EndFunc Func MY_WM_COMMAND($hWnd, $Msg, $wParam, $lParam) $nNotifyCode = BitShift($wParam, 16) $nID = BitAnd($wParam, 0x0000FFFF) $hCtrl = $lParam If $nID <> 2 And $nNotifyCode = 0 Then If $nID = 1 Then $hFocus = DllCall("user32.dll", "hwnd", "GetFocus") $nCtrlID = DllCall("user32.dll", "int", "GetDlgCtrlID", "hwnd", $hFocus[0]) PostButtonclick($hFocus[0], $nCtrlID[0]) Else if $nID=$edown then updater("d") if $nID=$eup then updater("u") EndIf Return 0 EndIf Return $GUI_RUNDEFMSG EndFunc Func PostButtonclick($hWnd, $nCtrlID) DllCall("user32.dll", "int", "PostMessage", _ "hwnd", $E_gui, _ "int", $WM_COMMAND, _ "int", BitAnd($nCtrlID, 0x0000FFFF), _ "hwnd", GUICtrlGetHandle($nCtrlid)) EndFunc I use pics for the scollbar up and down but I want to move the scrollbar, too Please, help mescroll.rar Edited January 29, 2009 by isolation Link to comment Share on other sites More sharing options...
isolation Posted January 29, 2009 Author Share Posted January 29, 2009 Should I use WM_LBUTTONDOWN and WM_LBUTTONUP for registering mouse up and down? 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