Jump to content

Autohide menu?


Recommended Posts

You're still pretty new, so allow me to explain how this works:

1. You want to accomplish something, so you try to do it yourself --> Check

2. You don't manage to do what you wanted, so you think to ask for help --> Check

3. You take the code that you tried and post it along with what you want to accomplish, and ask for help --> ?????

4. Someone looks at what you want to do, and what you tried, and sees what you need to do differently and tells you --> Step 3 pretty much always comes before Step 4

Link to comment
Share on other sites

You're still pretty new, so allow me to explain how this works:

1. You want to accomplish something, so you try to do it yourself --> Check

2. You don't manage to do what you wanted, so you think to ask for help --> Check

3. You take the code that you tried and post it along with what you want to accomplish, and ask for help --> ?????

4. Someone looks at what you want to do, and what you tried, and sees what you need to do differently and tells you --> Step 3 pretty much always comes before Step 4

its just a standard gui with a menu. The one in the help file under guictrlcreatemenu... :idea:

Link to comment
Share on other sites

  • Moderators

SBrown,

Please remember this is not a 24/7 support forum - those who answer are only here because they like helping others and have some time to spare. You just have to wait until someone who knows something about your particular problem, and is willing to help, comes online. Be patient and someone will answer eventually.

And taking that attitude will not help! :)

M23

Edit:

This is a real workaround and there must be a better way: :idea:

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <WinAPI.au3>
#include <Misc.au3>

$dll = DllOpen("user32.dll")
Global $fMenu_Showing = False

; Create Main GUI
$hGUI = GUICreate("Test", 500, 500)

GUISetState()

; Create Menu GUI
Global $hMenu_Win = GUICreate("", 500, 20, -1, -1, $WS_POPUP, $WS_EX_MDICHILD, $hGUI)

; Create menu
Global $mFile_Menu = GUICtrlCreateMenu("&File")
Global $hExit_Menu_Item = GUICtrlCreateMenuItem("&Exit", $mFile_Menu)
Global $mHelp_Menu = GUICtrlCreateMenu("&?")
Global $hAbout_Menu_Item = GUICtrlCreateMenuItem("&About", $mHelp_Menu)

; Move to correct position
Local $aWin_Pos = WinGetPos($hGUI)
Local $iBorder = _WinAPI_GetSystemMetrics(8) ; Border width
Local $iBar = _WinAPI_GetSystemMetrics(4) ; Title bar height
WinMove($hMenu_Win, "", $aWin_Pos[0] + $iBorder, $aWin_Pos[1] + $iBorder + $iBar)

; Set trans to less than full to prevent visual artefacts when sliding & dragging
WinSetTrans($hMenu_Win, "", 250)

; Hide initially
GUISetState(@SW_HIDE, $hMenu_Win)

While 1

    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE, $hExit_Menu_Item
            DllClose($dll)
            Exit
        Case $hAbout_Menu_Item
            _Menu_State()
            MsgBox(0, "AutoHide Menu", "Does this help?")
    EndSwitch

    ; Check if Alt key pressed
    If _WinAPI_GetFocus() = $hGUI Then
        If _IsPressed("12", $dll) Then
            _Menu_State()
        EndIf
    EndIf

    ; Hide menu if it loses focus
    If $fMenu_Showing Then
        If _WinAPI_GetFocus() <> $hMenu_Win Then
            _Menu_State()
        EndIf
    EndIf

WEnd

Func _Menu_State()
    If $fMenu_Showing Then
        GUISetState(@SW_HIDE, $hMenu_Win)
        $fMenu_Showing = False
    Else
        GUISetState(@SW_SHOW, $hMenu_Win)
        $fMenu_Showing = True
    EndIf
EndFunc

Edited by Melba23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...