DO NOT REPLY TO THIS MESSAGE.  INSTEAD, POST ANY RESPONSES TO THE LINK BELOW.

[STR New]

Link: http://www.fltk.org/str.php?L2094
Version: 1.3-current


Yes, I think you're right.

> IMHO, the problem is that FL_WHEN_ENTER_KEY_ALWAYS
> implicitly sets the FL_WHEN_NOT_CHANGED bit, and this can fire the
> callback even if the value has _not_ changed.

Agreed.

Seems like the logic isn't clear -- FL_WHEN_ENTER_KEY_ALWAYS is supposed
to only call the callback when Enter is hit, regardless of a change in
data, according to its docs.

But FL_WHEN_ENTER_KEY_ALWAYS is currently a combo of FL_WHEN_ENTER_KEY and
FL_WHEN_NOT_CHANGED, which sounds right if you read the flag's names
literally: "do the callback when Enter is pressed, whether or not the
value was changed".

But the docs for FL_WHEN_NOT_CHANGED don't actually mean that; the docs
for that flag say to do the callback "whenever the user interacts with the
widget", which is really NOT something FL_WHEN_ENTER_KEY_ALWAYS is supposed
to do.

It sounds like FL_WHEN_ENTER_KEY_ALWAYS should be a special case unto
itself with a special bit to indicate the 'ALWAYS', eg. changing the enum
definition to include FL_WHEN_ENTER_KEY plus an unused bit:

  FL_WHEN_ENTER_KEY_ALWAYS=(16+8),

..and changing Fl_Input_::maybe_do_callback()

OLD:  if (changed() || (when()&FL_WHEN_NOT_CHANGED)) {
OLD:    do_callback();
OLD:  }

NEW: if (changed() ||
NEW:     ((when()&FL_WHEN_NOT_CHANGED) ||
NEW:     ((when()&FL_WHEN_ENTER_KEY_ALWAYS)==FL_WHEN_ENTER_KEY_ALWAYS)))
NEW:    do_callback();
NEW: }

or something like that. Above not tested, but maybe that's the solution.

Not sure myself.


Link: http://www.fltk.org/str.php?L2094
Version: 1.3-current

_______________________________________________
fltk-bugs mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk-bugs

Reply via email to