PFC Guide Titlebar
HomeFAQLinksPFCMAGExtensionsDownloadWhat's NewSearch

PFC Menu FAQ


Table of Contents

  1. How do I display a single toolbar for both Sheet and Frame menus?

How should I set up my PFC menus?

Contributed by Sharon Buntz

As you may well know, menus are PowerBuilder's weak spot. Therefore, in general...

So listen to the advice of the Powersoft PFC instructors (and Steve Benfield) who understand these considerations well...

Take a "Two-Tier" approach with your PFC Menus

1. Create a new application master menu:

Copy the pfc_m_master (File/Save As) to your own say m_xxx_master

(Add all needed menu options across the application here;
All future menu options should go here, too.)

2. Create a new application frame menu:

Then create/inherit m_xxx_frame from m_xxx_master

3. Create your new application sheet menus:

Then, for every sheet you may create/inherit m_xxx_sheet_x from m_xxx_master (every sheet gets his own menu object)

(Basically, only disable/make invisible menu options down here)

So the final look at the structure is...

Whenever you add a new menu item, make the new menu item a default of visible/enabled as would be the case for most of the menus...

Then, at the lower level, tweak it a different way as appropriate. But, remember that even if you do not technically have to tweak the new menu option at the lower level, the lower level _is_still_affected_ by a new/changed/deleted menu option. So regen each menu at a minimum afterwards.

If you ever delete/rename/move around menu items in an ancestor menu object, open each descendent afterwards and save each one. Then also regen each window that uses those menus.

Back to Top

How do I display a single toolbar for both Sheet and Frame menus?

One of the side-effects of setting the ToolbarSheetTitle and ToolbarFrameTitle is that if they are set to the same value only one toolbar will display at a time.  The Frame toolbar will display when there are no open sheets and the sheet toolbar when there is at least one open sheet.

Note: This approach will only work if the code is placed in the first few lines of the script! 

Right:

// Make sure only one toolbar is visible
this.ToolbarSheetTitle = "Toolbar"
this.ToolbarFrameTitle = "Toolbar"

gnv_app = create n_cst_appmanager
gnv_app.event pfc_open( commandline )

 

Wrong:

gnv_app = create n_cst_appmanager
gnv_app.event pfc_open( commandline )


// Make sure only one toolbar is visible
this.ToolbarSheetTitle = "Toolbar"
this.ToolbarFrameTitle = "Toolbar"

Back to Top

Contributed by PFCGuide staff, except where noted otherwise.
PFCGuide is sponsored by Dynamic Technology Group
The information provided is for advice only and not to be considered a contract or a liability against Dynamic Technology Group.

Last revised: February 15, 2004 03:58 AM.