Fl_Input not updating when typing

33 views
Skip to first unread message

Tobi Pérusse

unread,
Oct 30, 2020, 9:10:38 AM10/30/20
to fltk.general

Hi guys

I'm trying to add a Fl_Input in a group in a tab but I can't get it to display the text as I type. When the window lost then get focus again it display its value. I have no clue how to fix that
. Any idea?
GeneralPropertiesEditor.cpp
PropertiesEditorWindow.cpp

imm

unread,
Oct 30, 2020, 9:26:23 AM10/30/20
to general fltk
Hmm, not seeing anything immediate... Can you make a small example
that is compilable so we can test this, please.
The samples you posted are useful but not complete enough to test.

I assume the samples in the fltk test folder work OK on your machine?

Tobi Pérusse

unread,
Oct 30, 2020, 10:25:14 AM10/30/20
to fltk.general
Here it is. This is a test project for learning. It's using 1.3.5 from fedora 32 repository. I have not test the git repo yet.
fltk-all.tar.gz

imm

unread,
Oct 30, 2020, 1:33:30 PM10/30/20
to general fltk
On Fri, 30 Oct 2020 at 14:25, Tobi Pérusse wrote:
>
> Here it is. This is a test project for learning. It's using 1.3.5 from fedora 32 repository. I have not test the git repo yet.
>

Sorry, there is much too much code there for me to look at, and I will
not touch the binary elements. I suspect others here will also find
this tarball too much to process...

If you want help, please post a *small*, complete, compilable example,
preferably as a single file, that exhibits the specific problem being
discussed.

Tobi Pérusse

unread,
Oct 30, 2020, 2:25:56 PM10/30/20
to fltk.general
Sorry about that, will make a smaller one.

lifeatt...@gmail.com

unread,
Oct 30, 2020, 6:37:44 PM10/30/20
to fltk.general
I found the problem.

In PropertiesEditorWindow::addTabs(), you create your tab widget as follows:

    Fl_Tabs *tabs = new Fl_Tabs(5, 0, 530, 30);

Change it to:

    Fl_Tabs *tabs = new Fl_Tabs(5, 0, 530, 300);

And all will be well.

[The window is 330 pixels high; the interior group is 250 pixels high; the small tab height is blocking redraw of any contained widgets.]

Kevin

lifeatt...@gmail.com

unread,
Oct 30, 2020, 6:40:49 PM10/30/20
to fltk.general
Here is the simplified code which shows the problem [assumed to be invoked as a callback from e.g. a button]:

void preferences(Fl_Widget*, void*)
{
    Fl_Window* win = new Fl_Window(540, 330);
    win->copy_label("Title");

    Fl_Tabs* tabs = new Fl_Tabs(5, 0, 530, 30); // change '30' to '300' to fix

    Fl_Group* general = new Fl_Group(5, 30, 530, 250, "Blah");

    Fl_Input* usernameInput = new Fl_Input(180, 40, 350, 30, "Username:");

    general->end();

    tabs->end();
    win->end();

    win->show();
    while (win->shown()) {
        Fl::wait();
    }
}

Tobi Pérusse

unread,
Oct 31, 2020, 7:44:15 AM10/31/20
to fltk.general
I confirm it work! The tabs doesn't work as I was expecting. I was thinking the size should include the tabs only, similar to the menu bar.

Thanks a lot guys! And thanks for this group :)

imm

unread,
Oct 31, 2020, 11:49:02 AM10/31/20
to general fltk
On Fri, 30 Oct 2020, 22:37 lifeatt.. wrote:
I found the problem.

In PropertiesEditorWindow::addTabs(), you create your tab widget as follows:

    Fl_Tabs *tabs = new Fl_Tabs(5, 0, 530, 30);

Change it to:

    Fl_Tabs *tabs = new Fl_Tabs(5, 0, 530, 300);

And all will be well.

[The window is 330 pixels high; the interior group is 250 pixels high; the small tab height is blocking redraw of any contained widgets.]


Good catch K.

I actually did take a squint at the sample code (despite saying I wouldn't) looking for exactly that sort of error, as I was assuming it was a widget area / visibility thing.

And I totally missed that... I can only imagine I saw the 30 as 300 and thought it was OK!

Cheers,
-- 
Ian
From my Fairphone FP3

Reply all
Reply to author
Forward
0 new messages