Newsgroups: comp.windows.x
Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!magnus.acs.ohio-state.edu!zardoz.eng.ohio-state.edu!kcgl1.eng.ohio-state.edu!DAVISM
From: DAVISM@kcgl1.eng.ohio-state.edu (Michael T. Davis)
Subject: DECwindows option menu "default" value
Message-ID: <1991May13.231236.24262@zardoz.eng.ohio-state.edu>
Sender: news@zardoz.eng.ohio-state.edu (Usenet news)
Nntp-Posting-Host: kcgl1.eng.ohio-state.edu
Organization: The Ohio State University
Date: Mon, 13 May 1991 23:12:36 GMT


	I am using DECwindows under VAX/VMS V5.4-2 (i.e. DECwindows 2.0).  I
am trying to initialize an option menu such that it has a "default" value as
demonstrated/displayed in all the examples.  I am using DwtNmenuHistory to set
the value to a widget (gadget) id which is a child of the pull-down menu, whose
parent is the option menu (catch that ;-).  All I'm getting is a tiny rectangle
where the default value should be displayed.  Only when I hold MB1 in that rec-
tangle, do I see anything from the pull-down menu.  I am using a combination of
low-level and high-level routines to intialize the hierarchy, but no UIL.

	Here's some sample code:

    ...
    void my_proc(), my_other_proc();
    char * list [];
    int i, count;
    Arg arglist [5];
    DwtCallback callback [2];
    DwtCompString compound_string;
    Widget main_window, pd, * gadgets, om;
    ...
    pd = DwtMenuPulldownCreate ( main_window, "pull down", arglist, 0 );
    gadgets = ( Widget * ) calloc ( count + 2, sizeof ( Widget ) );
    callback [0]. proc = my_proc;
    callback [1]. proc = 0;
    for ( i = 0; i < count; i++ )
    {
        callback [0]. tag = i + 1;
        compound_string = DwtLatin1String ( list [ i ] );
        XtSetArg ( arglist [0], DwtNlabel, compound_string );
        XtSetArg ( arglist [1], DwtNactivateCallback, callback );
        gadgets [ i ] =
         DwtPushButtonGadgetCreate ( pd, NULL, arglist, 2 );
        XtFree ( compound_string );
    }
    gadgets [ count ] =
     DwtSeparatorGadgetCreate ( pd, NULL, arglist, 0 );
    callback [0]. proc = my_other_proc;
    callback [0]. tag = callback [1]. proc = 0;
    compound_string = DwtLatin1String ( "whatever" );
    XtSetArg ( arglist [0], DwtNlabel, compound_string );
    XtSetArg ( arglist [1], DwtNactivateCallback, callback );
    gadgets [ count + 1 ] =
     DwtPushButtonGadgetCreate ( pd, NULL, arglist, 2 );
    XtFree ( compound_string );
    compound_string = DwtLatin1String ( "something else" );
    XtSetArg ( arglist [0], DwtNx, 4 );
    XtSetArg ( arglist [1], DwtNy, 88 );
    XtSetArg ( arglist [2], DwtNlabel, compound_string );
    XtSetArg ( arglist [3], DwtNsubMenuId, pd );
    XtSetArg ( arglist [4], DwtNmenuHistory, gadgets [0] );
    om = DwtOptionMenuCreate ( main_window, "option menu", arglist, 5 );
    XtFree ( compound_string );
    XtManageChildren ( gadgets, count + 2 );
    XtManageChild ( om );
    ...

        I would appreciate any pointers.

                                                        Thanks,
                                                         Mike
 Internet: davism@kcgl1.eng.ohio-state.edu |
            -or- DAVISM+@osu.edu           |   These Thoughts, They Be Mine
   BITNET: DAVISM+@OHSTMAIL.BITNET         |
