Jump to content

Custom menu


PlayHD
 Share

Recommended Posts

hey all

i want to create a custom menu like this i already try with _GUICtrlMenu_CreatePopup and _GUICtrlMenu_SetMenuBackground but i don't like it : http://prntscr.com/i8mor

i dont want to use

thanks in advance :)

Edited by PlayHD
Link to comment
Share on other sites

Here a fast hack:

;fast hack by UEZ 2012
#include <WindowsConstants.au3>

Global $hGUI = GUICreate("Test", 240, 180)
Global $idBtn = GUICtrlCreateButton("Menu", 50, 10, 50, 30)
GUISetState()


Do
    Switch GUIGetMsg()
        Case -3
            ExitLoop
        Case $idBtn
            ShowSubMenu($hGUI, $idBtn)
    EndSwitch
Until 0
GUIDelete()
Exit

Func ShowSubMenu($hWnd, $idCtrl)
    Local $aPos = ControlGetPos($hWnd, "", $idCtrl), $a
    Local $hGUI_Child = GUICreate("", 150, 115,  $aPos[0], $aPos[1] + $aPos[3],  $WS_POPUP, $WS_EX_MDICHILD, $hWnd)
    GUISetFont(22)
    Local $iStdColor = 0x96979B, $iHighlightColor = 0x2F2FDF
    GUISetBkColor($iStdColor, $hGUI_Child)
    Local $idLabel1 = GUICtrlCreateLabel("Text 1", 8,0, 136, 33)
    GUICtrlSetColor(-1, 0xFFFFFF)
    GUICtrlSetBkColor(-1, $iStdColor)
    Local $idLabel2 = GUICtrlCreateLabel("Text 2", 8,40, 136, 33)
    GUICtrlSetColor(-1, 0xFFFFFF)
    GUICtrlSetBkColor(-1, $iStdColor)
    Local $idLabel3 = GUICtrlCreateLabel("Text 3", 8,80, 136, 33)
    GUICtrlSetColor(-1, 0xFFFFFF)
    GUICtrlSetBkColor(-1, $iStdColor)
    GUISetState(@SW_SHOW, $hGUI_Child)
    Local $bL1 = True, $bL2 = True, $bL3
    Do
        $a = GUIGetCursorInfo($hGUI_Child)
        Switch $a[4]
            Case $idLabel1
                If $bL1 Then
                    GUICtrlSetBkColor($idLabel1, $iHighlightColor)
                    GUICtrlSetBkColor($idLabel2, $iStdColor)
                    GUICtrlSetBkColor($idLabel3, $iStdColor)
                    $bL1 = False
                    $bL2 = True
                    $bL3 = True
                EndIf
            Case $idLabel2
                If $bL2 Then
                    GUICtrlSetBkColor($idLabel2, $iHighlightColor)
                    GUICtrlSetBkColor($idLabel1, $iStdColor)
                    GUICtrlSetBkColor($idLabel3, $iStdColor)
                    $bL2 = False
                    $bL1 = True
                    $bL3 = True
                EndIf
            Case $idLabel3
                If $bL3 Then
                    GUICtrlSetBkColor($idLabel3, $iHighlightColor)
                    GUICtrlSetBkColor($idLabel1, $iStdColor)
                    GUICtrlSetBkColor($idLabel2, $iStdColor)
                    $bL3 = False
                    $bL1 = True
                    $bL2 = True
                EndIf
            Case Else
                    $bL3 = True
                    $bL1 = True
                    $bL2 = True
        EndSwitch
        If $a[2] Then ExitLoop
    Until False
    If Not $bL1 Then MsgBox(0, "Test", "Label 1 was selected")
    If Not $bL2 Then MsgBox(0, "Test", "Label 2 was selected")
    If Not $bL3 Then MsgBox(0, "Test", "Label 3 was selected")
    GUIDelete($hGUI_Child)
    Return 1
EndFunc

Br,

UEZ

Edited by UEZ

Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

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...