Sign in to follow this  
Followers 0
luzif3r

a little help with "TrayMenuMode"

10 posts in this topic

this should be explained rather quickly but for some reason i am unable to combine

Opt("TrayMenuMode", 1)

and

Opt("TrayMenuMode", 8)

together.

from what i understand it should be

Opt("TrayMenuMode", 18)

but that shows the exit and pause buttons again...i can provide the code but i think i might just miss something simple here.

Share this post


Link to post
Share on other sites



this should be explained rather quickly but for some reason i am unable to combine

Opt("TrayMenuMode", 1)

and

Opt("TrayMenuMode", 8)

together.

from what i understand it should be

Opt("TrayMenuMode", 18)

but that shows the exit and pause buttons again...i can provide the code but i think i might just miss something simple here.

1 + 8 = 9 in my book

SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

i tried that too heh now my radiobuttons even refuse to being checked...

code snippet:

Func tray()
;no standard menu
    Opt("TrayMenuMode", 9)
;on event mode cos the other one sucks lol
    Opt("TrayOnEventMode",1)
;left click to show the main menu again
    TraySetOnEvent($TRAY_EVENT_PRIMARYDOWN, "show_main_gui")
;show the tray menu on rightclick
    TraySetClick(8)
;accounts menu
    Global $traymenu = TrayCreateMenu("Accounts")
;account array for the traymenu
    Global $tray_accs[99]
;add the accounts found
    For $i = 1 To $accs_stored
;set the associated function
        $tray_accs[$i] = TrayCreateItem($ini_acc[$i], $traymenu)
        TrayItemSetOnEvent(-1, "tray_login")
    Next
;seperator line
    TrayCreateItem("")
    $tray_minimized = TrayCreateItem("Minimized", -1, -1, 1)
    $tray_login_exit = TrayCreateItem("Exit on login", -1, -1, 1)
;seperator line
    TrayCreateItem("")
;tray menu entry "about"
    Global $trayitem_about = TrayCreateItem("About")
    TrayItemSetOnEvent(-1, "about")
;seperator line
    TrayCreateItem("")
;tray menu entry "exit"
    Global $trayitem_exit = TrayCreateItem("Exit")
    TrayItemSetOnEvent(-1, "close")
;show the shit
    TraySetState()
EndFunc

edit: it seems to incorporate the

Opt("TrayMenuMode", 2)

too or something.

Edited by luzif3r

Share this post


Link to post
Share on other sites

1 + 8 = 9 in my book

check your math that sounds a little off :)

try this example to do your math for you

$x = 1
$y = 8
If $x + $y <> 9 Then
MsgBox(0, "hi", "IDK why but 8 + 1 is no longer 9")
ElseIf $x + $y = 9 Then
MsgBox(0, "hi", "yup its still 9.")
EndIf

Share this post


Link to post
Share on other sites

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

$settingsitem   = TrayCreateMenu("Settings")
$displayitem    = TrayCreateItem("Display", $settingsitem, -1, 1)
$printeritem    = TrayCreateItem("Printer", $settingsitem, -1, 1)
TrayCreateItem("")
$aboutitem      = TrayCreateItem("About")
TrayItemSetOnEvent(-1,"About")
TrayCreateItem("")
$exititem       = TrayCreateItem("Exit")
TrayItemSetOnEvent(-1,"Terminate")

TraySetState()

While 1
    Sleep ( 10 )
WEnd

Func Terminate()
    Exit
EndFunc

Func About()
    Msgbox(64,"about:","AutoIt3-Tray-sample")
EndFunc


SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

Share this post


Link to post
Share on other sites

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

$settingsitem   = TrayCreateMenu("Settings")
$displayitem    = TrayCreateItem("Display", $settingsitem, -1, 1)
$printeritem    = TrayCreateItem("Printer", $settingsitem, -1, 1)
TrayCreateItem("")
$aboutitem      = TrayCreateItem("About")
TrayItemSetOnEvent(-1,"About")
TrayCreateItem("")
$exititem       = TrayCreateItem("Exit")
TrayItemSetOnEvent(-1,"Terminate")

TraySetState()

While 1
    Sleep ( 10 )
WEnd

Func Terminate()
    Exit
EndFunc

Func About()
    Msgbox(64,"about:","AutoIt3-Tray-sample")
EndFunc

eeeh yes i can and do actually read those. my problem is i dont want them to uncheck eachother. which is option 8 and combined with 1 to 9 makes my menuitems uncheckable. that is my problem.

Share this post


Link to post
Share on other sites

#include <Constants.au3>
#NoTrayIcon
Opt("TrayMenuMode",9)   ; Default tray menu items (Script Paused/Exit) will not be shown.
Opt("TrayOnEventMode",1)

$settingsitem   = TrayCreateMenu("Settings")
$displayitem    = TrayCreateItem("Display", $settingsitem, -1, 1)
TrayItemSetOnEvent(-1,"Display")
$printeritem    = TrayCreateItem("Printer", $settingsitem, -1, 1)
TrayItemSetOnEvent(-1,"Printer")
TrayCreateItem("")
$aboutitem      = TrayCreateItem("About")
TrayItemSetOnEvent(-1,"About")
TrayCreateItem("")
$exititem       = TrayCreateItem("Exit")
TrayItemSetOnEvent(-1,"Terminate")

TraySetState()

While 1
    Sleep ( 10 )
WEnd

Func Terminate()
    Exit
EndFunc

Func Display()
    If TrayItemGetState($displayitem) = $TRAY_CHECKED Then
        TrayItemSetState($displayitem, $TRAY_UNCHECKED)
    Else
        TrayItemSetState($displayitem, $TRAY_CHECKED)
    EndIf
EndFunc

Func Printer()
    If TrayItemGetState($printeritem) = $TRAY_CHECKED Then
        TrayItemSetState($printeritem, $TRAY_UNCHECKED)
    Else
        TrayItemSetState($printeritem, $TRAY_CHECKED)
    EndIf
EndFunc

Func About()
    Msgbox(64,"about:","AutoIt3-Tray-sample")
EndFunc


SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

Share this post


Link to post
Share on other sites

ok so i gotta work around on that one. crap.

thanks tho!

Share this post


Link to post
Share on other sites

oh and to make the buttons also respond to being unchecked use:

BitAnd(TrayItemGetState($itemname), $TRAY_CHECKED)

#include <Constants.au3>
#NoTrayIcon
Opt("TrayMenuMode",9)  ; Default tray menu items (Script Paused/Exit) will not be shown.
Opt("TrayOnEventMode",1)

$settingsitem   = TrayCreateMenu("Settings")
$displayitem    = TrayCreateItem("Display", $settingsitem, -1, 1)
TrayItemSetOnEvent(-1,"Display")
$printeritem    = TrayCreateItem("Printer", $settingsitem, -1, 1)
TrayItemSetOnEvent(-1,"Printer")
TrayCreateItem("")
$aboutitem  = TrayCreateItem("About")
TrayItemSetOnEvent(-1,"About")
TrayCreateItem("")
$exititem     = TrayCreateItem("Exit")
TrayItemSetOnEvent(-1,"Terminate")

TraySetState()

While 1
    Sleep ( 10 )
WEnd

Func Terminate()
    Exit
EndFunc

Func Display()
    If BitAnd(TrayItemGetState($displayitem),$TRAY_CHECKED) Then
        TrayItemSetState($displayitem, $TRAY_UNCHECKED)
    Else
        TrayItemSetState($displayitem, $TRAY_CHECKED)
    EndIf
EndFunc

Func Printer()
    If BitAnd(TrayItemGetState($printeritem), $TRAY_CHECKED) Then
        TrayItemSetState($printeritem, $TRAY_UNCHECKED)
    Else
        TrayItemSetState($printeritem, $TRAY_CHECKED)
    EndIf
EndFunc

Func About()
    Msgbox(64,"About:","AutoIt3-Tray-sample")
EndFunc

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