MariusN Posted February 23, 2010 Posted February 23, 2010 (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 February 23, 2010 by MariusN
MariusN Posted February 23, 2010 Author Posted February 23, 2010 I managed to come right...tiaSorry 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
Moderators Melba23 Posted February 23, 2010 Moderators Posted February 23, 2010 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. M23 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 columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area
MariusN Posted February 23, 2010 Author Posted February 23, 2010 (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. M23I 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 February 23, 2010 by MariusN
Moderators Melba23 Posted February 23, 2010 Moderators Posted February 23, 2010 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. M23 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 columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area
MariusN Posted February 23, 2010 Author Posted February 23, 2010 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. M23Thanks Melba23...Now i feel better...I have a timerdiff there
Moderators Melba23 Posted February 23, 2010 Moderators Posted February 23, 2010 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 Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now