English Amiga Board

English Amiga Board (http://eab.abime.net/index.php)
-   Coders. System (http://eab.abime.net/forumdisplay.php?f=113)
-   -   Top menu - toggle selection (http://eab.abime.net/showthread.php?t=108945)

peceha 22 November 2021 20:05

Top menu - toggle selection
I will be doing this in blitz but the question is about intuition so here it goes:
How to change the state of MENUTOGGLE item without using top menu?

I have few windows in my program and I have a top menu with a list of these windows (with a checkmark indicating if the window is open or not).
I want the checkmark to be gone when I close the window with CLOSE GADGET.

So far the only idea that came to my mind is to reproduce the whole menu:

..here I edit the toggle state of the entry I want in my menu

Is there a simpler way?

thomas 23 November 2021 09:47

1 Attachment(s)
Normally you would maintain the flags of the MenuItem. The NewMenu array is only needed for the initial creation of the menu strip. After that you can throw it away.

Attached is a full example.

One challenge is to find the address of the item you want to manipulate in the menu strip. The example uses ItemAddress with a fixed menu number. In a more complex example I would rather write a function which traverses the menu strip and finds the item with the corresponding code in the user data field. This way I am independent of menu changes in later versions.

peceha 23 November 2021 11:18

Thanks thomas - all is clear now, will apply this in the afternoon.

All times are GMT +2. The time now is 02:05.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2022, vBulletin Solutions Inc.

Page generated in 0.04280 seconds with 11 queries