Le 08/03/2013 20:13, David FLEURY a écrit :
Hi,

I am using a Fl_Table_Row with SELECT_SINGLE mode (base on table exemple).

I did not succeed to have my callback called when the selection change
on mouse drag (the user keep the mouse down on a selected line and move
over the table to change the active selection).

Looking into Fl_Table.cxx around lines 861, when damage_zone is called,
there is no do_callback call.

How can my callback be called on selection change for my case ?

Regards,
David


I join a patch for a simple way to change this behaviour.
If someone has something better, I take it.
(patch over svn branch 1.3)

Regards,
David


Index: src/Fl_Table_Row.cxx
===================================================================
--- src/Fl_Table_Row.cxx        (revision 9833)
+++ src/Fl_Table_Row.cxx        (working copy)
@@ -271,7 +271,10 @@
           switch ( shiftstate ) {
             case FL_CTRL:
               if ( R != _last_row ) {          // toggle if dragged to new row
-                select_row(R, 2);              // 2=toggle
+                int hasChanged = select_row(R, 2);             // 2=toggle
+                if ( hasChanged == 1 && Fl_Widget::callback() && when() & 
FL_WHEN_CHANGED ) {
+                   do_callback(callback_context(), R, 0);              
+                }
               }
               break;
               
@@ -288,6 +291,11 @@
                   select_row(row, 1);
                 }
               }
+
+              if ( _last_row != R && Fl_Widget::callback() && when() & 
FL_WHEN_CHANGED ) {
+                 do_callback(callback_context(), R, 0);
+              }
+
               break;
           }
           ret = 1;                             // drag handled
_______________________________________________
fltk mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk

Reply via email to