Re: problem with the scrollbar inside the notebook

Vadim Zeitlin <[email protected]>
Newsgroups gmane.comp.lib.wxwindows.general
Message-ID <[email protected]>
On Thu, 24 Oct 2024 13:59:30 +0200 Zoran Bošnjak wrote:

ZB> I am using wxHaskell bindings of the wxWidgets library. With the latest 
ZB> version, I am facing the problem with missing scrollbar inside the 
ZB> notebook. The same sample from a few years back was working fine. I 
ZB> belive the wxWidget version was 2.9.3 at the time. Now, it's build 
ZB> against version 3.2.
ZB> 
ZB> The issue (together with a short sample in haskell language) is filed 
ZB> under the wxHaskell project:
ZB> https://codeberg.org/wxHaskell/wxHaskell/issues/48
ZB> 
ZB> I was wandering is someone from this list is able to recreate the same 
ZB> sample as a plain C/C++ program or using other language bindings (like 
ZB> python) and help me determine:

 I am not sure how does "fill" and some other functions work in wxHaskell
but here is a rough translation of your code in C++:

--------------------------------- >8 --------------------------------------
#include <wx/app.h>
#include <wx/frame.h>
#include <wx/notebook.h>
#include <wx/scrolwin.h>
#include <wx/sizer.h>
#include <wx/stattext.h>

class TestApp : public wxApp {
public:
    bool OnInit() override {
        auto f = new wxFrame(nullptr, wxID_ANY, "Frame");
        auto nb = new wxNotebook(f, wxID_ANY);

        auto p1 = new wxScrolledWindow(nb);
        p1->SetScrollRate(20, 20);
        auto sizer = new wxBoxSizer(wxVERTICAL);
        for ( int i = 0; i < 20; i++ ) {
            sizer->Add(new wxStaticText(p1, wxID_ANY, "test " + std::to_string(i)));
        }
        p1->SetSizer(sizer);

        nb->AddPage(p1, "tab1");
        f->SetClientSize(400, 200);
        f->Show();
        return true;
    }
};

wxIMPLEMENT_APP(TestApp);
--------------------------------- >8 --------------------------------------

This works just fine for me with the latest wx and GTK 3.

ZB> - Is this a wxWidget or wxHaskell binding problem?

 I'd check the implementation of "fill" to understand what exactly it does.

ZB> - Was there any change in wxWidgets over time that requires a different 
ZB> approach (like any new attributes regarding the scrollbar)?

 No, or at least definitely not intentionally.

ZB> - Or any other ideas how to workaround the problem and have the 
ZB> scrollbar present again?

 You should try debugging (either using gdb, which should work for C++ code
even when using wxHaskell, or using printf-debugging style) the sizes of
the different windows, e.g. start by checking the size and the virtual size
of "p1".

 Good luck
VZ

-- 
TT-Solutions: wxWidgets consultancy and technical support
              https://www.tt-solutions.com/
signature.asc (application/pgp-signature, 195 B)
-----BEGIN PGP SIGNATURE-----

iF0EABECAB0WIQQx+vLQdOwioQqkxtoG6kHeT2wehgUCZxznTwAKCRAG6kHeT2we
hk2LAKCdPcaZwWg4Pu74YnklvIfc1F4IIwCdEFjQsXSGijXPD5TB4df5YAVUEoI=
=xrSh
-----END PGP SIGNATURE-----
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.