[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

1280.0. "Translation Tables, Mouse Button 1 & Enter_Events" by LARVAE::WOOD_J () Tue Aug 15 1989 14:59

Translation Tables, Mouse Button 1 & Enter_Events
    
A customer is creating his own icons, using work_area_menus. The work_area_menu
controls a label, which is a pixmap. The icons are displayed in a main_window.

The problem has been reduced to this. The application wants to know when the
mouse is being moved into/out of an icon, WHEN mouse button 1 is down. This
should be achievable by setting the translation table ( "Button1<Enter> :
do_enter_proc()" etc.).

The results we are experiencing are as expected when Mouse Button 1 is
depressed OUTSIDE of any window, and the cursor is moved through an icon.
However, if MB1 is depressed IN ANY window, and then the cursor moved to an
icon, nothing happens!

Is this because Button-1 Down is being handled specially? 

We've tried doing XtParseTranslationTable & XtOverrideTranslations on the
parent window and the icons - to no avail.

The next replies contain the sources to this problem (.C and .UIL). Two icons
are built: the left one responds to the cursor passing through it when the
SHIFT key is held down. The right icon should respond to Mouse Button 1 &
cursor passing through!

I'd be grateful for any suggestions. If this is a known bug, is there a
work-around?

T.RTitleUserPersonal
Name
DateLines
1280.1C source for 1280.0LARVAE::WOOD_JTue Aug 15 1989 15:0161
    	/* KERNIX_ORIG.C - to test MB1 & Enter_Events */
                                               
    #include "decw$include:dwtappl.h"

#define IMS_X11_REGISTER_ACTION(n, p, act) \
   ( (act).string = (String) (n), (act).proc = (XtActionProc) (p) )

   unsigned int main (unsigned int argc, char *argv)
   {
   DRMType widget_class;
   DRMHierarchy DRM_id;
   Widget shell_widget;
   Widget widget;
   static char *file_name[]={"kernix_orig.uid"};
   void Enter_event ();
   void Leave_event ();
   XtActionsRec actions[2];

   DwtInitializeDRM ();

   shell_widget = XtInitialize (
      "KERNIX",                                      /* Icon name             */
      "keRNIX",                                      /* root class name       */
      NULL,                                          /* options list          */
      0,                                             /* number of options     */
      &argc,                                         /* number of command pars*/
      argv);                                        /* command parameters    */

   DwtOpenHierarchy (
      1,					     /* Number of UID files   */
      file_name,				     /* Array of file names   */
      0,
     &DRM_id);                                      /* Returned DRM handle   */
 
   IMS_X11_REGISTER_ACTION ("Enter_event", Enter_event, actions[0]);
   IMS_X11_REGISTER_ACTION ("Leave_event", Leave_event, actions[1]);

   XtAddActions (actions, (Cardinal) 2);

   DwtFetchWidget
      (DRM_id,
       "KERNIX_APPLICATIONS_WINDOW",
       shell_widget,
      &widget,
      &widget_class);

   XtManageChild (widget);
   XtRealizeWidget (shell_widget);
   XtMainLoop ();
   }

   void Enter_event (Widget widget, XEvent *event)
   {
   printf ("Enter event\n");
   }

   void Leave_event (Widget widget, XEvent *event)
   {
   printf ("Leave event\n");
   }

1280.2UIL source for 1280.0LARVAE::WOOD_JTue Aug 15 1989 15:03157
    	/* KERNIX_ORIG.UIL - to test MB1 & Enter_Events... */
    
    module kernix_ui

   version      = 'V1.0'
   names        = case_sensitive

   include file 'DwtAppl.uil' ;

list								       !4 
   icon_menu_translations :					       !4 
      arguments							       !4 
         {							       !4 
         translations = translation_table			       !4 
            (							       !4 
            'Shift<Enter>         : Enter_event()',		       !10
            'Shift<Leave>         : Leave_event()'		       !10
            );							       !4 
         };							       !4 
								       !4 
list								       !4 
   other_translations :					       !4 
      arguments							       !4 
         {							       !4 
         translations = translation_table			       !4 
            (							       !4 
            'Button1<Enter>         : Enter_event()',		       !10
            'Button1<Leave>         : Leave_event()'		       !10
            );							       !4 
         };							       !4 
								       !4 
value								       
	g1_yellow	: color ('yellow',    foreground);	       !10
	g1_lightblue	: color ('lightblue', background);	       !9 

value
	g1_icon_ct	: color_table				       !10
                              ( g1_yellow           = 'o',	       !10
			        g1_lightblue        = '.',	       !10
				background color    = ' ' );	       !10

value
	g1_icon_pixmap : icon (color_table = g1_icon_ct,	       !10
		'oooooooooooooooooooooooooooooooo',  		       
		'o..............................o',  		       
		'o..............................o',  		       
		'o..............................o',  		       
		'o..............................o',  		       
		'o..............................o',  		       
		'o..............................o',  		       
		'o..............................o',  		       
		'o..............................o',  		       
		'o..............................o',  		       
		'o..............................o',  		       
		'o..............................o',  		       
		'o..............................o',  		       
		'o..............................o',  		       
		'o..............................o',  		       
		'o..............................o',  		       
		'o..............................o',  		       
		'o..............................o',  		       
		'o..............................o',  		       
		'o..............................o',  		       
		'o..............................o',  		       
		'o..............................o',  		       
		'o..............................o',  		       
		'o..............................o',  		       
		'o..............................o',  		       
		'o..............................o',  		       
		'o..............................o',  		       
		'o..............................o',  		       
		'oooooooooooooooooooooooooooooooo'); 		       

object KERNIX_APPLICATIONS_WINDOW : main_window
   {
   arguments 
      {
      border_width = 0 ;
      x            = 100 ;
      y            = 200 ;
      width        = 0   ;
      height       = 0   ;
      } ;

   controls 
      {                 
      scroll_window   A0_APPLICATIONS_SCROLL_WINDOW ;		       !9 
      } ;
   } ;

!--------------------------(SCROLL WINDOW)--------------------------------------

object A0_APPLICATIONS_SCROLL_WINDOW : scroll_window		       !9 
   {
   arguments
      {
      border_width          = 0 ;
      width                 = 700 ;
      height                = 350 ;
      } ;
   controls
      {
      work_area_menu KERNIX_ICON;
      work_area_menu KERNIX_OTHER_ICON;
      };

   } ;

   object KERNIX_ICON : work_area_menu				       !10
      {
      arguments
         {							       
         x            = 1;					       
         y            = 1;					       
         border_width = 0;
         spacing      = 1;						        
         arguments      icon_menu_translations;			         
         };							       !9 
								        
      controls							        
         {							        
         label icon_pixmap;
         };							        

      };							        
								        
								        
   object KERNIX_OTHER_ICON : work_area_menu				       !10
      {
      arguments
         {							       
         x            = 50;					       
         y            = 1;					       
         border_width = 0;
         spacing      = 1;						        
         arguments      other_translations;			         
         };							       !9 
								        
      controls							        
         {							        
         label icon_pixmap;
         };							        

      };							        
								        
								        
   object icon_pixmap : label				       !10
      {								        
      arguments							        
         {							        
         label_label_type = DwtPixmap;				        
         label_pixmap     = g1_icon_pixmap;			       !10
         };							        
      };    							        
								        
end module;

1280.3More Information...LARVAE::REILLY_GGerryFri Aug 18 1989 05:2718
    More information on this problem...
    
    After some experiments, what seems to be really happenning is that
    only the widget that saw the button1 down event ever sees the button1
    down <enter> and <leave> events, until button1 is released.  The
    effect being that even though other widgets have the button1 down
    <enter> and <leave> in their translation tables they do not see
    the event if the pointer is moved with the button1 still depressed.
    
    The problem that still remains is that the customer does want other
    widgets, additional to the one that was the button1 down, to see
    the later <enter>'s and <leaves>'s.  My guess is that the initial
    widget does something with grabbing the pointer and therefore is
    the only one that see later events.  If this is the case, can a
    grab be associated with a group of widget, rather just one.  If so,
    how ?
                            

1280.4LEOVAX::TREGGIARISun Aug 20 1989 21:2116
>    My guess is that the initial
>    widget does something with grabbing the pointer and therefore is
>    the only one that see later events.  If this is the case, can a
>    grab be associated with a group of widget, rather just one.  If so,
>    how ?
    
    Close, but the problem is that the SERVER initiates a grab by default
    when the button is pressed (read a protocol or Xlib manual for
    details...).  If what you are looking for is to allow the button
    to go down anywhere inside the work area menu, then you need to
    catch button 1 down and call XUngrab"something-or-other"
    (where I think "something-or-other" is "Pointer", but I don't
    have a manual with me).
    
    Leo