Jump to content

Problem with position of the menubar


Go to solution Solved by CoffeeJoe,

Recommended Posts

I've created my own titlebar and exit button. When adding a menu (just a basic menu) it puts itself above my titlebar.

I can't find any references to controlling how this works.

I stripped down my code so it should run for anyone who wants to have a look.

Thanks in advance.

#include <GUIConstants.au3>
#include <GUIConstantsEx.au3>
;#include <ButtonHover.au3>
#include <Date.au3>

#NoTrayIcon

Global Const $IMAGEPATH = @ScriptDir & "\Images"
Global $GUIx = 950, $GUIy = 700


;Define the Primary GUI ===================================================================================
    $main = GUICreate("", $GUIx, $GUIy, Default, Default, $WS_POPUP, $WS_EX_TOPMOST)
        $titlebar = GUICtrlCreateLabel("  Program", 0, 0, ($GUIx-60), 30, -1, $GUI_WS_EX_PARENTDRAG)
            GUICtrlSetColor(-1, 0xFFFFFF)
            GUICtrlSetFont(-1, 18, 700, -1, "High Tower Text", 5)
            GUICtrlSetBkColor($titlebar, 0xFF6F00)
        $miniB = GUICtrlCreateButton("_", ($GUIx - 60), 0, 30, 30)
        $exitB = GUICtrlCreateButton("X", ($GUIx - 30), 0, 30, 30)

        ;$miniB = CreateButton(($GUIx-60), 0, $IMAGEPATH & "\min1.bmp", $IMAGEPATH & "\min2.bmp", $IMAGEPATH & "\min3.bmp")
        ;$exitB = CreateButton(($GUIx-30), 0, $IMAGEPATH & "\ex1.bmp", $IMAGEPATH & "\ex2.bmp", $IMAGEPATH & "\ex3.bmp")
;Define Menu -----------------------------------------------------------------------------------
    $filemenu = GUICtrlCreateMenu("File")
        GUICtrlSetPos(-1, 0, 31, $GUIx, 30)


    GUISetState(@SW_SHOW, $main)


;Main Process Loop ======================================================================================
While 1
    $msg = GUIGetMsg()
        If $msg = $GUI_EVENT_CLOSE Then ExitLoop
        If $msg = $miniB Then GUISetState(@SW_MINIMIZE, $main)
        If $msg = $exitB Then ExitLoop
WEnd

 

Link to post
Share on other sites
  • Solution

Soo... I spent some time experimenting with the $WS_EX_MDICHILD and a nested GUI for managing the Menu.

This appears to be the way some other folks have done it.

It seems effective enough - wrote a function to readjust the alignment when the window gets moved in case that was an issue.

But, in the end I scrapped it all in favor of a custom toolbar with icons and no drop downs. (didn't have that much to do there anyway)

I'll call it resolved but if anyone has a better way I'm always looking to find new aspects of Autoit - There is so much that I don't know half of what I don't know anymore.

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
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...