Jump to content

Tray Menu


Ashww
 Share

Recommended Posts

Ok, well im still making my Account Control.

I wish to use a TrayMenu instead of hotkeys.

I cannot get this to work.

Here is what i have tested in a blank GUI script:

While 1 $nMsg = GUIGetMsg() $msg = TrayGetMsg() Switch $nMsg        Case $GUI_EVENT_CLOSE           Exit    EndSwitch       Select      Case $msg = $menuedit           MsgBox(89,"title","you have opened the edit menu")      Case $msg = $MenuInfo           MsgBox(89,"title","you have opened the info menu")  EndSelectWEnd[code=auto:0]Can someone point me in the correct direction, or better still fix this code CheerAshww X)


            
        

        

        
            

    
        

        
            - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -                                                     Projects: Account Control              Wii style gui      Bingo Caller                             - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Want a website? Click here!- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -I use my Blackberry Storm to browse the forum! Please be patient!- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
        
    

        
    

    

    




    Link to comment
    
        
    
    
    

    
    Share on other sites
    

    
        
            

    

        
            

    

        
            

    

        
            

    

        
    


    
    More sharing options...

    


    

                    
                    
                    
                

                    

                    
                    





    

    
        
            
                
                    Moderators
                
                
                
                
            
        
    

    
        
            
                


    
        
    

                
                
                
                
                    
                        

                    
                
            
        
        
            
                


Melba23
            
            
                Posted 
                
            
        
    
    
        


Melba23
            
        
        
            
                
                    


    
        
    

                    
                        
                    
                    
                        

                    
                
            
            
                Moderators
                
                    
                
            
            
                
                    
                        
                            
                                
                            
                                 31.1k
                            
                                
                            
                        
                        
                            
                                
                                    
                                        
                                        477
                                
                                    
                                
                            
                        
                    
                
            
            
                

    
    
        
I'm old, what's your excuse?
    
    

            
        
    
    
        



    
        
            
                
                    
                    
                        Moderators
                    
                    
                    
                    
                
            
            
                
                    
                    
                        
                        
                            Share
                        
                        
                        
                        
                        
                            
                                
                            
                            
                            
                            
                            
                            
                        
                    
                
                
            
        

        
            Posted 
            
            
                
                
            
        
    

    

    

    
        
        
            Ashww,

You need to disable the built-in menu items or the script pauses when you click on the icon.  Try this:Opt("TrayMenuMode",1)   ; Default tray menu items will not be shown.

$menuedit = TrayCreateItem("Edit")
$MenuInfo = TrayCreateItem("Info")

GUICreate("Test", 100, 100)
GUISetState()

While 1
    $nMsg = GUIGetMsg()
    
    Switch $nMsg 
        Case -3
        Exit
    EndSwitch

    $msg = TrayGetMsg()

    Switch $msg
        Case $menuedit
            MsgBox(0,"title","you have opened the edit menu")
        Case $MenuInfo
            MsgBox(0,"title","you have opened the info menu")
    EndSwitch
WEnd

M23

P.S. If you use the "Preview Post" button you will not forget the / in the closing

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

Ashww,

You need to disable the built-in menu items or the script pauses when you click on the icon. Try this:

Opt("TrayMenuMode",1)  ; Default tray menu items will not be shown.

$menuedit = TrayCreateItem("Edit")
$MenuInfo = TrayCreateItem("Info")

GUICreate("Test", 100, 100)
GUISetState()

While 1
    $nMsg = GUIGetMsg()
    
    Switch $nMsg 
        Case -3
        Exit
    EndSwitch

    $msg = TrayGetMsg()

    Switch $msg
        Case $menuedit
            MsgBox(0,"title","you have opened the edit menu")
        Case $MenuInfo
            MsgBox(0,"title","you have opened the info menu")
    EndSwitch
WEnd

M23

P.S. If you use the "Preview Post" button you will not forget the / in the closing

Ahh thanks.

Does the While part have to be like that? cause sometimes it doent recognise i have clicked

Cheers

Ashww

X)

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Projects: Account Control Wii style gui Bingo Caller - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Want a website? Click here!- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -I use my Blackberry Storm to browse the forum! Please be patient!- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Link to comment
Share on other sites

  • Moderators

Ashww,

Personally I always use:

Opt("TrayOnEventMode",1) ; Use event trapping for tray menu

to prevent that. Just be aware that your tray menu is then always active and will store up clicks which are acted upon once the current function ends. You may have to use:

TraySetClick(0) ; Tray context menu cannot be opened

.....

TraySetClick(16) ; Tray context menu can be opened by right click

to prevent that if it becomes a problem.

M23

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

Ashww,

Personally I always use:

Opt("TrayOnEventMode",1) ; Use event trapping for tray menu

to prevent that. Just be aware that your tray menu is then always active and will store up clicks which are acted upon once the current function ends. You may have to use:

TraySetClick(0) ; Tray context menu cannot be opened

.....

TraySetClick(16) ; Tray context menu can be opened by right click

to prevent that if it becomes a problem.

M23

Thank you

I will try this when I get home

Cheers

Ashww

X)

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Projects: Account Control Wii style gui Bingo Caller - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Want a website? Click here!- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -I use my Blackberry Storm to browse the forum! Please be patient!- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

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