[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

1104.0. "Positioning pull downs within a menu bar question" by ACESPS::WALTON (Meat is Dead.) Thu Jul 13 1989 10:47

    If you are using low-level DECwindows calls and have a menu bar with,
    say, 5 pull down menus in it, is there an easy way to place two of the
    pull downs on the right side of a menu bar and the others on the left
    side?

    What I want is an effect like that of putting "Help" on the right side
    like you see in lots of DECwindows applications.

    I think I could do this by setting the DwtNmenuPacking attribute to
    DwtNmenuPackingNone  and specifying the x and y positions of the pull
    down menus.  The problem with this is that the number of pull down
    menus that appear in the menu bar is VARIABLE.  So to properly set the
    x and y's would require some computation.  I was hoping the widget
    would do this for me.

    Thanks in advance,    Dave

T.RTitleUserPersonal
Name
DateLines
1104.1The plot thickens . . .ACESPS::WALTONZPG: a chance for the futureMon Jul 17 1989 15:1924
    Well, since I haven't gotten a response I guess that there is no easy 
    way to get two pull down menus on the right side of a menu bar.

    But. . .

    We tried to skirt around the problem like this (by the way I'm asking
    this for a ISV that I'm supporting):

    We created an attached dialog box and gave it two menu bars as
    children.  The menu bars are attached so that the first one shows up on
    the left and the second one follows on the right.  This sort of gives
    us the effect the ISV programmer wants. 

    But. . . 

    The menu bars won't resize! They are simply clipped when the main
    window is resized. AARRRGG!

    The Attached dialog box is set to DwtResizeShrinkWrap which I thought
    meant that the box would grow when its children requested it.
     
    Could someone help me , Please?

1104.2sorry for taking so longKOBAL::SCAERMon Jul 17 1989 19:055
	There's a resource on a menubar for placing a menu on the right
	side.  Its called 'menu_help_widget' and it takes a menu as its
	value.

1104.3Only good for one.ACESPS::WALTONZPG: a chance for the futureTue Jul 18 1989 10:3010
   
     Thanks for the suggestion but menu_help_widget is only good for one menu
     entry.  I would like to be able to have two or three entries right 
     justified.

     I think using two menu bars in an attached dialog box would work fine
     if I could get the dialog box to honor resize requests from the menu
     bars.
                                                       Dave

1104.4A sample of ADB UIL code...AITG::WILSONTue Jul 18 1989 15:1457
	What kind of attachment constraints are you using ?

	In the past I've created a popup attached dialog box where I attached
a menu bar to it and the menu bar appropriately resized with the dialog.  Here's
a UIL code fragment:


object edutil_window : popup_attached_db {
        arguments {
                title = DX_K_EDUTIL_TITLE;
                width = 500;
                height = 300;

                no_resize = false;      /* provide a resize icon */

                default_horizontal_offset = 10;
                default_vertical_offset = 10;
                };

        controls {
                menu_bar        edutil_menu_bar;
                label           edutil_label;
                simple_text     edutil_text;
                };
        };

object edutil_menu_bar : menu_bar {
        arguments  {
                orientation = DwtOrientationHorizontal;
                spacing = 30;  ! pixels between menu items
                menu_help_widget = pulldown_entry edutil_help_entry;

                adb_top_attachment = DwtAttachAdb;
                adb_top_offset = 0;
                adb_left_attachment = DwtAttachAdb;
                adb_left_offset = 0;
                adb_right_attachment = DwtAttachAdb;
                adb_right_offset = 0;
                };


        controls  {
                pulldown_entry  edutil_file_entry;
                pulldown_entry  edutil_edit_entry;
                pulldown_entry  edutil_execute_entry;
                pulldown_entry  edutil_help_entry;
                };
        };


	In your case, where you want to keep the right side of the left
menu attached with the left side of the right menu (got that ? :-) ) perhaps
you could try something like DwtAttachPosition and specify the left/right
position of the menu bars' edges here.  Just a suggestion off the top of
my head, I've never tried two menu bars at once.

1104.5I'll show you mine. . .ACESPS::WALTONZPG: a chance for the futureTue Jul 18 1989 16:1773
    Re: .4

    I don't think its the attachments that are the problem.  It sort of
    seems that the problem is the attached dialog box, I see you are using
    a popup attached dialog box.

    Heres what my UIL looks like.
                                             


object
    s_adbox : attached_dialog_box  {
        arguments {
            resize = DwtResizeShrinkWrap;        
            width = 500;
            height = 30;
        };

        controls {                              
            menu_bar s_menu_bar;
            menu_bar s_menu_bar2;
        };
        callbacks {
            create = procedure create_proc (k_adbox);
        };
    };

object
    s_menu_bar : menu_bar widget {
        arguments {
         
            adb_top_attachment = DwtAttachAdb;
            adb_top_offset = 0;
            adb_left_attachment = DwtAttachAdb;
            adb_left_offset = 0;
            orientation = DwtOrientationHorizontal;
            spacing     = 15;                   ! Pixels between items in menu
        };

        controls {                              
            pulldown_entry file_menu_entry;
            pulldown_entry edit_menu_entry;
            pulldown_entry order_menu_entry;    
        };
        callbacks {
            create = procedure create_proc (k_menu_bar);
        };
    };

object
    s_menu_bar2 : menu_bar widget {
        arguments {
            adb_top_attachment = DwtAttachAdb;
            adb_top_offset = 0;
            adb_left_attachment = DwtAttachWidget;      !The important 
            adb_left_widget = menu_bar s_menu_bar;      ! ones.
            adb_left_offset = 10;
            adb_right_attachment = DwtAttachAdb;
            adb_right_offset = 0;
            orientation = DwtOrientationHorizontal;
            spacing     = 15;                   
        };

        controls {                              
            pulldown_entry daves_menu_entry;
        };
        callbacks {
            create = procedure create_proc (k_menu_bar2);
        };
    };


1104.6Here's a sleazy idea...GOSOX::RYANDECwindows MailWed Jul 19 1989 08:088
	This probably won't work, I suspect that the menu bar insists on
	pulldown menu entry children, but...

	You could try creating a second menu bar with the menus you want
	"right-justified", and setting *that* as the menu_help_widget...

	Mike

1104.7I'm lostACESPS::WALTONZPG: a chance for the futureWed Jul 19 1989 13:4919
    Okay, now I'm really confused. 

    I changed my attached dialog box to a popup attached dialog box just
    like in reply 4. Then I had it use just one menu.  It still won't
    resize!  Something is screwy.

    I even added a label and a simple text widget to mke it look axactly
    like the example.  I knew this was grasping at straws but I thought I'd
    try.  It didn't help.

    I must be missing something.

    By the way, in answer to reply 6, you were right Mike it didn't work.
    The menu bar widget will not accept anothe menubar as its child. 


                                                 Dave

1104.8Popup ADB seems to do what you wantAITG::WILSONWed Jul 19 1989 14:5282
Re .7:

	Could you explain what you mean when you say "it won't resize" ?
Simple question, but are you specifying "no_resize = false" as below so
that you get a resize control in your dialog ?

	I really don't know what is causing you problems.  I took your
idea from .4 and added it to my code.  This got something reasonably close
to the behavior you want.  I found that when I resized the dialog box,
one of the menu bars would resize with it while the other would remain fixed
in size, just large enough to enclose its pulldown entry children.  I found
that the menu bar that resized was the one in which I specified the attachment
to the end of the other menu bar, so I reversed your order, specifying the end-
to-end constraint in the left menubar; this way, the right menu bar remains
fixed in size, keeping its items to the right relative to the dialog box as
you want.

	What is it that you fetch from UIL ?  Is it the attached dialog box
itself, or does it have a parent like a main window ?  Perhaps parenting
it under a main window might help (just a guess here).

	Here's my modified code:


object edutil_window : popup_attached_db {
	arguments {
		title = DX_K_EDUTIL_TITLE;
		width = 500;
		height = 300;

		no_resize = false;	/* provide a resize icon */

		default_horizontal_offset = 10;
		default_vertical_offset = 10;
		};

	controls {
		menu_bar	second_menu_bar;  !! <<<- note the order !!!
		menu_bar	edutil_menu_bar;
		label		edutil_label;
		simple_text	edutil_text;
		};
	};

object edutil_menu_bar : menu_bar {
	arguments  {
		orientation = DwtOrientationHorizontal;
		spacing = 30;  ! pixels between menu items

		adb_top_attachment = DwtAttachAdb;
		adb_top_offset = 0;
		adb_left_attachment = DwtAttachAdb;
		adb_left_offset = 0;
		adb_right_attachment = DwtAttachWidget;
		adb_right_widget = menu_bar second_menu_bar;
		adb_right_offset = 10;    !! per the code in .4 - why not 0 ?
		};

	controls  {
		pulldown_entry	edutil_file_entry;
		pulldown_entry	edutil_edit_entry;
		};
	};

object second_menu_bar : menu_bar {
	arguments  {
		orientation = DwtOrientationHorizontal;
		spacing = 30;  ! pixels between menu items

		adb_top_attachment = DwtAttachAdb;
		adb_top_offset = 0;
		adb_right_attachment = DwtAttachAdb;
		adb_right_offset = 0;
		};

	controls  {
		pulldown_entry	edutil_execute_entry;
		pulldown_entry	edutil_help_entry;
		};
	};

1104.9PSW::WINALSKICareful with that VAX, EugeneWed Jul 19 1989 15:477
RE: .3

Two right-justified menu items isn't style guide conformant.  You shouldn't be
doing this.

--PSW

1104.10What I mean is .ACESPS::WALTONZPG: a chance for the futureWed Jul 19 1989 16:0114
    Re: .8

    When I say "it wont resize" I mean that both the menu bars are clipped 
    horizontally if I resize the dialog box to be so skiny that all the 
    menu entries wont fit.  What I want is for them to grow vertically as
    I've seen them do on other applications.

    The attached dialog box that I'm using doesn't have a parent, I'll try
    it a parent.

    Thanks for the help.

    Dave

1104.11LEOVAX::TREGGIARIWed Jul 19 1989 17:158
The main window widget is the only widget that knows how to properly deal
with a menu bar (i.e. make it wrap when it should, etc...).  You should
create a popup shell, with a main window widget child, with the menu
bar as the child of that.  As far as the two items on the right hand
side go, I can't think of anything that will do that for you.

Leo

1104.12You can't always get what you wantACESPS::WALTONZPG: a chance for the futureThu Jul 20 1989 16:1510
    Okay, So it looks like I can either use the dialog box with two
    menu bars and live without the menu entry "wrapping."  Or I can conform
    to the style guide and be happy with just the help menu on the right.

    Not the answer I was hoping for but at least its an answer.

    Thanks for all the help!!!
                                         Dave