[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

2927.0. "LIST_BOX_WIDGET with a list of problems...." by BACHUS::RIJMENANTS (Dirk Rijmenants) Thu Jun 14 1990 05:05

Hi,

   The program below demonstrates some anoying problems with the listbox
   widget under v53...

     1) Single select doesn't always work...
        Extend select (shift+select) some items and then do a
        single (normal) select on the last item selected... the callback
        reason still is.... extend  (btw worked fine under 5.2)

     2) Select context sensitive help on any lit box (help+btn1)
        the items get larger, but the scroll bar is not adjusted...

     3) The area of an item that can be used to select an item is
        very limited on v53... on v52 the whole line could be used,
        is there a way to get this behaviour back ??


  Anyway thanks in advance for any reply...


                                  Dirk.

================================================================================

#include <stdio.h>
#include <decw$include:DwtAppl.h>

static Widget top_level_widget;
static Widget list_box_widget;
static Arg arglist[99];
static int arglist_count;
static DwtCompString items[99];
static int item_count;

static void list_box_callback(Widget w,
                              caddr_t client_data,
                              DwtListBoxCallbackStruct *callback_struct)
{
    static int help_called =0;
    switch (callback_struct->reason)
    {
         case DwtCRExtend:
              printf("list_box_callback with reason=%d DwtCRExtend\n",callback_struct->reason);
              break;
/*
         case DwtCRExtendConfirm:
              printf("list_box_callback with reason=%d DwtCRExtendConfirm\n",callback_struct->reason);
              break;
*/
         case DwtCRSingle:
              printf("list_box_callback with reason=%d DwtCRSingle\n",callback_struct->reason);
              break;
/*
         case DwtCRSingleConfirm:
              printf("list_box_callback with reason=%d DwtCRSingleConfirm\n",callback_struct->reason);
              break;
*/
         case DwtCRHelpRequested:
              printf("list_box_callback with reason=%d DwtCRHelpRequested\n",callback_struct->reason);
              for (item_count = 0; item_count < 20; ++item_count)
              { 
                   char buffer[256];
                   sprintf(buffer,"Item %s%d\n",(help_called== 0) ?"":"\n",item_count);
                   items[item_count] = DwtLatin1String(buffer);
              }
              arglist_count = 0;
              XtSetArg (arglist[arglist_count], DwtNitems, items);++arglist_count;
              XtSetArg (arglist[arglist_count], DwtNitemsCount, item_count);++arglist_count;
              XtSetArg (arglist[arglist_count], DwtNselectedItemsCount, 0);++arglist_count;
              XtSetValues (list_box_widget, arglist,arglist_count);
              ++help_called;
              break;
         default:
              printf ("list_box_callback with reason=%d\n",callback_struct->reason);
              break;
    }
}
main(int argc,char **argv)
{
    top_level_widget = XtInitialize ("bug","Bug",NULL,0,&argc,argv);
    for (item_count = 0; item_count < 20; ++item_count)
    {
         char buffer[256];
         sprintf (buffer, "Item %d                               ",item_count);
         items[item_count]=DwtLatin1String(buffer);
    }
         arglist_count =0;
         XtSetArg (arglist[arglist_count],DwtNsingleSelection,FALSE);++arglist_count;
         XtSetArg (arglist[arglist_count],DwtNvisibleItemsCount,10);++arglist_count;
         XtSetArg (arglist[arglist_count],DwtNwidth,200);++arglist_count;
         XtManageChild (list_box_widget= DwtListBoxCreate(top_level_widget,"ListBox",arglist,arglist_count));
         XtAddCallback (list_box_widget,DwtNsingleCallback,list_box_callback,NULL);                       
         XtAddCallback (list_box_widget,DwtNsingleConfirmCallback,list_box_callback,NULL);                       
         XtAddCallback (list_box_widget,DwtNextendCallback,list_box_callback,NULL);                       
         XtAddCallback (list_box_widget,DwtNextendConfirmCallback,list_box_callback,NULL);                       
         XtAddCallback (list_box_widget,DwtNhelpCallback,list_box_callback,NULL);                       

         arglist_count = 0;
         XtSetArg (arglist[arglist_count], DwtNitems, items);++arglist_count;
         XtSetArg (arglist[arglist_count], DwtNitemsCount, item_count);++arglist_count;
         XtSetArg (arglist[arglist_count], DwtNselectedItemsCount, 0);++arglist_count;
         XtSetValues (list_box_widget, arglist,arglist_count);

         XtRealizeWidget (top_level_widget);
         XtMainLoop ();
}
T.RTitleUserPersonal
Name
DateLines