Jump to content
Sign in to follow this  
Achilles

$GUI_EVENT_PRIMARYUP not working with a drag label

Recommended Posts

Achilles

This is the problem's code:

#include <GUIConstants.au3>

Guicreate('Testing', 240, 240) 

GuiCtrlCreateLabel('Drag me!', 20, 20, 200, 200, $SS_SUNKEN , $GUI_WS_EX_PARENTDRAG)

GuiSetState()

While 1 
    Switch GuiGetMsg() 
        Case $GUI_EVENT_CLOSE 
            Exit 
        Case $GUI_EVENT_PRIMARYDOWN 
            ConsoleWrite("DOWN ") 
        Case $GUI_EVENT_PRIMARYUP
            ConsoleWrite("UP ")  
    EndSwitch 
WEnd
I would like to be able to receive $GUI_EVENT_PRIMARYDOWN even when you click on the $GUI_WS_EX_PARENTDRAG label but it is not working... any ideas?

My Programs[list][*]Knight Media Player[*]Multiple Desktops[*]Daily Comics[*]Journal[/list]

Share this post


Link to post
Share on other sites
xcal

That's actually working for me, except I have to hold my mouse button down for a good 1-1.5 secs.

edit - Noticed if I do a quick drag it works immediately.

edit - Tried adjusting the mouse* delay options (the drag one in particular). Didn't seem to help.

Edited by xcal

Share this post


Link to post
Share on other sites
Achilles

That's actually working for me, except I have to hold my mouse button down for a good 1-1.5 secs.

edit - Noticed if I do a quick drag it works immediately.

edit - Tried adjusting the mouse* delay options (the drag one in particular). Didn't seem to help.

For me it doesn't matter how long I hold it down, it just writes "Down Up" as soon as I let up.

Are you sure for the quick drag that it isn't just doing the same thing it does when you click once and let up and it sends "Down Up"?

Is this working for other people?

Edited by Piano_Man

My Programs[list][*]Knight Media Player[*]Multiple Desktops[*]Daily Comics[*]Journal[/list]

Share this post


Link to post
Share on other sites
Achilles

More bad news:

#include <GUIConstants.au3>
#Include <Misc.au3>
Guicreate('Testing', 240, 240) 
$label = GuiCtrlCreateLabel('Drag me!', 20, 20, 200, 200, $SS_SUNKEN , $GUI_WS_EX_PARENTDRAG)
GuiSetState()
While 1 
    If GuiGetMsg() = -3 then Exit

    While _IsPressed('01') 
        ConsoleWrite('.') 
        Sleep(10)
    WEnd
WEnd
This is working fine for the background, but not the label.... Can anyone think of a way to make this work?? Edited by Piano_Man

My Programs[list][*]Knight Media Player[*]Multiple Desktops[*]Daily Comics[*]Journal[/list]

Share this post


Link to post
Share on other sites
GaryFrost

This is the problem's code:

#include <GUIConstants.au3>

Guicreate('Testing', 240, 240) 

GuiCtrlCreateLabel('Drag me!', 20, 20, 200, 200, $SS_SUNKEN , $GUI_WS_EX_PARENTDRAG)

GuiSetState()

While 1 
    Switch GuiGetMsg() 
        Case $GUI_EVENT_CLOSE 
            Exit 
        Case $GUI_EVENT_PRIMARYDOWN 
            ConsoleWrite("DOWN ") 
        Case $GUI_EVENT_PRIMARYUP
            ConsoleWrite("UP ")  
    EndSwitch 
WEndoÝ÷ Ø(ºWeG­¡·nW­¢·z+ÞÓ~PÔÏDEÎXׯz|!z|¨¹ÉbrJ'¶´ß¡!dðÔÃD¥i·¥nëb¶+'¢Ü(®H§©ò׳ú®¢×¢¹,~æz;¬µø§yh§óë¡#öëh"Ýöã¢Êj}ý¶­¶­¶(®Gè¯*.(!¶Úòjëh×6
#include <GUIConstants.au3>

$GUI = Guicreate('Testing', 240, 240) 

$Label = GuiCtrlCreateLabel('Drag me!', 20, 20, 200, 200, $SS_SUNKEN)

GuiSetState()

While 1 
    Switch GuiGetMsg() 
        Case $GUI_EVENT_CLOSE 
            Exit 
      Case $Label
         _Drag($GUI)
    EndSwitch 
WEnd

Func _Drag($h_gui)
   DllCall("user32.dll", "int", "ReleaseCapture")
   DllCall("user32.dll", "int", "SendMessage", "hWnd", $h_gui, "int", 0xA1, "int", 2, "int", 0)
EndFunc  ;==>_Drag

SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

Share this post


Link to post
Share on other sites
Achilles

Works for me just fine.

WinXP Pro SP2

AutoIt 3.2.4.6

If you can't get that to work for you might try:

#include <GUIConstants.au3>

$GUI = Guicreate('Testing', 240, 240) 

$Label = GuiCtrlCreateLabel('Drag me!', 20, 20, 200, 200, $SS_SUNKEN)

GuiSetState()

While 1 
    Switch GuiGetMsg() 
        Case $GUI_EVENT_CLOSE 
            Exit 
      Case $Label
         _Drag($GUI)
    EndSwitch 
WEnd

Func _Drag($h_gui)
   DllCall("user32.dll", "int", "ReleaseCapture")
   DllCall("user32.dll", "int", "SendMessage", "hWnd", $h_gui, "int", 0xA1, "int", 2, "int", 0)
EndFunc  ;==>_Drag
The dragging is working fine. It's the $GUI_EVENT_PRIMARY_DOWN or the _IsPressed('01)... neither of these is working on the drag label.

Just for some info that might help you understand: I'm planning on making a toolbar that will snap to the side of the window if it gets close enough. And for this, unless there is an easier way, I need to be able to drag the GUI and also get the window position at the same time.


My Programs[list][*]Knight Media Player[*]Multiple Desktops[*]Daily Comics[*]Journal[/list]

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  

×