English Amiga Board


Go Back   English Amiga Board > Coders > Coders. System

 
 
Thread Tools
Old 22 November 2021, 20:05   #1
peceha
Registered User

peceha's Avatar
 
Join Date: Dec 2017
Location: Poland
Age: 45
Posts: 274
Top menu - toggle selection

Hi,
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:

ClearMenuStrip()
FreeMenus()
..here I edit the toggle state of the entry I want in my menu
CreateMenusA()
LayoutMenusA()

Is there a simpler way?
Thanks
peceha is online now  
Old 23 November 2021, 09:47   #2
thomas
Registered User
thomas's Avatar
 
Join Date: Jan 2002
Location: Germany
Posts: 6,401
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.
Attached Files
File Type: c gtmenu.c (4.1 KB, 11 views)
thomas is online now  
Old 23 November 2021, 11:18   #3
peceha
Registered User

peceha's Avatar
 
Join Date: Dec 2017
Location: Poland
Age: 45
Posts: 274
Thanks thomas - all is clear now, will apply this in the afternoon.
peceha is online now  
 


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Similar Threads
Thread Thread Starter Forum Replies Last Post
WinUAE 4.3.0 - Toggle fullscreen problem thyslo support.WinUAE 4 29 December 2019 14:52
Toggle between screen formats pushead support.FS-UAE 1 08 August 2019 13:21
fullscreen toggle on mac crashdog support.FS-UAE 11 09 April 2016 13:06
scalos/wb top menu _psy project.ClassicWB 3 03 January 2011 14:32
Toggle Magic Mouse smoorke support.WinUAE 1 14 June 2009 11:04

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 18:25.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2021, vBulletin Solutions Inc.
Page generated in 0.08659 seconds with 16 queries