virhonestum

Window with custom title bar

9 posts in this topic

#1 ·  Posted (edited)

Edit: Now I'm going to expand the question, how do I create a custom title bar? So you have custom buttons (I already have those), but also have a part at the top, with which you can drag the window around. I don't need an icon or a title, so the only thing I need is this draggable part.

 

Original Question:

I want to make a GUI, which doesn't use the Windows buttons and has custom minimize/close-buttons.

But when I add the $WS_POPUP style to my GUI, and have the minimize button execute 

GUISetState(@SW_MINIMIZE)

the window has no minimize animation, where the window shrinks and retracts into the task bar.

Is there any way I can remove the border and the upper bar but still have the animation?

Thank you very much

Virhonestum (Vir)

Edited by virhonestum

Share this post


Link to post
Share on other sites



virhonestum, it is just a tad difficult to troubleshoot the issue off a single line of code. How about providing your entire code, or at least a fair reproducer of the problem?


√-1 2^3 ∑ π, and it was delicious!

Share this post


Link to post
Share on other sites

Sorry for the late response, but this the important part of what I'm currently working with:

#Include <GUIConstants.Au3>
#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>

$Calculator = GUICreate("", 298, 100, 556, 260, $WS_POPUP)
GUISetBkColor(0xFFFFFF)
$Button_Exit = GUICtrlCreateLabel("×", 256, 0, 41, 17, BitOR($SS_CENTER, $SS_CENTERIMAGE))
GUICtrlSetBkColor(-1, 0xDC0000)
GUICtrlSetColor(-1, 0xF2F2F2)
$Button_Minimize = GUICtrlCreateLabel("_", 224, 0, 25, 17, BitOR($SS_CENTER, $SS_CENTERIMAGE))
GUICtrlSetBkColor(-1, 0x1E1E1E)
GUICtrlSetColor(-1, 0xF2F2F2)
GUISetState(@SW_SHOW)

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Button_Exit
            Exit
        Case $Button_Minimize
            GUISetState(@SW_MINIMIZE)
    EndSwitch
WEnd

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

This is how it looks for me:

aa19cb9b22efdfc5a89124fd8023c649.gif

On this one the window just disappears

 

And this is how I want it (I removed the $WS_POPUP here)

cbf8acd3556c54700ddd386a7c4366da.gif

On this one it shrinks, fades out, and retracts to the task bar

Edited by virhonestum

Share this post


Link to post
Share on other sites

I just realized that you cannot drag the window around either, so I added another question (I edited the whole topic)

How am I able to drag the window around?

Share this post


Link to post
Share on other sites

I picked this drag routine from the forums and use it a lot.  I cannot remember who posted it.

#Include <GUIConstants.Au3>
#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <WinAPI.au3> ; <---------------- Added
Global Const $SC_DRAGMOVE = 0xF012 ; <---------------- Added
$Calculator = GUICreate("", 298, 100, 556, 260, $WS_POPUP)
GUISetBkColor(0xFFFFFF)
$Button_Exit = GUICtrlCreateLabel("×", 256, 0, 41, 17, BitOR($SS_CENTER, $SS_CENTERIMAGE))
GUICtrlSetBkColor(-1, 0xDC0000)
GUICtrlSetColor(-1, 0xF2F2F2)
$Button_Minimize = GUICtrlCreateLabel("_", 224, 0, 25, 17, BitOR($SS_CENTER, $SS_CENTERIMAGE))
GUICtrlSetBkColor(-1, 0x1E1E1E)
GUICtrlSetColor(-1, 0xF2F2F2)
GUISetState(@SW_SHOW)

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Button_Exit
            Exit
        Case $Button_Minimize
            GUISetState(@SW_MINIMIZE)
    EndSwitch
    _SendMessage($Calculator, $WM_SYSCOMMAND, $SC_DRAGMOVE, 0) ; <---------------- Added
WEnd

This runs on my machine.  win8.1  64

REB


MEASURE TWICE - CUT ONCE

Share this post


Link to post
Share on other sites

@JohnOne

Thanks, that's what I needed!

@reb

Definitely gonna save that for later but in this case I don't want it to be draggable everywhere on the window 

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