🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.os.os2.programmer
Article #676

Creating Menus Dynamically

#676
From: Barry King
Date: Sun, 12 Apr 1992 10:18
32 lines
1694 bytes
Could someone educate me as to the proper dynamic creation of pulldown 
menus?
 
Here's what I've tried:
 
1) create a window using WinCreateWindow, WC_MENU class, parent and owner 
are the frame window, NULL ctl data, FID_EMNU as resource id.  Send 
MM_INSERTITEM messages to add menu items, send WM_UPDAATEFRAME with 
WC_MENU as mp1.

  This causes a Trap D (?) of all things - haven't chased it down yet as 
  to why it traps...
 
2) Create in-memory menu resource using _MT and _MTI structures, call 
WinCreateMenu, and send WM_UPDATEFRAME etc.
 
  This works but is _very_ tedious to create/manage the menu template.
 
3) create NULL in-memory menu resource and make successive MM_INSERTITEM 
calls to build the menu. 
 
  This doesn't appear to work.  It simply does nothing even though valid
  (apparently) window handles are created.  I trap now and then after
  MM_INSERTITEM but even this doesn't happen reliably.  I would think 
  that this method should work.  WinGetLastError returns no error in the
  creation of the menu (WinCreateMenu).  Same with scenario 1.
 
Any ideas?
 

Barry King              bking@ersys.edmonton.ab.ca
Edmonton Remote Systems:  Celebrating 10 years of service to Northern Alberta
Technical Details
Message-ID: <q554iB1w164w@ersys.edmonton.ab.ca>
Path: arc1-ca.pugleaf.net!sparky!uunet!haven.umd.edu!ames!agate!spool.mu.edu!wupost!micro-heart-of-gold.mit.edu!uw-beaver!ubc-cs!alberta!ugc!ersys!bking

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!haven.umd.edu!ames!agate!spool.mu.edu!wupost!micro-heart-of-gold.mit.edu!uw-beaver!ubc-cs!alberta!ugc!ersys!bking
From: bking@ersys.edmonton.ab.ca (Barry King)
Newsgroups: comp.os.os2.programmer
Subject: Creating Menus Dynamically
Message-ID: <q554iB1w164w@ersys.edmonton.ab.ca>
Date: 12 Apr 92 10:18:01 GMT
Article-I.D.: ersys.q554iB1w164w
Organization: Edmonton Remote Systems, Edmonton, AB, Canada
Lines: 32