gettingstarted
[Top] [All Lists]

Re: Menuitem autoenable

To: Getting Started <gettingstarted at lists dot realsoftware dot com>
Subject: Re: Menuitem autoenable
From: Phil M <phil at mobleybros dot com>
Date: Fri, 30 Sep 2005 11:56:54 -0700
Delivered-to: gettingstarted at lists dot realsoftware dot com
References: <6AB040BB-7E44-41A3-885B-C2595F4E7767 at menssana dot to dot it>
On Sep 30, 2005, at 11:05 AM, Fabio Soggia wrote:

I'm sorry, this is maybe very simple, but I don't understand
If I start a new desktop project there is an app class, a default window and a menubar. So I add an editfield in the window and I run the project. I can copy and paste because menuitems are enabled. If I change the text of a menuitem to my language (copy to copia, paste to incolla) and I run the project, it is not enabled. So, what is the check autoenabled for?

It used to be that MenuItems had to be enabled in the "EnableMenuItems" event. Now with the AutoEnable option, MenuItems will be automatically enabled if there is a MenuHandler for the menu.

Since the EditField class implements handlers for "Edit", "Copy", "Paste", "Cut" and in REALbasic 2005 "Select All" those menu items are automatically enabled when the EditField has the focus.

If you want to enable the "Copy" menu item in the Window, then you add a menu handler and select the Copy MenuItem name from the list (usually it is "EditCopy"). Only unused menu handlers will be displayed in the list, so if you add another menu handler, then "EditCopy" would not be available on the list (it is already being handled).

If you add the "EditCopy" menu handler to the Window, and the EditField has the focus then the EditField behavior takes over. This is because the EditField is returning "True" from the menu handler which means "I handled this event so nobody else needs to." If the EditField does not have the focus, then the next available object which handles "EditCopy" will be called... and you decide in the handler if you are going to handle it or not (with Return True or Return False). Ultimately the App class is the final place that can handle the MenuItem, and Menu Handlers that are described in the App class will always be enabled if the AutoEnable property is checked.

_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>

<Prev in Thread] Current Thread [Next in Thread>