Jump to content

TrayCreateItem


MariusN
 Share

Recommended Posts

Hi folks...I have nice tray functions but need some help here. Everything works 100%...no prob. What i would like to know is, is there a number associated with the little "tick" mark that gets enabled/shown in the tray?

(ie enabled "tick" = 1, disabled "tick" = 2)

...this way i can always use an IF function...

Thing is, i want an item to be ENABLED when the "tick" shows , and when the "tick" is off, the item must be DISABLED!.

At the moment i have 2 function as can be seen below including my settings

$aboutitem = TrayCreateItem("Check")
$state = TrayItemGetState ($aboutitem)
$exititem = TrayCreateItem("Exit")


TraySetState()
While 1

    $MSG = TrayGetMsg()
    Select
        Case $MSG = 0
            ContinueLoop
        Case $MSG = $aboutitem
            If $state = 1 Then
                MsgBox(0, "", "button Checked")
            Else
                MsgBox(0, "","Un-checked")
            EndIf
        Case $MSG = $exititem
            Exit
    EndSelect
WEnd
Edited by MariusN
Link to comment
Share on other sites

  • Moderators

MariusN,

I cannot imagine why it would "eat memory". But when I do something like this, I would use a "State" flag to track the current state of the TrayItem and then only use TrayItemSetState if it needed changing. :mellow:

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

MariusN,

I cannot imagine why it would "eat memory". But when I do something like this, I would use a "State" flag to track the current state of the TrayItem and then only use TrayItemSetState if it needed changing. :mellow:

M23

I hear you Melba23, but the reason for me putting it in the "while wend" loop, is because it actually reads "info" from an INI file...as certain numbers change(in the .ini file), so does the "tick" in the traymenu...

PS: what i actually meant by "eating memory" is using cpu resources...sorry ...my mistake there..:(

Edited by MariusN
Link to comment
Share on other sites

  • Moderators

MariusN,

As long as your While...WEnd loop has either a GUIGetMsg() or at least a Sleep(10) in it you need not worry about CPU usage. Either one of those will leave enough CPU idle time for any other processes to run. :mellow:

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

MariusN,

As long as your While...WEnd loop has either a GUIGetMsg() or at least a Sleep(10) in it you need not worry about CPU usage. Either one of those will leave enough CPU idle time for any other processes to run. :mellow:

M23

Thanks Melba23...Now i feel better...I have a timerdiff there :(
Link to comment
Share on other sites

  • Moderators

MariusN,

A TimerDiff on its own does not help - you need either a GUIGetMsg() or a Sleep. Would you care to post your loop here so i can see?

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

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