trying to emulate tab_nav(1)

11 views
Skip to first unread message

Dave Jordan

unread,
May 5, 2021, 5:08:14 AM5/5/21
to fltkg...@googlegroups.com
notes = new Fl_Text_Editor(x, y, w, h);
notes->box(...);
notes->textsize(...);
notes->color(...);
notes->textcolor(...);
notes->cursor_color(...);
notes->wrap_mode(Fl_Text_Display::WRAP_AT_BOUNDS, 0);
Fl_Text_Editor::kf_ignore(notes, FL_Tab);    // compiles but does nothing as far as i can see. I am using 1.3.5 ABI 10300) 
notes->tab_nav(1);                                       // compiler error no such member (ABI version too old I think).

I have also tried subclassng and adding handler, to no avail.
thanks for any help.
-dave

imm

unread,
May 5, 2021, 7:27:05 AM5/5/21
to general fltk
Dave,

You might need to describe what it is you actually want to do here (in
terms simple enough for me to understand...)
The crux is, as you are no doubt aware, that tab is a valid character
in a text editor, and so tab-navigation in an editor widget can not
work like tab-navigation between other widgets.
But to help with this, we do need to know what you actually want to achieve.

Dave Jordan

unread,
May 5, 2021, 8:18:37 AM5/5/21
to fltkg...@googlegroups.com
I am trying to make the tab key navigate out of the Fl_Text_Editor instead of inserting a tab into it. 
and i just noticed that tab_nav is not applicable to text editor. but kf_ignore is, but i couldnt get that to work either.

wea...@gmail.com

unread,
May 5, 2021, 8:56:56 AM5/5/21
to fltk.general
On Wednesday, May 5, 2021 at 11:08:14 AM UTC+2 quantumno...@gmail.com wrote:
notes = new Fl_Text_Editor(x, y, w, h);
notes->box(...);
notes->textsize(...);
notes->color(...);
notes->textcolor(...);
notes->cursor_color(...);
notes->wrap_mode(Fl_Text_Display::WRAP_AT_BOUNDS, 0);
Fl_Text_Editor::kf_ignore(notes, FL_Tab);    // compiles but does nothing as far as i can see. I am using 1.3.5 ABI 10300) 
according to the documentation the parameters should be in the following order :

int Fl_Text_Editor::kf_ignore(int c,Fl_Text_Editor * e )

You provided them in reverse order in your example.

Greg Ercolano

unread,
May 5, 2021, 10:25:03 AM5/5/21
to fltkg...@googlegroups.com

On 5/5/21 2:08 AM, Dave Jordan wrote:

notes = new Fl_Text_Editor(x, y, w, h);
[..]

notes->wrap_mode(Fl_Text_Display::WRAP_AT_BOUNDS, 0);
Fl_Text_Editor::kf_ignore(notes, FL_Tab);    // compiles but does nothing as far as i can see. I am using 1.3.5 ABI 10300)


    kf_ignore() is a nop destination for keys to be ignored, it does not do anything or create mappings.
    Its use is to map keys to be ignored to it, so that it acts as a nop (no operation), such as in the default key mapping table:

// These are the default key bindings every widget should start with
[..]
  { FL_Escape,    FL_TEXT_EDITOR_ANY_STATE, Fl_Text_Editor::kf_ignore     },    // <<-- NOTE ITS USE HERE TO IGNORE Fl_Escape
  { FL_Enter,     FL_TEXT_EDITOR_ANY_STATE, Fl_Text_Editor::kf_enter      },
  { FL_KP_Enter,  FL_TEXT_EDITOR_ANY_STATE, Fl_Text_Editor::kf_enter      },
 
    To use it you'd use add_key_binding(), e.g.

    notes->add_key_binding(FL_Tab, 0, Fl_Text_Editor::kf_ignore);

    ..which is basically what Fl_Text_Editor::tab_nav(int) does; just check out its implementation:

void Fl_Text_Editor::tab_nav(int val) {
  if ( val )
    add_key_binding(FL_Tab, 0, kf_ignore);
  else
    remove_key_binding(FL_Tab, 0);
}
    See Fl_Text_Editor's docs for add_key_binding() to see how to bind/remap keys to different functions.

Albrecht Schlosser

unread,
May 5, 2021, 1:26:02 PM5/5/21
to fltkg...@googlegroups.com
On 5/5/21 11:08 AM Dave Jordan wrote:

> notes->tab_nav(1);                                       // compiler
> error no such member (ABI version too old I think).

Others replied already to other details, hence I'm only picking the ABI
version issue.

Are you building FLTK yourself? If not, well, then probably yes, the
default ABI version is 10300 for FLTK 1.3.

However, if you build FLTK yourself you can use configure or CMake to
define another ABI version. tab_nav() needs 10304 at least.

See README.abi-version.txt and if you have questions, feel free to ask
here again.

Dave Jordan

unread,
May 5, 2021, 3:50:37 PM5/5/21
to fltkg...@googlegroups.com
I saw that #ifdef in the header -- thought, maybe I'll upgrade if that's the only answer.
but i'd just as soon wait for 1.3.6 stable.
-dave

 
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...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/fltkgeneral/c677d7ef-9d10-3624-f397-c85c12e7ea6e%40online.de.

Ian MacArthur

unread,
May 5, 2021, 3:57:01 PM5/5/21
to fltkg...@googlegroups.com
On 5 May 2021, at 20:50, Dave Jordan wrote:
>
> On Wed, May 5, 2021 at 1:26 PM Albrecht Schlosser <Albrech...@online.de> wrote:
> On 5/5/21 11:08 AM Dave Jordan wrote:
>
> > notes->tab_nav(1); // compiler
> > error no such member (ABI version too old I think).
>
> Others replied already to other details, hence I'm only picking the ABI
> version issue.
>
> Are you building FLTK yourself? If not, well, then probably yes, the
> default ABI version is 10300 for FLTK 1.3.
>
> However, if you build FLTK yourself you can use configure or CMake to
> define another ABI version. tab_nav() needs 10304 at least.
>
> See README.abi-version.txt and if you have questions, feel free to ask
> here again.
>
> I saw that #ifdef in the header -- thought, maybe I'll upgrade if that's the only answer.
> but i'd just as soon wait for 1.3.6 stable.


I think you may have missed the point of what Albrecht was saying; you need at least 1.3.4, but 1.3.4 or 1.3.5 (or the 1.3.6 rc) would work *if* you compile them with the enhanced ABI selected.

By default, all 1.3.x variants build with the baseline 1.3 ABI, so waiting for 1.3.6 will not change anything, it will still default to the 1.3 ABI.

If you want the extended ABI, you need to pull a recent variant, say 1.3.5, and then configure it with:

./configure --with-abiversion=10305

Then make as usual.

IIRC the equivalent cmake symbol is OPTION_ABI_VERSION=10306







Greg Ercolano

unread,
May 5, 2021, 4:13:25 PM5/5/21
to fltkg...@googlegroups.com

On 5/5/21 12:50 PM, Dave Jordan wrote:

but i'd just as soon wait for 1.3.6 stable.

    Please don't be confused by all the answers; this is all you should need:

Dave Jordan

unread,
May 5, 2021, 4:22:30 PM5/5/21
to fltkg...@googlegroups.com
Don't worry, I've been confused for decades now :)
Seriously, I now have the binding incorporated and working. Good to know about the build option though.

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...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages