[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

2598.0. "Pulldown child of Pulldown getting clipped" by CSC32::B_KEMP (I just answer the phone) Wed Apr 11 1990 18:28

     The following program shows how a pulldown menu widget that is 
parented by another pulldown menu widget(eg. a 'pullright' menu) gets
clipped by the right edge of its parent.  Under VMS 5.1/DW 1.0, it did
not get clipped. Now it does.  The second pulldown has another pushbutton
put in it dynamically each time it is mapped and everytime it is clipped.

     Any Ideas?

---Bill


/**
**
**
**  FILENAME:  test.c
**      
**
**
**  ABSTRACT:  This is an example code of the pullright entry 
**                         that is created dynamically -- does not work
**                         on VMS V5.3 but does under V5.1.
**      
**      Error --
**                        when you activate the pullright entry the menu that
**                        pops-up appears to be the size of the pulldown-entry
**                        widget
**
**
********
**
**      This is an example and definitely has limitations.
**  
********
**
**      How To Use :
**
**      The window that comes up has a pulldown entry called 'Pushme'.
**      if you push and hold it down you get a pullright entry 'PushMe'
**  The pullright contains a push-button entry "Graphics Window".
**      ( create dynamically )
**
**
********
**      
**
**
**--
*******************************************************************************/

                          
#ifdef    VMS
#include <decw$include:DECWDwtWidgetProg.h> /* VMS DECWindow toolkit */
#define DECHINTS
#include <decw$include:Vendor.h>
#include <decw$include:cursorfont.h>
#undef DECHINTS
#else 
#include <X11/DECwDwtWidgetProg.h> /* Ultrix DECWindow toolkit */
#include <X11/Vendor.h>
#include <X11/cursorfont.h>
#endif /* VMS     */
               
#ifdef    BSD
#include <strings.h>
#else
#include <string.h>
#endif /* BSD */

#define NULLPTR(a)    ( (a *)0 ) 

         
void
exit_me(widget,tag,callback)  
        Widget  widget;
        int tag;  
    DwtAnyCallbackStruct *callback;
{
    XCloseDisplay ( XtDisplay(widget)) ;
    exit(0);
}
   
XWait()
{                 
    XtMainLoop();
}               
          
Widget                                 
Mapit(parent,tag,c)
    Widget  parent;       
    int     tag;
        int *c;
{
    Arg args[10];       
    int num_args=0;

        num_args=0;
        XtSetArg(args[num_args],DwtNlabel,DwtLatin1String("Graphics window"));
        num_args++;
        XtManageChild(DwtPushButtonGadgetCreate(parent,"exit",args,num_args));
}         

Widget                                 
MakeMenu(parent,args,num_args)
    Widget      parent;       
    ArgList     args;
    int     num_args;
{
        Widget widget;  
    Widget pd;
            
    int inx=0;
    Arg arglist[3];

    widget = (Widget)DwtMenuPulldownCreate(parent,
                                  "pulldown",
                                  args,
                                  num_args);

    XtSetArg (arglist[inx], DwtNspacing      , 5);inx++;
    XtSetArg (arglist[inx], DwtNmenuPacking  , DwtMenuPackingColumn);inx++;
    XtSetValues (widget, arglist, inx);               
    inx=0;
    XtSetArg (arglist[inx], DwtNsubMenuId    , widget);inx++;
    pd = DwtPullDownMenuEntryCreate (parent,            
                                   "PushMe",
                                   arglist,
                                   inx);


                                                      
    XtManageChild(pd); /* let parent know of child */

    return (widget);

} /* end of MakeMenu() */

                                                     
#define DEF_X   100
#define DEF_Y   200
#define DEF_W   300
#define DEF_H   400

/******************************************************
 *                      X-initialization Program
 ******************************************************
 */

main(argc,argv)
int argc;
char  *argv[];
{
                  
    int inx=0;                         
    Widget toplevel        = (Widget)NULL;  /* toplevel widget   */
    Widget main_widget,
           menu_bar,
           m_entry,
           m_entry2,
           exit;
    Arg args[10];       
    int num_args=0;
    DwtCallback ok_callback[2];  
    DwtCallback map_cb[2];  
 
               
    /*    
     * toolkit initialization ( open display, etc. )
     */
        if (  (toplevel = XtInitialize("test","Test",
                                NULL, 0, &argc, argv))  == (Widget)NULL )
        return ( FALSE );

        map_cb[0].proc = Mapit;
        map_cb[0].tag = 0;

    main_widget     = DwtMainWindow(toplevel,"example",DEF_X,DEF_Y,DEF_W,DEF_H);

    menu_bar        = DwtMenuBarCreate(main_widget,"menu_bar",NULL,0);
    m_entry         = MakeMenu(menu_bar,args,num_args);
        num_args=0;
        XtSetArg ( args[num_args],DwtNmapCallback,map_cb);num_args++;
    m_entry2        = MakeMenu(m_entry,args,num_args);

        num_args=0;
        XtSetArg ( args[num_args],DwtNlabel,DwtLatin1String("Graphics window"));
num_args++;
        exit  = DwtPushButtonGadgetCreate(m_entry,"exit",args,num_args);

    XtManageChildren (DwtChildren(main_widget),
                          DwtNumChildren(main_widget));   
    XtManageChildren (DwtChildren(m_entry),
                          DwtNumChildren(m_entry));   
    XtManageChild(main_widget);               

    XtRealizeWidget(toplevel);   
    XWait();
    
}
T.RTitleUserPersonal
Name
DateLines
2598.1Pulldown child of Pulldown getting clippedRTL::JUNEThu Apr 12 1990 15:2622
  This effect is the result of a bug in the popup menu toolkit code.  The
  bug, which causes the menu and its shell parent to get out of synch as
  far as size is concerned, only manifests itself under the following 
  conditions:

	1. A pulldown menu is created and realized with no children. 
	2. Children are then added in the menu's map callback.

  There are two easy workarounds:

        1. Make sure the pulldown menu has at least one child at
           realization time, or

        2. Instead of using the pulldown menu's map callback to change 
           its contents, use the pulling callback on its corresponding
           pulldown menu entry.  This callback is triggered "early enough"
           to avoid the problem you're seeing, and in fact one of the
           major reasons for this callback's existence is to provide for
           deferred submenu creation.

  We plan to fix this bug in V3.