SetScrollbar() asserts in GTK build with "this window is not scrollable" Topic is solved

If you are using the main C++ distribution of wxWidgets, Feel free to ask any question related to wxWidgets development here. This means questions regarding to C++ and wxWidgets, not compile problems.
Post Reply
RobertSimpson
Experienced Solver
Experienced Solver
Posts: 88
Joined: Sat Oct 18, 2008 8:32 pm

SetScrollbar() asserts in GTK build with "this window is not scrollable"

Post by RobertSimpson »

I have a wxFrame with a vertical scrollbar. It works fine in windows (both native and msys64) but asserts in Ubuntu (GTK build). The line causing the problem is at /src/gtk/window.cpp:5910:

Code: Select all

wxCHECK_RET( sb, wxT("this window is not scrollable") );
More details:

Code: Select all

#0  0x00007ffff72a161d in wxWindow::SetScrollbar(int, int, int, int, bool) (this=0x555556296de0, orient=8, pos=0, thumbVisible=0, range=1)
    at ../src/gtk/window.cpp:5910
#1  0x0000555555a78aff in Bart::GUI_WX::Text_Frame::Text_Frame(wxWindow*, bool, wxPoint const&, wxSize const&) (this=0x555556296aa0, parent=0x0, b=false, pos=..., size=...) at ../textwnd.cpp:1642
#2  0x000055555593ba3b in Main_Frame::Main_Frame(wxString const&) (this=0x555556158000, title=...) at ../frame.cpp:8625
#3  0x00005555555e381b in MyApp::OnInit() (this=0x555555f1c260) at ../app.cpp:103
#4  0x00005555555e3fcd in wxAppConsoleBase::CallOnInit() (this=0x555555f1c260) at /usr/local/include/wx-3.1/wx/app.h:93
#5  0x00007ffff6c81420 in wxEntry(int&, wchar_t**) (argc=@0x7ffff6fef270: 1, argv=0x555555f1c140) at ../src/common/init.cpp:491
#6  0x00007ffff6c81527 in wxEntry(int&, char**) (argc=@0x7fffffffdf5c: 1, argv=0x7fffffffe048) at ../src/common/init.cpp:519
#7  0x00005555555e376c in main(int, char**) (argc=1, argv=0x7fffffffe048) at ../app.cpp:94
(gdb) list
5945	    GtkRange * const sb = m_scrollBar[dir];
5946	    wxCHECK_RET( sb, wxT("this window is not scrollable") );
5947	
5948	    // This check is more than an optimization. Without it, the slider
5949	    //   will not move smoothly while tracking when using wxScrollHelper.
5950	    if (GetScrollPos(orient) != pos)
5951	    {
5952	        g_signal_handlers_block_by_func(
5953	            sb, (void*)gtk_scrollbar_value_changed, this);
5954	
(gdb) print dir
$1 = 1
(gdb) print m_scrollBar[dir]
$2 = 0x0
I'm assuming (hoping) it's ok to use scrollbars directly in a wxFrame. If so, what do I need to do to fix it?

Thanks,

Rob.
User avatar
doublemax
Moderator
Moderator
Posts: 19160
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: SetScrollbar() asserts in GTK build with "this window is not scrollable"

Post by doublemax »

I'm assuming (hoping) it's ok to use scrollbars directly in a wxFrame. If so, what do I need to do to fix it?
No. Use a wxScrolledWindow.
Use the source, Luke!
RobertSimpson
Experienced Solver
Experienced Solver
Posts: 88
Joined: Sat Oct 18, 2008 8:32 pm

Re: SetScrollbar() asserts in GTK build with "this window is not scrollable"

Post by RobertSimpson »

Ok thanks.

Has anyone considered deleting functions that are not allowed? So e.g. in this case declaring

Code: Select all

class wxFrame : public wxTopLevelWindow
{
  ...
  SetScrollbar(int, int, int, int, bool) = delete;
};
WX on windows allows a lot of constructs that don't work on linux. Even a warning would have been useful here.
User avatar
doublemax
Moderator
Moderator
Posts: 19160
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: SetScrollbar() asserts in GTK build with "this window is not scrollable"

Post by doublemax »

That's something that should be discussed on the mailing list / Google group:
https://groups.google.com/forum/?hl=en& ... m/wx-users
Use the source, Luke!
Post Reply