wxStaticLine width

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
weswitt
Earned a small fee
Earned a small fee
Posts: 22
Joined: Thu Dec 29, 2016 10:45 pm

wxStaticLine width

Post by weswitt » Thu Jan 12, 2017 4:25 pm

What is necessary to specify the width of a static line? I have the code below that draws a horizontal line. This works as expected, but I can't seem to find a way to increase the thickness of the line.

wxPanel* p = new wxPanel(this, wxID_ANY);
wxBoxSizer* b3 = new wxBoxSizer(wxVERTICAL);
wxStaticLine* line = new wxStaticLine(p, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL);
b3->Add(line, 1, wxGROW | wxALL | wxALIGN_LEFT);
p->SetSizerAndFit(b3);

weswitt
Earned a small fee
Earned a small fee
Posts: 22
Joined: Thu Dec 29, 2016 10:45 pm

Re: wxStaticLine width

Post by weswitt » Thu Jan 12, 2017 4:26 pm

This is using wxWidgets 3.1 with Gtk2 running on Linux.

ONEEYEMAN
Part Of The Furniture
Part Of The Furniture
Posts: 4425
Joined: Sat Apr 16, 2005 7:22 am
Location: USA, Ukraine

Re: wxStaticLine width

Post by ONEEYEMAN » Thu Jan 12, 2017 4:58 pm

Hi,
From the docs:
The line may be only vertical or horizontal. Moreover, not all ports (notably not wxGTK) support specifying the transversal direction of the line (e.g. height for a horizontal line) so for maximal portability you should specify it as wxDefaultCoord.
Thank you.

weswitt
Earned a small fee
Earned a small fee
Posts: 22
Joined: Thu Dec 29, 2016 10:45 pm

Re: wxStaticLine width

Post by weswitt » Thu Jan 12, 2017 5:29 pm

Thanks. I tried that like this:

wxStaticLine* line = new wxStaticLine(p, wxID_ANY, wxDefaultPosition, wxSize(wxDefaultCoord, 40), wxLI_HORIZONTAL);

No effect. Am I doing this wrong?

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

Re: wxStaticLine width

Post by doublemax » Thu Jan 12, 2017 5:35 pm

You want a 40 pixel high horizontal line? What horrible kind of GUI are you creating?

Maybe could just create a wxPanel, set the background color to black and set a fixed height.
Use the source, Luke!

ONEEYEMAN
Part Of The Furniture
Part Of The Furniture
Posts: 4425
Joined: Sat Apr 16, 2005 7:22 am
Location: USA, Ukraine

Re: wxStaticLine width

Post by ONEEYEMAN » Thu Jan 12, 2017 5:40 pm

weswitt,
Please re-read the quote.
As you are working with wxGTK, setting the height is not supported.

Try what doublemax suggested.

Thank you.

weswitt
Earned a small fee
Earned a small fee
Posts: 22
Joined: Thu Dec 29, 2016 10:45 pm

Re: wxStaticLine width

Post by weswitt » Thu Jan 12, 2017 5:41 pm

No I certainly don't want as 40 pixel with line in my app. I'm simply using that value as a way to see that the width is in fact changing.

Post Reply