Article View: comp.os.os2.programmer
Article #351Re: Modifying Menu Items in OS/2? (probelm)
From: Barry King
Date: Tue, 11 Aug 1992 07:02
Date: Tue, 11 Aug 1992 07:02
38 lines
2205 bytes
2205 bytes
mdonalds@monu6.cc.monash.edu.au (Michael Donaldson) writes: > > Does anyone out there know how to modify menu items, in OS/2's PM? In Window > you can use the ModifyMenu(hMenu, nPosition, wFlags, wlDNewItem, lpNewItem) > to not only change the state (activated, de-activated), but also the actual > text. This is the particular problem: > > I want to change the text string of one of the menu items. To > do this I must be able to retrieve the actual string for that > menu item. I can not find a way how to do this... > > This can be done in a couple of ways depending upon what information you have available. The basic flow is: -get a window handle to the menu -get the id of the menuitem -send a WM_SETITEMTEXT to the menu with the id and the text If you already know the id of the menu item it is fairly easy - use the basic steps outlined above. If you do not know the id then you must use the MM_QUERYITEMCOUNT message and then successive WM_ITEMIDFROMPOSITION to get the item id, then MM_QUERYITEMTEXT to get the text. When you've found the menu item you want to change (by comparing the menu item text to a known value) you can set it by using a MM_SETITEMTEXT message. This all sounds terribly complicated but isn't really too horrible. There may be 'helpers' for this task but it is fairly straightforward to write a small generic routine to emulate the Windows equivalent. Browse through the PMWIN.H and see if there is something hidden in there that accomplishes this. Hope this helps. Barry King bking@ersys.edmonton.ab.ca Edmonton Remote Systems: Celebrating 10 years of service to Northern Alberta
Technical Details
Message-ID:
<eRyBPB2w164w@ersys.edmonton.ab.ca>Path:
arc1-ca.pugleaf.net!sparky!uunet!usc!sol.ctr.columbia.edu!destroyer!ubc-cs!unixg.ubc.ca!kakwa.ucs.ualberta.ca!ersys!bkingReferences:
<1992Aug10.143156.16042@monu6.cc.monash.edu.au>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!usc!sol.ctr.columbia.edu!destroyer!ubc-cs!unixg.ubc.ca!kakwa.ucs.ualberta.ca!ersys!bking From: bking@ersys.edmonton.ab.ca (Barry King) Newsgroups: comp.os.os2.programmer Subject: Re: Modifying Menu Items in OS/2? (probelm) Keywords: OS/2, Menu, Programming Message-ID: <eRyBPB2w164w@ersys.edmonton.ab.ca> Date: Tue, 11 Aug 92 01:02:49 MDT References: <1992Aug10.143156.16042@monu6.cc.monash.edu.au> Organization: Edmonton Remote Systems #1, Edmonton, AB, Canada Lines: 38