Jump to content
Sign in to follow this  
bouncingmolar

dropdown menu without the menubar.

Recommended Posts

bouncingmolar

I am trying to make a dropdown menu using GUICtrlCreateMenu

But there is no option to position the menu on the window. by default it makes a menubar above all your other controls.

Is there an alternative type of dropdown menu which i can position next to my buttons and labels?

Thanks.

Share this post


Link to post
Share on other sites
Josbe

I am trying to make a dropdown menu using GUICtrlCreateMenu

But there is no option to position the menu on the window. by default it makes a menubar above all your other controls.

Is there an alternative type of dropdown menu which i can position next to my buttons and labels?

Thanks.

With menu control, it's not possible.

TIP: Perhaps like as trick, you could recreate something similar to this, with GUICtrlCreateContextMenu() and some button or graphic.

Share this post


Link to post
Share on other sites
BrettF

Always possible to use child windows... :mellow:

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <StaticConstants.au3>

Dim $defaultstatus = "Ready"

$gui = GUICreate("Main GUI", 300, 180)
GUICtrlSetState(-1, $GUI_CHECKED)
$okbutton = GUICtrlCreateButton("OK", 50, 50, 100, 20)
GUICtrlSetState(-1, $GUI_FOCUS)
$cancelbutton = GUICtrlCreateButton("Cancel", 180, 130, 70, 20)
$statuslabel = GUICtrlCreateLabel($defaultstatus, 0, 165, 300, 16, BitOR($SS_SIMPLE, $SS_SUNKEN))

GUISetState(@SW_SHOW)
$pic = GUICreate("", 169, 68, 50, 50, $WS_POPUP, $WS_EX_MDICHILD, $gui)
$filemenu = GUICtrlCreateMenu("&File")
$fileitem = GUICtrlCreateMenuItem("Open", $filemenu)
GUICtrlSetState(-1, $GUI_DEFBUTTON)
$helpmenu = GUICtrlCreateMenu("?")
$saveitem = GUICtrlCreateMenuItem("Save", $filemenu)
GUICtrlSetState(-1, $GUI_DISABLE)
$infoitem = GUICtrlCreateMenuItem("Info", $helpmenu)
$exititem = GUICtrlCreateMenuItem("Exit", $filemenu)
$recentfilesmenu = GUICtrlCreateMenu("Recent Files", $filemenu, 1)

$separator1 = GUICtrlCreateMenuItem("", $filemenu, 2)  ; create a separator line

$viewmenu = GUICtrlCreateMenu("View", -1, 1)   ; is created before "?" menu
$viewstatusitem = GUICtrlCreateMenuItem("Statusbar", $viewmenu)

GUISetState(@SW_SHOW)

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE, $exititem
            Exit
        Case $fileitem
            $file = FileOpenDialog("Choose file...", @TempDir, "All (*.*)")
            If @error <> 1 Then GUICtrlCreateMenuItem($file, $recentfilesmenu)
        Case $viewstatusitem
            If BitAND(GUICtrlRead($viewstatusitem), $GUI_CHECKED) = $GUI_CHECKED Then
                GUICtrlSetState($viewstatusitem, $GUI_UNCHECKED)
                GUICtrlSetState($statuslabel, $GUI_HIDE)
            Else
                GUICtrlSetState($viewstatusitem, $GUI_CHECKED)
                GUICtrlSetState($statuslabel, $GUI_SHOW)
            EndIf
        Case $infoitem 
            MsgBox(0, "Info", "Only a test...")
    EndSwitch
WEnd

Cheers,

Brett

Share this post


Link to post
Share on other sites
BrettF
bouncingmolar

Always possible to use child windows... :mellow:

Hi brett thats cool! I actually saw your post after i added a child window!

I got rid of the black line down the bottom by making the child windows height slightly smaller.

Is there anyway of making the childwindows menu stay black when you activate the parent window?.... its pretty minor and my program will work greyed out but u know.... it looks kinda nice.

Cheers guys.

Share this post


Link to post
Share on other sites
bouncingmolar

Are you sure Menu control actually work in child windows? Because it doesnt redraw the menu.

what do you mean it doesn't redraw? It seems to be working ok in my application

do you mean when you drag the window it disappears? If you do that is easily fixed by making it always on top (with conditions).

Share this post


Link to post
Share on other sites
BrettF

Are you sure Menu control actually work in child windows? Because it doesnt redraw the menu.

It doesn't redraw? Hmmm.... I'm not sure. It worked and I posted it as a concept for the OP to smooth out, everything made in 2minutes has bugs :mellow:

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.