Who's Online
49 user(s) are online (
18 user(s) are browsing
Forums )
Members: 0
Guests: 49
more...
Headlines
a_little_remember_game.lha - game/misc
Oct 31, 2024
legadon.lha - utility/text
Oct 30, 2024
wipeout-re_fe-data.zip - game/driving
Oct 29, 2024
wipeout-re_fe.lha - game/driving
Oct 29, 2024
amiarcadia.lha - emulation/gamesystem
Oct 28, 2024
rvncd.lha - network/server
Oct 28, 2024
mce.lha - game/utility
Oct 27, 2024
nblood.lha - game/fps
Oct 25, 2024
amissl-sdk.lha - development/misc
Oct 24, 2024
amissl.lha - library/misc
Oct 24, 2024
Topic options
View mode
Newest First
[Solved] Updating newmenu
Posted on:
2009/5/20 10:29
#1
Supreme Council
Joined: 2006/11/16 19:25Last Login
: Yesterday 19:16
From Sweden
Group:
Webmasters Moderators Staff members Staff members Moderators Staff members Staff members
Is there something like ResetMenuStrip() for newmenues ? I need to enable/disable menu entries on the fly.
Edited by orgin on 2009/5/20 14:33:00
Vacca foeda. Sum, ergo edo Mr Bobo Cornwater
Re: Updating newmenu
Posted on:
2009/5/20 11:25
#2
Just can't stay away
Joined: 2006/11/30 11:30Last Login
: Yesterday 21:32
From Finland
Group:
Registered Users
@orgin Why not use OnMenu()/OffMenu()? I use these functions in AmiSoundED.
Re: Updating newmenu
Posted on:
2009/5/20 12:48
#3
Supreme Council
Joined: 2006/11/16 19:25Last Login
: Yesterday 19:16
From Sweden
Group:
Webmasters Moderators Staff members Staff members Moderators Staff members Staff members
@salass00 Leads to a hard crash. What exactly am I supposed to put in the "menunumber" field?
Vacca foeda. Sum, ergo edo Mr Bobo Cornwater
Re: Updating newmenu
Posted on:
2009/5/20 12:52
#4
Amigans Defender
Joined: 2006/11/17 22:40Last Login
: 10/30 10:33
From England
Group:
Registered Users Moderators
@orgin FULLMENUNUM(menu,menuitem,subitem) From memory...
Re: Updating newmenu
Posted on:
2009/5/20 13:13
#5
Supreme Council
Joined: 2006/11/16 19:25Last Login
: Yesterday 19:16
From Sweden
Group:
Webmasters Moderators Staff members Staff members Moderators Staff members Staff members
@Chris Hmmf I see, extremely annoying, means I have to scan the entire menu tree several times to find all the items I need. Is there really no better way to do this? In comparison it seems easier to just iconify and deiconify the window. (the menus are remade when you do that)
Vacca foeda. Sum, ergo edo Mr Bobo Cornwater
Re: Updating newmenu
Posted on:
2009/5/20 13:19
#6
Supreme Council
Joined: 2006/11/16 19:25Last Login
: Yesterday 19:16
From Sweden
Group:
Webmasters Moderators Staff members Staff members Moderators Staff members Staff members
@orgin
WINDOW_NewMenu ( struct NewMenu *) Let window .class create and layout the menus for you . This is useful for iconification and screenchanges . Remember that the NewMenu array must be persistent because it will be referenced every time the window opens . Defaults to NULL . Applicability is ( OM_NEW , OM_SET , OM_UPDATE )
How does one invoke OM_UPDATE on a window?
Vacca foeda. Sum, ergo edo Mr Bobo Cornwater
Re: Updating newmenu
Posted on:
2009/5/20 13:52
#7
Amigans Defender
Joined: 2006/11/17 22:40Last Login
: 10/30 10:33
From England
Group:
Registered Users Moderators
@orgin RethinkLayout()? Might be a bit overkill. Why do you need to scan the entire menu tree? Chris
Re: Updating newmenu
Posted on:
2009/5/20 14:03
#8
Supreme Council
Joined: 2006/11/16 19:25Last Login
: Yesterday 19:16
From Sweden
Group:
Webmasters Moderators Staff members Staff members Moderators Staff members Staff members
@Chris The newmenu array is just a flat array. I do not want to index it directly since I change it a lot. Which means that I scan the array items for the correct userdata field to find the items I want to enable/disable. Using the mentioned define/macro means that I need to know which (sub)menu the item is in as well, which can change. Which basically means that I have to make my own tree structure out of the menu array so I can find which parent a certain item has. WM_RETHINK had no effect. RethinkLayout is intended for the gadget layout, not menu.
Vacca foeda. Sum, ergo edo Mr Bobo Cornwater
Re: Updating newmenu
Posted on:
2009/5/20 14:05
#9
Just can't stay away
Joined: 2006/11/30 11:30Last Login
: Yesterday 21:32
From Finland
Group:
Registered Users
@orgin You could obtain a pointer to the menu strip using: Object *window_obj; struct Menu *menu; GetAttr(WINDOW_MenuStrip, window_obj, (uint32 *)&menu); and then ClearMenuStrip(), make your menu changes and ResetMenuStrip().
Re: Updating newmenu
Posted on:
2009/5/20 14:08
#10
Supreme Council
Joined: 2006/11/16 19:25Last Login
: Yesterday 19:16
From Sweden
Group:
Webmasters Moderators Staff members Staff members Moderators Staff members Staff members
@salass00 Tried that, had no effect. I don't think that is related to newmenu but the old style menu.
Vacca foeda. Sum, ergo edo Mr Bobo Cornwater
Re: Updating newmenu
Posted on:
2009/5/20 14:25
#11
Amigans Defender
Joined: 2006/11/17 22:40Last Login
: 10/30 10:33
From England
Group:
Registered Users Moderators
@orgin MenuStrip is the old-style, but the GadTools functions convert from NewMenu to MenuStrip - Intuition only deals with MenuStrip. So if you grab the MenuStrip, update your NewMenu, you would then have to run it through the GadTools function (CreateMenu()?) to get the new MenuStrip, and re-apply it. Or you could just SetAttrs(WINDOW_NewMenu) and dispose the old one, ignoring MenuStrip entirely.
Re: Updating newmenu
Posted on:
2009/5/20 14:36
#12
Supreme Council
Joined: 2006/11/16 19:25Last Login
: Yesterday 19:16
From Sweden
Group:
Webmasters Moderators Staff members Staff members Moderators Staff members Staff members
@Chris
Thanks, this solved it:
int32 i = 0 ; while( Menu [ i ]. nm_Type != NM_END ) { if(( ULONG ) Menu [ i ]. nm_UserData == MENU_COPYAS || ( ULONG ) Menu [ i ]. nm_UserData == MENU_MOVEAS ) { Menu [ i ]. nm_Flags = NM_ITEMDISABLED ; } i ++; } IIntuition -> SetAttrs ( inst -> WinObj , WINDOW_NewMenu , Menu , TAG_DONE );
Vacca foeda. Sum, ergo edo Mr Bobo Cornwater
Re: Updating newmenu
Posted on:
2009/5/20 14:37
#13
Just can't stay away
Joined: 2006/11/30 11:30Last Login
: Yesterday 21:32
From Finland
Group:
Registered Users
@orgin You are modifying the menu strip and not new menu, right? If it's the latter you need to use SetAttrs() with WINDOW_NewMenu tag: Object *window_obj; struct NewMenu *newmenu; SetAttrs(window_obj, WINDOW_NewMenu, NULL, TAG_END); /* make changes to newmenu structures */ SetAttrs(window_obj, WINDOW_NewMenu, newmenu, TAG_END);
Re: [Solved] Updating newmenu
Posted on:
2009/5/20 14:52
#14
Just can't stay away
Joined: 2007/2/23 13:49Last Login
: 10/22 22:22
From Finland, the land of Santa, sauna, sisu and salmiakki
Group:
Registered Users
@orgin
Quote:
I need to enable/disable menu entries on the fly. I'm using this:
struct NewMenu MainMenu[]=
{
{ NM_TITLE,"Project",0,0,0,0 },
{ NM_ITEM,"About...","?",0,0,0 },
{ NM_ITEM,"Iconify","I",0,0,0 },
{ NM_ITEM,"Quit","Q",0,0,0 },
{ NM_END,NULL,0,0,0,0 }
};
enum
{
PROJECT_MENU
};
enum
{
MENU_ABOUT,
MENU_ICONIFY,
MENU_QUIT
};
IIntuition->OffMenu(MyWindow,FULLMENUNUM(PROJECT_MENU,MENU_ICONIFY,NOSUB)); // Iconify
IIntuition->OnMenu(MyWindow,FULLMENUNUM(PROJECT_MENU,MENU_ICONIFY,NOSUB)); // Iconify
No need to refresh or reset anything at all.
Rock lobster bit me - so I'm here forever X1000 + AmigaOS 4.1 FE "Anyone can build a fast CPU. The trick is to build a fast system." - Seymour Cray
Re: [Solved] Updating newmenu
Posted on:
2009/5/20 16:01
#15
Supreme Council
Joined: 2006/11/16 19:25Last Login
: Yesterday 19:16
From Sweden
Group:
Webmasters Moderators Staff members Staff members Moderators Staff members Staff members
@TSK I have several menus and I do not want to hard code which one an entry is in. So to find what menu an item is in means keeping track of the menus. Which is overkill just to refresh the menu. (I tried to explain all of this above but I guess it wasn't clear enough) But anyway, the issue is solved so unless it's not legal to do what I said earlier there's no need to find any other solution.
Vacca foeda. Sum, ergo edo Mr Bobo Cornwater
Re: [Solved] Updating newmenu
Posted on:
2009/5/20 18:00
#16
Just can't stay away
Joined: 2007/2/23 13:49Last Login
: 10/22 22:22
From Finland, the land of Santa, sauna, sisu and salmiakki
Group:
Registered Users
@orgin
Quote:
Why not use OnMenu()/OffMenu()? Quote:
Leads to a hard crash. What exactly am I supposed to put in the "menunumber" field? You said OnMenu and OffMenu were crashing so I showed an example only. (Looks like Chris answered already to you.)
Quote:
I have several menus and I do not want to hard code which one an entry is in. So, do you mean you're adding and removing menu items on the fly instead of just disabling and enabling them ???
Rock lobster bit me - so I'm here forever X1000 + AmigaOS 4.1 FE "Anyone can build a fast CPU. The trick is to build a fast system." - Seymour Cray
Re: [Solved] Updating newmenu
Posted on:
2009/5/20 18:16
#17
Supreme Council
Joined: 2006/11/16 19:25Last Login
: Yesterday 19:16
From Sweden
Group:
Webmasters Moderators Staff members Staff members Moderators Staff members Staff members
@TSK "So, do you mean you're adding and removing menu items on the fly instead of just disabling and enabling them ???" Nope.
Vacca foeda. Sum, ergo edo Mr Bobo Cornwater
Currently Active Users Viewing This Thread:
1
(
0 members
and 1 Anonymous Users
)