Home > Archive > Clarion > May 2006 > Reference Menu Items from Child MDI
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
Reference Menu Items from Child MDI
|
|
| John Byrnes 2006-04-29, 6:55 pm |
| Hi,
I have a Child MDI that runs a critical process. During this process I want
to disable the menu items. However from within the child MDI I cannot seem
to reference the menu item. For example the standard File- Exit menu
command. The USE attribute is ?exit. I have tried all sort of combinations
but cannot reference it
Thanks John
| |
| wsteur@zonnet.nl 2006-04-30, 6:55 pm |
|
John Byrnes wrote:
> Hi,
>
> I have a Child MDI that runs a critical process. During this process I want
> to disable the menu items. However from within the child MDI I cannot seem
> to reference the menu item. For example the standard File- Exit menu
> command. The USE attribute is ?exit. I have tried all sort of combinations
> but cannot reference it
>
> Thanks John
| |
|
| Found elsewhere in this group:
What you need to do is to define your own events. Look in your
CW20\LIBSRC directory, in the EQUATES.CLW file. You will find that all
the events are listed here. You should also notice that those events
between
400h and 0fffh are user-definable ones.
In your Global Variables embed point you should define a new event:
EVENT:DisableMyMenuItem EQUATE(401h)
Next, you should really have a global variable holding the main
windows'
thread ID - It may not necessarily be 1. So, in your global variables,
set up
a new variable, say, G:MainThread LONG. In your main window
procedure, in the "Initialise the Procedure" embed point, insert:
G:MainThread = THREAD()
In your main window, in the "CASE EVENT Structure, before generated
code"
embed point, insert the following:
OF EVENT:DisableMyMenuItem
DISABLE(?MyMenuItem)
OF EVENT:EnableMyMenuItem
ENABLE(?MyMenuItem)
In your MDI procedure at the point where you want to disable the menu
item
use:
POST(EVENT:DisableMyMenuItem,,G:MainThre
ad)
Obviously, when you want to enable the menu item again, use:
POST(EVENT:EnableMyMenuItem,,G:MainThrea
d)
Note that using this approach you will have to define a new event for
every
group of menu items you want to disable, plus a new event when you want
to enable them.
| |
|
| John Byrnes wrote:
> Hi,
>
> I have a Child MDI that runs a critical process. During this process I want
> to disable the menu items. However from within the child MDI I cannot seem
> to reference the menu item. For example the standard File- Exit menu
> command. The USE attribute is ?exit. I have tried all sort of combinations
> but cannot reference it
>
> Thanks John
>
>
global data:
buttonfile LONG()
Main frame, after open:
buttonfile=?exit
Before opening your MDI
SETTARGET(,1)
DISABLE(buttonfile)
SETTARGET()
of course you should ENABLE it after your process is over
btw this is all legacy terminology
| |
|
| I have used the solution posted by krbo! I could not quite get the
equate working, but have not spent much time on it. Your solution does
provide for a wide range of posibilities and I have store in my help
notes. Thanks
| |
|
| I have used the above code, plus some ideas from Focus. Using a
variable to get the thread for the settarget is important. This code is
simple and effective (and quite obvious). Thanks very much.
|
|
|
|
|