Jump to content
Sign in to follow this  
FrashMX

Dragging window

Recommended Posts

FrashMX

Hola,

Is it possible to make a part of a window w/o titlebar (or at least an alternative titlebar by using images) draggable, so you can drag it over the screen by clicking the "virtual" titlebar?

Thanks in advance!

Share this post


Link to post
Share on other sites
FrashMX

Nobody a clue yet?

(Srry for the bumping)

Share this post


Link to post
Share on other sites
FrashMX

I was thinking maybe a simulation would fit for the purpose. You click a button or an image in this case and:

1) The cursor changes to the one with 4 arrows

2) The cursor will track moves and update the window position w/ the new co-ords asap

3) When the mouse button is released, the cursor reverts and it will stop tracking movements.

Share this post


Link to post
Share on other sites
SlimShady

That's a great idea. I'll see if I can make this happen.

Share this post


Link to post
Share on other sites
SlimShady

It took me a while but I made it :)

See attachment.

Instructions:

Click on the label (and hold) and move your mouse.

Share this post


Link to post
Share on other sites
this-is-me

Are you guys thinking too hard lately?

#include <guiconstants.au3>
Opt("GuiOnEventMode", 1)
$HTCAPTION = 2
$WM_NCLBUTTONDOWN = 0xA1
$winttl = "Test"
$guihndl = GUICreate($winttl, 500, 300, -1, -1)
GUISetOnEvent($GUI_EVENT_PRIMARYDOWN, "captureit")
GUISetState(@SW_SHOW)
Sleep(50000)

func captureit()
  dllcall("user32.dll","int","ReleaseCapture")
  dllcall("user32.dll","int","SendMessage","hWnd", $guihndl,"int",$WM_NCLBUTTONDOWN,"int", $HTCAPTION,"int", 0)
EndFunc

Drag the window with the body.


Who else would I be?

Share this post


Link to post
Share on other sites
FrashMX

Awesome, thanks!

I think my intuition is right, this community rocks :)

Share this post


Link to post
Share on other sites
FrashMX

Srry I have a small offtopic question but I dont want to filth the forum with another thread; My GUI is partially transparent and has an image overlay. You can compare it to Winamp, an image based GUI. The problem is, when I place a button ON the image it does not; 1) Get the "pushed" look when clicked 2) Perform its task.

Is there a reason why a button on a transparent image behaves weird?

Share this post


Link to post
Share on other sites
eJan

If You use: $n=GUICtrlCreatePic(@Systemdir & "\oobe\images\mslogo.jpg",50,50, 200,50)

Then: GUICtrlSetState($n, $GUI_DISABLE)

(to disable picture control), in this case button should work.

Share this post


Link to post
Share on other sites
FrashMX

It does seem to have a problem with the $GUI_EVENT_PRIMARYDOWN; my button stops working and I think it doesnt react because the PRIMARYDOWN action overrules the button also. Is there a way to prevent this?

-Edit- Code added.

#include <Constants.au3>
#include "GUIConstants.au3"
#include <Array.au3>

;Global stuff
FileChangeDir(@Scriptdir)
#NoTrayIcon

;Vars
$HTCAPTION = 2
$WM_NCLBUTTONDOWN = 0xA1

;The script
$pic=GUICreate("", 472, 297, 1024/2-472/2, 768/2-297/2,$WS_POPUP)
GUISetState(@SW_SHOW)

$gui=GUICtrlCreatePic ("window.gif", 0, 0, 472, 297)
GUISetState(@SW_SHOW)

GUICtrlSetState($gui, $GUI_DISABLE)

$btnx=GUICtrlCreateButton('Hello World',40,40,100,20)
GUISetState(@SW_SHOW)

func captureit()
  dllcall("user32.dll","int","ReleaseCapture")
  dllcall("user32.dll","int","SendMessage","hWnd", $pic,"int",$WM_NCLBUTTONDOWN,"int", $HTCAPTION,"int", 0)
EndFunc

Do
    $msg = GUIGetMsg(1)
    Select
    Case $msg[0]= $GUI_EVENT_PRIMARYDOWN
            captureit()
        Case $msg[0]= $btnx
                        MsgBox(0,"Button click", "Clicked on btnx")
        Case $msg[0]= $GUI_EVENT_CLOSE
            MsgBox(0,"Close", "Closing window.")
            Exit
    EndSelect
Until $msg = $GUI_EVENT_CLOSE
Edited by FrashMX

Share this post


Link to post
Share on other sites
layer

also, GUIGetCursorInfo will tell you if the primary or secondary mouse button is up, or down... just thought id let yall know


FootbaG

Share this post


Link to post
Share on other sites
eJan

Try this one: <= removed

Please upload Your script with images.

Edit: GUISetOnEvent

OnEvent functions are only called when the option GUIOnEventMode is set to 1 - when in this mode GUIGetMsg is NOT used at all.

... GUICtrlSetState, I think that the buttons can't work constantly.

EDIT: Added new script with button functionality Transparent_GUI.rar

Edited by eJan

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  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.