Sign in to follow this  
Followers 0
sensalim

Creating tray menu from array

4 posts in this topic

Hi,

Let's say I have an array. This array will contain names. There will be x members in this array.

I want to make traymenuitems from this array and just one function that handles all members in the array (using case I guess).

My question is, what do I put in this function to 'recognize' which one the user chooses among that traymenu items?

Thanks.

Share this post


Link to post
Share on other sites



An easy way is to use the TrayGetItemText() Function.

#NoTrayIcon

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

$getitem    = TrayCreateItem("Get Text")
TrayCreateItem("")
$aboutitem  = TrayCreateItem("About")
TrayCreateItem("")
$exititem   = TrayCreateItem("Exit")

TraySetState()

While 1
    $msg = TrayGetMsg()
    Select
        Case $msg <> $exititem and $msg > 0
            Msgbox(64,"State",TrayItemGetText($msg))
        Case $msg = $exititem
            ExitLoop
    EndSelect
WEnd

Exit

Share this post


Link to post
Share on other sites

Yes that works.

I forgot to mention though, I like to use Opt("TrayOnEventMode",1)

so...

:)

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  
Followers 0