how to "check" a entry in a statusiconmenu

Matthias Rebbe matthias_livecode_150811 at m-r-d.de
Thu May 2 17:06:53 EDT 2013


Hi Paul,

thanks for your suggestions. I don´t think i can adapt this for the statusiconmenu, but thanks anyway. I will 
store your code for future use  when i need option menus.

Regards,

Matthias

Am 02.05.2013 um 17:04 schrieb Paul Hibbert <lc at pbh.on-rev.com>:

> Hi Mattias,
> 
> Not too sure this will help, but I came up against a similar problem with option menus on Win, so figured out a way to do what I needed by code, maybe you can adapt this for your use…
> 
> ==Code==
> 
> local sHist,sMenuText,sLabel
> 
> on mouseDown
>   lock screen -- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Stops the label momentarily changing on mouseDown
>   put the menuHistory of me into sHist -- ~~~~~~~~~~~~~~ So we know where we are coming from
>   put the label of me into sLabel --  ~~~~~~~~~~~~~~~~~~ So we can re-use it later
>   put the text of me into sMenuText --  ~~~~~~~~~~~~~~~~ So we can manipulate it later
> end mouseDown
> 
> on menuPick pItemName
>   if char 1 of pItemName = "*" then  -- ~~~~~~~~~~~~~~~~~ Check to see if the user chose a disabled item
>      lock messages --  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ So we can control the outcome without unexpected results
>      set the menuHistory of me to sHist -- ~~~~~~~~~~~~~~ Returns the menuHistory back to the required state
>      set the label of me to sLabel --  ~~~~~~~~~~~~~~~~~~ Give the user correct feedback
>      unlock messages
>      exit menuPick -- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Don't need to go any further
>   else
>      replace "*" with "" in sMenuText -- ~~~~~~~~~~~~~~~~ Remove any previous choice
>      put word 2 of the selectedLine of me into tLine -- ~ Identify the new choice
>      put "*" before line tLine of sMenuText -- ~~~~~~~~~~ Mark the new choice
>      set the text of me to sMenuText -- ~~~~~~~~~~~~~~~~~ Update the Menu Text
>      set the menuHistory of me to tLine -- ~~~~~~~~~~~~~~ Update the menuHistory
>      set the label of me to pItemName -- ~~~~~~~~~~~~~~~~ Give the user some feedback
>   end if
>   unlock screen
>   answer pItemName -- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Now we can do something with the user choice
> end menuPick
> 
> ==End Code==
> 
> Paul
> 
> On 2013-05-02, at 3:45 AM, Matthias Rebbe wrote:
> 
>> Hi,
>> 
>> for an app in Windows i am using the StatusIconMenu feature, which works really well.
>> But i would like to place a checkmark or an icon before an entry in that menu.
>> 
>> Is this possible? Tried with the special character "!c" to get the entry displayed as checked. But that did not
>> work. Maybe i am doing something wrong. 
>> 
>> Any idea?
>> 
>> Regards,
>> 
>> Matthias
>> _______________________________________________
>> use-livecode mailing list
>> use-livecode at lists.runrev.com
>> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
>> http://lists.runrev.com/mailman/listinfo/use-livecode
> 
> 
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode





More information about the use-livecode mailing list