[Search for users] [Overall Top Noters] [List of all Conferences] [Download this site]

Conference bulova::decw_jan-89_to_nov-90

Title:DECWINDOWS 26-JAN-89 to 29-NOV-90
Notice:See 1639.0 for VMS V5.3 kit; 2043.0 for 5.4 IFT kit
Moderator:STAR::VATNE
Created:Mon Oct 30 1989
Last Modified:Mon Dec 31 1990
Last Successful Update:Fri Jun 06 1997
Number of topics:3726
Total number of notes:19516

2093.0. "Which menu bar to use?" by TOWNS::RUFFIEUX () Sat Jan 20 1990 21:42

    
    
    I am writing an application in which the main window's menu bar can
    take one of two forms:
    
        -  If the user does not have privilege, the menu bar will contain
           four items.
    
    	-  If the user has a certain privilege (in the application not
    	   VMS) the menu bar will contain the four items of a regular
    	   user plus an additional four.
    
    I was wondering if anyone could recommend a good way to implement this.
    A test has already been set up to determine the type of user.  I just
    need to know the best way to get the proper menu bar up there.  I had
    it set up so the UIL contained the four items that both users get and
    then if the user was priv, I called a routine that created the other
    four items.  The problem with this is that the menu items would
    appear on the menu bar but none of the children, (pulldowns and buttons)
    were working.  I also tried defining two different menu bars in uil
    and managing the proper one.  The problem with this is that the menu
    bar is no longer a child of the toplevel and when I manage it, it does
    not appear on the main window. (it appears first and gets covered up).
    
    Any suggestion,comments,answers will be greatly appreciated...
    
    
    Thank you,
    
    Chris
    
    
    
                                                         
T.RTitleUserPersonal
Name
DateLines
2093.1ULTRA::WRAYJohn Wray, Secure Systems DevelopmentSun Jan 21 1990 00:266
    I can't help with the problems you've been experiencing, but an
    alternative approach would be to have all the options always on the
    menu-bar, but have the privileged ones greyed-out (Sensitive=False)
    when the application is invoked by an unprivileged user.
    
    John
2093.2Still searching???TOWNS::RUFFIEUXSun Jan 21 1990 01:239
    re .1
    
    Thanks, I know this is an option. I would still like to know if
    anyone has any other ideas...
    
    
    Thanks,
    
    Chris
2093.3easy in UIL, declare unmanaged and Manage them laterRTL::OBRYANWhen in doubt, let the user decide.Sun Jan 21 1990 05:0159
re:.0

As you've recognized, there are two ways to go here: declare things unmanaged
and manage them as needed, or delay creation until needed.

Let's look at the easiest one to program (the unmanaged approach.) Here is
a sample menu bar declared in UIL

    test_MenuBar	: menu_bar 
    {
	arguments
	{
	    orientation = DwtOrientationHorizontal;
	    help_widget = pulldown_entry test_Help_Entry;
	};
	controls
	{
	    pulldown_entry	test_File_Entry;
	    unmanaged pulldown_entry	test_Edit_Entry;	!*
	    unmanaged pulldown_entry	test_Customize_Entry;	!*
	    pulldown_entry	test_Help_Entry;
	};
    }; ! test_MenuBar


    test_Edit_Entry	: pulldown_entry 	! The other entries are
    {						! similarly declared
	arguments
	{
	    label_label = k_tst_test_Edit_Entry_str;
	};
	controls
	{
	    pulldown_menu
	    {
		controls
		{
		    push_button	test_Cut_Btn;
		    push_button	test_Paste_Btn;
		    separator	gnc_Sep;
		    push_button	test_selall_Btn;
		};
	    };
	};
	callbacks
	{
	    create = procedure tst_create_proc (k_tst_test_Edit_Entry);
	};
    }; ! test_Edit_Entry

In the segment of code in which you have determined that the two invisible
Entries need to become visible, simply XtManageChild each of the (saved)
Entry widget ids.  This particular approach also has the advantage that the
two mystery Entries will appear positioned in the menu_bar where you desire
them.  (Menu_bar places them in the order they were created, with the exception
of the designated "help_widget" which always is positioned last.)


2093.4Got it..TOWNS::RUFFIEUXSun Jan 21 1990 15:155
    re. 3
    
    	Thanks alot.  That is what I needed!
    
    	Chris