Jump to content

Recommended Posts

Posted

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.

Posted

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

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
×
×
  • Create New...