Go to Google Groups Home
Groups 
Advanced Groups Search    Groups Help 
 
Groups search result 2 for UCmenu os/2

Search Result 2
From: Larry Margolis (margoli@ibm.net)
Subject: Re: change EPM toolbar dynamically
Newsgroups: comp.os.os2.programmer.tools
View: Complete Thread (7 articles) | Original Format
Date: 1996/08/15
In <4umi3r$bel$1@mhade.production.compuserve.com>, Christian Mitterbauer <100066.467@CompuServe.COM> writes:
>I'm trying to dynamically add buttons to the EPM toolbar (EPM 6.03 fro
>OS/2 DevCon).
>
>But my problem is that I don't know the name of the active toolbar.

The toolbar name is 'Toolbar' if you're using the built-in
default menu, and irrelevant otherwise.  (The universal variable
toolbar_loaded is set to \1 if you're using the built-in toolbar,
and it's set to the name of the saved toolbar if you're using a
toolbar saved in your EPM.INI.)  The name passed to BuildSubMenu
(the value of activeucmenu when building the default toolbar) is
just a tag used to distinguish between various menus you can
build; when you do a ShowMenu, the EPM-built structure is
converted to the appropriate structure used for the actionbar,
pop-up menu, toolbar, etc., depending on the value of the second
parameter to ShowMenu.  In the case of the toolbar, the
User-Configurable Menu (UCMENU) code in ETKUCMS.DLL can accept
the structure from EPM, can build it dynamically, and can save it
to and load it from the EPM.INI file.  If it loaded it directly
from the .INI file, then there's no macro-built structure for you
to fool with.

>But when I create a new toolbar, EPM will no
>fill this variable and when I try to add a button with buildsubmenu, a
>toolbar will be created instead of adding the button to the current on

If you create the toolbar from the macros, then it should work;
if you create it using the Toolbar pop-up menu, then I don't know
if there's any way to query the UCMENU code for what it's active
menu structure is.

>I use this kind of code in my e-macro to add the buttons:

Well, here's some sample code if you want to create the toolbar
completely from the macros:

defc loadtb    -- I don't like the built-in default; here's mine:
   universal activeucmenu, toolbar_loaded
   if activeucmenu = 'Toolbar' then  -- Already used, delete it to be safe.
      deletemenu activeucmenu
   else
      activeucmenu = 'Toolbar'
   endif
   buildsubmenu activeucmenu,  1, "#Msgs#1100#a_Messages##sampactn", '', 0, 0
   buildsubmenu activeucmenu,  2, '', '', 16401, 0  -- MIS_SPACER
   buildsubmenu activeucmenu,  3, "#Add New#1101#a_Add_New##sampactn", '', 0, 0
   buildsubmenu activeucmenu,  4, "#Open#1102#a_Open_empty##sampactn", '', 0, 0
   buildsubmenu activeucmenu,  5, "#NewWind#1103#a_NewWindow##sampactn", '', 0, 0
   buildsubmenu activeucmenu,  6, "#Settings#1104#a_Settings##sampactn", '', 0, 0
   buildsubmenu activeucmenu,  7, "#Shell#1109#a_Shell##sampactn", '', 0, 0
   buildsubmenu activeucmenu,  8, '', '', 16401, 0  -- MIS_SPACER
   buildsubmenu activeucmenu,  9, "#KwdHilit#1126#a_togl_hilit##sampactn", '', 0, 0
   buildsubmenu activeucmenu, 10, "#MonoFont#1106#a_MonoFont##sampactn", '', 0, 0
   showmenu activeucmenu, 3
   toolbar_loaded = \1  -- "Built-in"

defc addtb  -- Sample command to add a button to the toolbar defined above
   universal activeucmenu, toolbar_loaded
   activeucmenu = 'Toolbar'
   buildsubmenu activeucmenu, 11, "#OS/2 win#os2win.bmp#cmd_os2win##commands", '', 0, 0
   showmenu activeucmenu, 3

defc deltb  -- Sample command to delete the Settings button from the toolbar defined above
   universal activeucmenu, toolbar_loaded
   activeucmenu = 'Toolbar'
   deletemenu activeucmenu, 7, 0, 0
   showmenu activeucmenu, 3

>Another question I have, where are the internal PM messages documented
>that are used within the EPM macros (e.g. # 5916).

The EFRAME ones don't appear to be publicly documented; 5916 is
EFRAMEM_LOADUCMTEMPLATE, which loads a UCMENU template from the
INI file.  (This might be documented as part of the UCMENU code,
which I believe went out on DevCon.)  Basically, you post msg
5916 to the edit frame, with MP1 = the handle to the .INI file
and MP2 = a pointer to a buffer containing the name of the
toolbar to be loaded.  The toolbar is actually saved under the
application UCMenu_Templates, key = toolbar name.

>Many thanks in advance

You're welcome.  :-)

--
Larry Margolis, margoli@ibm.net


Google Home - Advertise with Us - Add Google to Your Site - News and Resources - Language Tools - Jobs, Press, Cool Stuff...

©2002 Google