Sign in to follow this  
Followers 0
MariusN

TrayCreateItem

8 posts in this topic

#1 ·  Posted (edited)

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

Share this post


Link to post
Share on other sites



I managed to come right...tia

Share this post


Link to post
Share on other sites

I managed to come right...tia

Sorry guys, just one question...the function "TrayItemSetState"...can it reside inside a loop?

I have tried it with great success, but i'm just scared it will eat memory...

tia

Share this post


Link to post
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


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______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

 

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

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

Share this post


Link to post
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


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______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

 

Share this post


Link to post
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 :(

Share this post


Link to post
Share on other sites

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


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______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

 

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