marking active menu items

Hernan Tylim htylim at yahoo.com.ar
Thu Jan 19 01:11:48 UTC 2006


To mark items on a menu in a disabled state this is what I use:

(not tested)

| menu |
menu := MenuMorph new.
menu add: aTitle target: anObject selector: aSelector
menu lastItem isEnabled: false

the #isEnabled: method is the one used when you type into a menu and 
some items gets temporarily disabled. Note that because of this, if you 
type into a menu and then delete the typing everything will get 
reenabled, even your  manually disabled items, thus this isn't a perfect 
solution either (But I doubt that there is one, short of modifying 
MenuMorph and/or MenuItemMorph to support this kind of usage).

BTW, you can disable the preference that gives keyboard focus to menus. 
Look into the preference panel for it.

Hope it helps

Regards,
Hernán

Ralph Boland wrote:

> I need to create a menu in which the selectable items (MenuItemMorphs)
> are sometimes active and sometimes inactive. 
> For inactive items nothing is done when they are selected from the menu.
>
> Currently, I plan to indicate the difference by using a line 
> (MenuLineMorph)
> to separate the items into two groups with the active items above.
> I consider this to be a poor solution for various reasons.  I wonder 
> if anyone can propose
> a better solution and preverably a more standard solution to this 
> problem.
> The simpler and more portable the solution the better.
>
> Currently, I am using Squeak  3.6.  I will soon be porting to  3.7 so 
> I can use a Squeak 3.7 solution.
> Porting to 3.8 has been delayed because displaying a method in the 
> debugger
> displays the wrong text in a method.  The displayed text is off by one 
> character for each assignment
> operator preceding the displayed text. 
> (The displayed text is the text of the current message send in the 
> method)
>
> I am using the Linux version of Squeak.
>
> Thanks
>
> Ralph Boland
>
>------------------------------------------------------------------------
>
>
>  
>





More information about the Squeak-dev mailing list