FLTK logo

Re: [fltk.general] Re: Updating program to 1.4.x

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 
 All Forums  |  Back to fltk.general  ]
 
Previous Message ]New Message | Reply ]Next Message ]

Re: Re: Updating program to 1.4.x Ian MacArthur May 24, 2021  
 
On 24 May 2021, at 19:47, Rob McDonald wrote:
> 
> I have an extension of Fl_Button to support drag-n-drop.  I do this...
> 
> int MyButton::handle(int event)
> {
>   int ret = Fl_Button::handle(event);
>   switch ( event ) {
>     case FL_DRAG:
>       if( callback() )
>       {
>         do_callback();
>       }
>       ret = 1;
>       break;
> 
>     default:
>       break;
>   }
>   return ret;
> }
> 
> So the Fl_Button do_callback() is wired up to capture FL_DRAG.  The callback gets passed along to my class that contains the pointer to the MyButton...  We'll call that a ButtonHolder.  It handles the event with this code...
> 
> void ButtonHolder::DeviceCB( Fl_Widget* w )
> {
>   if ( w == m_Button ) // m_Button is the pointer to the MyButton
>   {
>     switch ( Fl::event() ) {
>       case FL_DRAG:
>         Fl::copy( m_Foo.c_str(), m_Foo.size(), 0 );
>         Fl::dnd();
> 
>         break;
> 
>       case FL_RELEASE:
>         if( Fl::event_inside( w ) )
>         {
>           // Do something else.
>         }
> 
>         break;
> 
>       default:
>         break;
>     }
>   }
> } 
> 
> The problem is -- every time a FL_DRAG event is started, the FL_RELEASE event immediately triggers (even before a button release).  This only happens on MacOS, it does not happen on Windows.  This code worked fine on 1.3.X.
> 
> Any ideas why Clicking and holding (drag hasn't even started) on MacOS would trigger a Release event?


Can you put together a minimal (complete) example that shows the behaviour?
I’m having trouble putting it all together in my head...

Like... when exactly does DeviceCB() get called, and why does it call Fl::event() rather than, say, being passed the current event of interest? In particular I’m concerned that what Fl::event() is returning here might not actually be the event of interest, if it is being called in the wrong context, say...

Or something else.


-- 
You received this message because you are subscribed to the Google Groups "fltk.general" group.
To unsubscribe from this group and stop receiving emails from it, send an email to fltkgeneral+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/fltkgeneral/D5B6A6C4-2F1A-4BFE-88D9-0BD1F7824D4B%40gmail.com.
Direct Link to Message ]
 
     
Previous Message ]New Message | Reply ]Next Message ]
 
 

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'.