Jump to content

Custom Menu UDF! UPDATED


Szhlopp
 Share

Recommended Posts

Okay Here it is...

Two simple commands for adding menu's and menu Items:

_GUICtrlInitializeCMenu

_GUICtrlCreateMenuCItem

Menu looks real!

Has the mouse over effect.

Pushed effect.

Supports menu's AND sub menu's!

Create custom menu backgrounds.

Easily add a menu in your skinned GUI!

post-37937-1216343415_thumb.jpg

I need some feedback on this. Tell me how it works. Show me the bugs/glitches! I created this specifically for skinning GUI's. Give it a try and show me how it worked!

;_GUICtrlCreateMenuCItem(34, 20, "Test" [, $PixelWidth = 20])

;X location of the (First/Second) Item
;Y location of the (First/Second) Item
;Name of the Item
;Length in pixels of the Highlight and Pressed images

; You do NOT need the showMenu function to show this... Sorry I didn't edit this out!

Download latest version here:

MenuUDF.zip

(Change the location of the #include <MenuUdf.au3>)

Edited by Szhlopp
Link to comment
Share on other sites

When checking syntax i got 6 warnings.

D:\MenuUDF_example\MenuUDF_example.au3(59,27) : WARNING: $MenuItem1: possibly used before declaration.
            if $CI[4] = $MenuItem1 Then
            ~~~~~~~~~~~~~~~~~~~~~~~^
D:\MenuUDF_example\MenuUDF_example.au3(62,45) : WARNING: $MenuContext: possibly used before declaration.
                ShowMenu($GUI1, $MenuItem1, $MenuContext)
                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
D:\MenuUDF_example\MenuUDF_example.au3(71,22) : WARNING: $OptionsCommon: possibly used before declaration.
        Case $OptionsCommon
        ~~~~~~~~~~~~~~~~~~~^
D:\MenuUDF_example\MenuUDF_example.au3(75,20) : WARNING: $OptionsFile: possibly used before declaration.
        Case $OptionsFile
        ~~~~~~~~~~~~~~~~~^
D:\MenuUDF_example\MenuUDF_example.au3(79,20) : WARNING: $OptionsExit: possibly used before declaration.
        Case $OptionsExit
        ~~~~~~~~~~~~~~~~~^
D:\MenuUDF_example\MenuUDF_example.au3(14,73) : WARNING: $MenuItem1: declared global in function only. Prefer top of file.
Global $menubar, $picpressed_1, $picpressed_2, $picpressed_3, $MenuItem1,
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
D:\MenuUDF_example\MenuUDF_example.au3 - 0 error(s), 6 warning(s)
Link to comment
Share on other sites

When checking syntax i got 6 warnings.

D:\MenuUDF_example\MenuUDF_example.au3(59,27) : WARNING: $MenuItem1: possibly used before declaration.
            if $CI[4] = $MenuItem1 Then
            ~~~~~~~~~~~~~~~~~~~~~~~^
D:\MenuUDF_example\MenuUDF_example.au3(62,45) : WARNING: $MenuContext: possibly used before declaration.
                ShowMenu($GUI1, $MenuItem1, $MenuContext)
                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
D:\MenuUDF_example\MenuUDF_example.au3(71,22) : WARNING: $OptionsCommon: possibly used before declaration.
        Case $OptionsCommon
        ~~~~~~~~~~~~~~~~~~~^
D:\MenuUDF_example\MenuUDF_example.au3(75,20) : WARNING: $OptionsFile: possibly used before declaration.
        Case $OptionsFile
        ~~~~~~~~~~~~~~~~~^
D:\MenuUDF_example\MenuUDF_example.au3(79,20) : WARNING: $OptionsExit: possibly used before declaration.
        Case $OptionsExit
        ~~~~~~~~~~~~~~~~~^
D:\MenuUDF_example\MenuUDF_example.au3(14,73) : WARNING: $MenuItem1: declared global in function only. Prefer top of file.
Global $menubar, $picpressed_1, $picpressed_2, $picpressed_3, $MenuItem1,
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
D:\MenuUDF_example\MenuUDF_example.au3 - 0 error(s), 6 warning(s)

Move the Global $ XXXXXXXXXX outside the first function.

Yes this still needs work. But can someone point me to a post where they have a working menu? It was my understanding that no one has been able to make one work like the real menu does.

Excuse my ignorance. I couldn't find one=)

Anyone else have some feedback on this? I'm hoping to get this working very soon as a stand-alone UDF.

Link to comment
Share on other sites

Holger made a nice one!

I couldn't get his to work. I was getting tons of errors when I tried to run it. Any advice?

I updated it. Re-download it and give it a shot. Please let me know how it looks!

Link to comment
Share on other sites

That's because some of the constants have already been declared in latest AutoIt. Search for an "fixed" version and you get this.

Thanks it worked. And it's awesome for a regular menu!!

Here's the deal though, put in "0x80000000" as the style in the GUI.

$hMainGUI = GUICreate("Sample Menu", -1, -1, -1, -1 , 0x80000000)

Correct me again if I'm wrong, but to me it seems I can't make this menu move off the top of my screen.

The whole point in me re-making the menu was for skinning. If you have an image header (a clickable one to move the GUI around) it makes the GUI look stupidly hilarious with the menu above the header image=)

Edit: I could use some help with trying to make the context menus change when I have click/opened one, and then move my mouse over another menu item. Once I click one of my items, it stays open until you click someplace else=)

Edited by Szhlopp
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...