On 17.05.2010, at 06:20, Greg Ercolano wrote:
> Greg Ercolano wrote:
>> dronten wrote:
>>> When text cursor moves past the end or beginning, using the left and right 
>>> arrow keys, the input widget will lose focus to the next/previous widget. 
>>> Should it do that? I have tried a few applications in windows and linux/gtk 
>>> and they do not shift focus. Personally I would like the cursor to stop 
>>> when I come to the end of a line.
>>>
>>> I have fixed that for me with the following change in "int 
>>> Fl_Input_::position(int p, int m)"
>>> I replaced "if (p == position_&&  m == mark_) return 0;"
>>> with "if (p == position_&&  m == mark_) return 1;"
>
>>      I've always thought it odd, but I believe it's intentional behavior.

Indeed, it is. From src/Fl_Input.cxx:

// If you define this symbol as zero you will get the peculiar fltk
// behavior where moving off the end of an input field will move the
// cursor into the next field:
// define it as 1 to prevent cursor movement from going to next field:
#define NORMAL_INPUT_MOVE 0

So, if you want to change the source code, this would be the "correct" 
way to go.

I also think that the default is strange (and maybe we can make it a 
user option in the future w/o the need to change the sources?).

>      BTW, you can disable it without changing FLTK's source code
>      by just subclassing Fl_Input and making your own handle() method, eg:
>      http://fltk.org/newsgroups.php?gfltk.general+v:17715

Yep, that's how I did it in my app, and I'd recommend this way. This is 
more "future proof" if you want to upgrade to a newer FLTK version later.

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

Reply via email to