On 11/29/12 23:42, corvid wrote:
> I can't click on a deactivated item to select it, but I can select
> it with the space bar. (And then I remembered seeing ctrl-A in the
> source to select all, and that worked as well.)

        Hmm, I can't replicate that.

        If I run the test/tree demo compiled against the last
        patch, and change Selection Mode: to "Single",
        I can select deactivated items with either spacebar
        or left-click, with and without the Ctrl- modifier.

> I do notice that if you hold down ctrl and the button, and move the mouse
> a little, the item becomes selected again, which doesn't happen with
> FL_TREE_SELECT_MULTI, but I'm not sure whether that matters.

        Thanks: I can replicate and it should be fixed.

        Can replicate using the test/tree demo with "Selection Mode:"
        set to "single"; if I Ctrl-Left on an item that is selected,
        it deselects. But if I drag the mouse it re-selects (BAD),
        and then remains selected as I continue the drag.

        Looks like there's a path through the "case FL_DRAG:" logic
        causing that which the following should address.

        New patch against svn current (9733) which includes last patch:

Index: Fl_Tree.cxx
===================================================================
--- Fl_Tree.cxx (revision 9733)
+++ Fl_Tree.cxx (working copy)
@@ -337,7 +337,15 @@
            case FL_TREE_SELECT_NONE:
              break;
            case FL_TREE_SELECT_SINGLE:
-             select_only(item, when());
+              if ( is_ctrl ) {                 // CTRL+LEFT-CLICK?
+                if ( item->is_selected() ) {   // on?
+                 deselect(item, when());       //   ..turn off
+               } else {                        // off?
+                  select_only(item, when());   //   ..select /only/ this
+                }
+              } else {                         // LEFT-CLICK?
+                select_only(item, when());     // select only this item
+              }
              _lastselect = item;
              break;
            case FL_TREE_SELECT_MULTI: {
@@ -387,7 +395,15 @@
          case FL_TREE_SELECT_NONE:
            break;                              // no selection changes
          case FL_TREE_SELECT_SINGLE:
-           select_only(item, when());
+           if ( is_ctrl ) {                    // CTRL-DRAG: toggle?
+             if ( item != _lastselect ) {      // dragged to new item?
+               select_only(item, when());      // ..select new instead
+             } else {                          // dragged over same item?
+               /*do nothing*/                  // ..make no change
+             }
+           } else {                            // drag w/out ctrl?
+             select_only(item, when());        // ..select only this item
+           }
            _lastselect = item;
            break;
          case FL_TREE_SELECT_MULTI:
_______________________________________________
fltk mailing list
fltk@easysw.com
http://lists.easysw.com/mailman/listinfo/fltk

Reply via email to