FLTK logo

STR #3004

FLTK matrix user chat room
(using Element browser app)   FLTK gitter user chat room   GitHub FLTK Project   FLTK News RSS Feed  
  FLTK Apps      FLTK Library      Forums      Links     Login 
 Home  |  Articles & FAQs  |  Bugs & Features  |  Documentation  |  Download  |  Screenshots  ]
 

Return to Bugs & Features | Roadmap 1.3 | SVN ⇄ GIT ]

STR #3004

Application:FLTK Library
Status:1 - Closed w/Resolution
Priority:2 - Low, e.g. a documentation error or undocumented side-effect
Scope:3 - Applies to all machines and operating systems
Subsystem:Core Library
Summary:The class Fl_Check_Browser needs more correct the `int handle(int event)' method.
Version:1.3-current
Created By:kdiman
Assigned To:AlbrechtS
Fix Version:1.4.0 (SVN: v13138)
Update Notification:

Receive EMails Don't Receive EMails

Trouble Report Files:

No files


Trouble Report Comments:


Name/Time/Date Text  
 
#1 kdiman
23:12 Nov 14, 2013
When Fl_Check_Browser is processing event the FL_PUSH, it does not care about area for click, and if you clisk on an area of scrollbars - you get deselect current selection and select the last child of the browser...

Code below is deciding that problem (I have took it from #STR3003 Fl_Toggle_Browser)
(was changed `return Fl_Browser_::handle(e);' only):

[CODE=CPP]
 int handle(int e){
  
  switch(e){
   case FL_PUSH: {
    if ( Fl::event_button() == FL_LEFT_MOUSE ){
     int X, Y, W, H;
     int xx, yy, ww, hh, dx, dy;
     
     dx = Fl::box_dy(box())*2;
     dy = Fl::box_dy(box())*2;
     X=Fl::event_x(); Y=Fl::event_y();
     xx = x()+dx; yy = y()+dy; ww = x()+w()-(dx*2); hh = y()+h()-(dy*2);
     
     if(hscrollbar.visible()){ hh -= hscrollbar.h(); }
     if(scrollbar.visible()){ ww -= scrollbar.w(); }
     
     if(X >= xx && Y >= yy && X < ww && Y < hh){
      void *item = NULL;
      if((item = find_item(Fl::event_y())) != NULL){
       Fl_Browser_::select(item, !item_selected(item), 1);
       return 0;
      }
     }
    }
    break;
   }
   default: break;
  }
  
  return Fl_Browser_::handle(e);
 }
[/CODE]

--
The best regards.
 
 
#2 AlbrechtS
16:38 Nov 28, 2018
Fixed in Subversion repository.

I agree that the handle() method should check that the FL_PUSH event is inside the widget and not inside the scrollbars, but the given patch taken from STR #3003 is not correct.

The check can be simplified by using the Fl_Browser_::bbox() method and Fl::event_inside().

Committed in svn r13138.
 
     

Return to Bugs & Features ]

 
 

Comments are owned by the poster. All other content is copyright 1998-2024 by Bill Spitzak and others. This project is hosted by The FLTK Team. Please report site problems to 'erco@seriss.com'.