Re: wxListbook problem, not sizing correctly on Windows.

Andrea Asztalos <[email protected]>
Newsgroups gmane.comp.lib.wxwindows.general
Message-ID <[email protected]>
Hello,
I've just run into the same issue and it is Windows specific.
If the wxListBook has the wxLB_TOP flag, and no images are tied to the list 
items, the text is simply not visible. Specifically, the height of the list 
ctrl is very narrow while the width seems to be ok.
Once images are tied to the control, everything works fine.

void CHelloWorldDlg::CreateControls()
{

    CHelloWorldDlg* itemDialog1 = this;
    
    wxBoxSizer* sizer = new wxBoxSizer(wxVERTICAL);
    itemDialog1->SetSizer(sizer);
    
    wxBoxSizer* itemBoxSizer2 = new wxBoxSizer(wxHORIZONTAL);
    sizer->Add(itemBoxSizer2, 0, wxALIGN_LEFT | wxALL, 5);
    
    wxStaticText* itemStaticText3 = new wxStaticText( itemDialog1, 
wxID_STATIC, _("Hello World!"), wxDefaultPosition, wxDefaultSize, 0 );
    itemBoxSizer2->Add(itemStaticText3, 0, wxALIGN_CENTER_VERTICAL|wxALL, 
5);
    
    itemBoxSizer2->Add(50, 5, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
    
    wxButton* itemButton5 = new wxButton( itemDialog1, wxID_CANCEL, 
_("&Close"), wxDefaultPosition, wxDefaultSize, 0 );
    itemBoxSizer2->Add(itemButton5, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
    
    m_listbook = new wxListbook(itemDialog1, wxID_ANY, wxDefaultPosition, 
wxDefaultSize, wxLB_TOP);
    sizer->Add(m_listbook, 1, wxEXPAND, 0);
    
    wxPanel* p1 = new wxPanel(m_listbook, wxID_ANY, wxDefaultPosition, 
wxSize(300, 300));
    p1->SetBackgroundColour(wxColour("MAROON"));
    m_listbook->AddPage(p1, wxT("First page"));

    wxPanel* p2 = new wxPanel(m_listbook, wxID_ANY, wxDefaultPosition, 
wxSize(300, 300));
    p2->SetBackgroundColour(wxColour("RED"));
    m_listbook->AddPage(p2, wxT("Second_page"));

}

Any ideas are appreciated how to fix it.
Thank you,
Andrea Asztalos

On Tuesday, May 23, 2023 at 11:30:13 AM UTC-4 Tony Kennedy wrote:

> I think the internal wxListCtrl is sizing itself based on the icon size, 
> and ignoring the text.
>
> I'm not sure what function within the wxListCtrl class to take a look at 
> though and attempt a fix.
>
>
>
>
>
> On Tuesday, 23 May 2023 at 16:25:45 UTC+1 Tony Kennedy wrote:
>
>> The notebook sample already shows one problem. The "Radiobuttons" tab 
>> wraps the label "Radiobuttons" across two lines.
>>
>> [image: notebookproblem1.jpg]
>>
>> The second issue, if I change
>> const wxSize imageSize(32, 32);
>> to 
>> const wxSize imageSize(16, 16);
>>
>> Then you get the horizonal scroll bar.
>>
>> [image: notebookproblem2.jpg]
>>
>>
>>
>> On Tuesday, 23 May 2023 at 16:13:27 UTC+1 Tony Kennedy wrote:
>>
>>> Coming back to this, I think the list sizes itself based on the icon 
>>> size in the attached image list. If I make the icons larger, things improve 
>>> quite a bit.
>>>
>>> I'll see if I can modify the notebook sample.
>>>
>>> On Tuesday, 15 February 2022 at 19:20:10 UTC Julian Novak wrote:
>>>
>>>> I had the same problem, an unwanted horizontal scrollbar, on Windows XP 
>>>> and Windows 7 classic theme (!wxUxThemeIsActive()), but never looked into 
>>>> it in detail. 
>>>>
>>>> 14.02.2022 15:44:14 Tony Kennedy <[email protected]>: 
>>>>
>>>> > I've got a problem where the listbook is not sizing correctly on 
>>>> Windows. 
>>>> > 
>>>> > I've attached a couple of images, the box that displays the page list 
>>>> just just not wide enough (or tall enough if the font scaling is changed). 
>>>> > 
>>>> > Is there an easy way to fix this? I've tried stepping through the 
>>>> code but could not figure out what to change. 
>>>> > 
>>>> > Thanks in advance, 
>>>> > 
>>>> > Tony. [cid:86d1fb4e-d7d0-4ee3-bda9-1d89996219d7][wxListbook_02.jpg] 
>>>> [cid:967f6677-0d40-4703-aa6b-3474cc355ad5][wxListbook_01.jpg] 
>>>> > -- 
>>>> > Please read https://www.wxwidgets.org/support/mlhowto.htm before 
>>>> posting. 
>>>> > --- 
>>>> > You received this message because you are subscribed to the Google 
>>>> Groups "wx-users" group. 
>>>> > To unsubscribe from this group and stop receiving emails from it, 
>>>> send an email to [email protected]. 
>>>> > To view this discussion on the web visit 
>>>> https://groups.google.com/d/msgid/wx-users/1761a3cf-a702-4d13-962e-63bc79b2f62bn%40googlegroups.com[https://groups.google.com/d/msgid/wx-users/1761a3cf-a702-4d13-962e-63bc79b2f62bn%40googlegroups.com?utm_medium=email&utm_source=footer] 
>>>> <https://groups.google.com/d/msgid/wx-users/1761a3cf-a702-4d13-962e-63bc79b2f62bn%40googlegroups.com%5Bhttps://groups.google.com/d/msgid/wx-users/1761a3cf-a702-4d13-962e-63bc79b2f62bn%40googlegroups.com?utm_medium=email&utm_source=footer]>. 
>>>>
>>>>
>>>

-- 
Please read https://www.wxwidgets.org/support/mlhowto.htm before posting.
--- 
You received this message because you are subscribed to the Google Groups "wx-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To view this discussion on the web visit https://groups.google.com/d/msgid/wx-users/9c8ca10d-961f-4c02-8ee7-f0367e6513c9n%40googlegroups.com.
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.