[comp.sys.amiga.tech] Updating Intuition menus

jbwaters@bsu-cs.UUCP (J. Brian Waters) (01/31/89)

I am trying to figure out what the best way to add a config script to a program
with intuition menus would be...  the problem is how to handle menus that have
the mutual exclusion field set.  Since intuition already has the code to change
the check marks to reflect a new setting I would like to try and use its code
rather then having to set up a bunch of loops that clear the checked bit.  Is
this possible?  In effect I would like to create a fake menu event in my
program to itself.  I do not think I can use the input device as I want this to
work even when my programs window in not the active window.  

If it is possible to do this,  would it be possible to create a general set
of routines (ie FakeMenu(*window, event),  FakeKeypress(*window, event) etc)
that would handle the task of faking an input event to another program.  If so
I think this would make an interesting way for one program to control another.

If none of this is possible,  what it the standard way of changing menus to 
reflect defaults changeable by either menus or other events.... is it just
setting up a loop to clear the appropriate CHECKED bits?  Does the menu have
to be removed while the bits are reset?

-- 
Brian Waters              <backbone>!{iuvax|pur-ee}!bsu-cs!jbwaters
                                          uunet!---/

nsw@cord.UUCP (Neil Weinstock) (02/01/89)

In article <5513@bsu-cs.UUCP> jbwaters@bsu-cs.UUCP writes:
[ ... ]
>this possible?  In effect I would like to create a fake menu event in my
>program to itself.  I do not think I can use the input device as I want this to
>work even when my programs window in not the active window.  
>
>If it is possible to do this,  would it be possible to create a general set
>of routines (ie FakeMenu(*window, event),  FakeKeypress(*window, event) etc)
>that would handle the task of faking an input event to another program.  If so
>I think this would make an interesting way for one program to control another.

Hmm. This seems too simple to be correct, but why not just format a MENUPICK
IntuiMessage and send it to the IDCMP port of the window in question?  The
only potential problem would be deallocating the message, since if you
CloseWindow()ed before replying to that message then Intuition would 
deallocate your message, which might be a bad thing.  However, if you always 
reply to all your IDCMP messages before CloseWindow()ing, then I can't foresee 
any problems at all.

 /.- -- .. --. .- .-. ..- .-.. . ... .- -- .. --. .- .-. ..- .-.. . ...\
/ Neil Weinstock | att!cord!nsw     | "One man's garbage is another     \
\ AT&T Bell Labs | nsw@cord.att.com | man's prune danish." - Harv Laser /
 \.- -- .. --. .- .-. ..- .-.. . ... .- -- .. --. .- .-. ..- .-.. . .../