wxStaticLine resizing
wxStaticLine resizing
CodeBlocks with Mingw, wxWidget 3.1.2, wxSmith
I can't figure out how to set wxStaticLine options to resize vertically, but with fixed height.
I tried setting default width and height, checking "Shaped" option and setting max height size to 1, which normally works, but doesn't work when I resize the window only horizontally (in this case, the width stays the same).
-ValeV
I can't figure out how to set wxStaticLine options to resize vertically, but with fixed height.
I tried setting default width and height, checking "Shaped" option and setting max height size to 1, which normally works, but doesn't work when I resize the window only horizontally (in this case, the width stays the same).
-ValeV
- evstevemd
- Part Of The Furniture
- Posts: 2409
- Joined: Wed Jan 28, 2009 11:57 am
- Location: United Republic of Tanzania
Re: wxStaticLine resizing
Make sure it is set to wxLI_VERTICAL and when adding in sizers it is wxEXPANDED
Chief Justice: We have trouble dear citizens!
Citizens: What it is his honor?
Chief Justice:Our president is an atheist, who will he swear to?
Citizens: What it is his honor?
Chief Justice:Our president is an atheist, who will he swear to?
Re: wxStaticLine resizing
Sorry, I forgot to add , when I resize the window (make it bigger), I don't want the staticLine to get bigger vertically (so it becomes like a square), I want it to expand just horizontally.
- evstevemd
- Part Of The Furniture
- Posts: 2409
- Joined: Wed Jan 28, 2009 11:57 am
- Location: United Republic of Tanzania
Re: wxStaticLine resizing
Can you show us what is flags for it? Make sure proportion is not 1 but 0 (second argument to sizer->Add())
Chief Justice: We have trouble dear citizens!
Citizens: What it is his honor?
Chief Justice:Our president is an atheist, who will he swear to?
Citizens: What it is his honor?
Chief Justice:Our president is an atheist, who will he swear to?
Re: wxStaticLine resizing
Sure thing.
Properties: http://i65.tinypic.com/2lu2zdc.png
GUI: http://tinypic.com/view.php?pic=2ppghgy&s=9
Properties: http://i65.tinypic.com/2lu2zdc.png
GUI: http://tinypic.com/view.php?pic=2ppghgy&s=9
Re: wxStaticLine resizing
I'm mildly confused. On the screenshot i only see a horizontal line.
And FWIW, as the two gui parts are already enclosed in a wxStaticBox, IMHO they don't need an additional visual separation. At most i would put a spacer with a fixed height between them.
And FWIW, as the two gui parts are already enclosed in a wxStaticBox, IMHO they don't need an additional visual separation. At most i would put a spacer with a fixed height between them.
Use the source, Luke!
- evstevemd
- Part Of The Furniture
- Posts: 2409
- Joined: Wed Jan 28, 2009 11:57 am
- Location: United Republic of Tanzania
Re: wxStaticLine resizing
I wrote a comment about him/her uploading the incorrect version image. I don't know where it went but the shots sounds ok to me
Chief Justice: We have trouble dear citizens!
Citizens: What it is his honor?
Chief Justice:Our president is an atheist, who will he swear to?
Citizens: What it is his honor?
Chief Justice:Our president is an atheist, who will he swear to?
Re: wxStaticLine resizing
Yes, but when I resize the window, the horizontal line becomes a square, like so: http://i63.tinypic.com/30dcj2u.png
I may change horizontal line for spacer, like you said, but I want to understand how to do what I am asking in this thread.
Sadly I don't see your comment, not in this thread, not under private message. Please look at screenshot I posted above.
Re: wxStaticLine resizing
That looks like you set a proportion > 0 when adding it to the sizer. Try 0.Yes, but when I resize the window, the horizontal line becomes a square
If that doesn't fix it, please show the sizer code for that dialog.
Use the source, Luke!
Re: wxStaticLine resizing
Properties are the same as on a screenshot from my earlier post. Here is the code:
Code: Select all
StaticLine1 = new wxStaticLine(Panel1, ID_STATICLINE1, wxDefaultPosition, wxDefaultSize, wxLI_VERTICAL, _T("ID_STATICLINE1"));
FlexGridSizer1->Add(StaticLine1, 0, wxALL|wxEXPAND, 5);
Re: wxStaticLine resizing
That still doesn't make sense to me. Why is this a vertical line while it should be horizontal?
What happens if you change wxLI_VERTICAL to wxLI_HORIZONTAL?
And, show the whole sizer code for that dialog.
What happens if you change wxLI_VERTICAL to wxLI_HORIZONTAL?
And, show the whole sizer code for that dialog.
Use the source, Luke!
Re: wxStaticLine resizing
Full code below. Again, I use wxSmith so I didn't write any of this code manually.
Code: Select all
BinaryConverterFrame::BinaryConverterFrame(wxWindow* parent,wxWindowID id)
{
//(*Initialize(BinaryConverterFrame)
wxBoxSizer* BoxSizer1;
wxFlexGridSizer* FlexGridSizer1;
wxMenu* Menu1;
wxMenu* Menu2;
wxMenuBar* MenuBar1;
wxMenuItem* MenuItem1;
wxMenuItem* MenuItem2;
wxStaticBoxSizer* StaticBoxSizer1;
wxStaticBoxSizer* StaticBoxSizer2;
Create(parent, wxID_ANY, _("BinaryConverter"), wxDefaultPosition, wxDefaultSize, wxDEFAULT_FRAME_STYLE, _T("wxID_ANY"));
BoxSizer1 = new wxBoxSizer(wxHORIZONTAL);
Panel1 = new wxPanel(this, ID_PANEL1, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL, _T("ID_PANEL1"));
FlexGridSizer1 = new wxFlexGridSizer(3, 1, 0, 0);
FlexGridSizer1->AddGrowableCol(0);
FlexGridSizer1->AddGrowableRow(0);
FlexGridSizer1->AddGrowableRow(1);
FlexGridSizer1->AddGrowableRow(2);
StaticBoxSizer1 = new wxStaticBoxSizer(wxHORIZONTAL, Panel1, _("EDS to binary converter"));
Button1 = new wxButton(Panel1, ID_BUTTON1, _("Browse motor\ncontroller\'s EDS file"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T("ID_BUTTON1"));
StaticBoxSizer1->Add(Button1, 1, wxALL|wxEXPAND, 5);
Button2 = new wxButton(Panel1, ID_BUTTON2, _("Save as binary"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T("ID_BUTTON2"));
StaticBoxSizer1->Add(Button2, 1, wxALL|wxEXPAND, 5);
FlexGridSizer1->Add(StaticBoxSizer1, 1, wxALL|wxEXPAND, 5);
StaticLine1 = new wxStaticLine(Panel1, ID_STATICLINE1, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL, _T("ID_STATICLINE1"));
FlexGridSizer1->Add(StaticLine1, 0, wxALL|wxEXPAND, 5);
StaticBoxSizer2 = new wxStaticBoxSizer(wxHORIZONTAL, Panel1, _("Binary to text converter"));
Button3 = new wxButton(Panel1, ID_BUTTON3, _("Choose binary file with\ncontroller NV-RAM data"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T("ID_BUTTON3"));
StaticBoxSizer2->Add(Button3, 1, wxALL|wxEXPAND, 5);
Button4 = new wxButton(Panel1, ID_BUTTON4, _("Save as text"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T("ID_BUTTON4"));
StaticBoxSizer2->Add(Button4, 1, wxALL|wxEXPAND, 5);
FlexGridSizer1->Add(StaticBoxSizer2, 1, wxALL|wxEXPAND, 5);
Panel1->SetSizer(FlexGridSizer1);
FlexGridSizer1->Fit(Panel1);
FlexGridSizer1->SetSizeHints(Panel1);
BoxSizer1->Add(Panel1, 1, wxEXPAND, 5);
SetSizer(BoxSizer1);
MenuBar1 = new wxMenuBar();
Menu1 = new wxMenu();
MenuItem1 = new wxMenuItem(Menu1, idMenuQuit, _("Quit\tAlt-F4"), _("Quit the application"), wxITEM_NORMAL);
Menu1->Append(MenuItem1);
MenuBar1->Append(Menu1, _("&File"));
Menu2 = new wxMenu();
MenuItem2 = new wxMenuItem(Menu2, idMenuAbout, _("About\tF1"), _("Show info about this application"), wxITEM_NORMAL);
Menu2->Append(MenuItem2);
MenuBar1->Append(Menu2, _("Help"));
SetMenuBar(MenuBar1);
StatusBar1 = new wxStatusBar(this, ID_STATUSBAR1, 0, _T("ID_STATUSBAR1"));
int __wxStatusBarWidths_1[1] = { -1 };
int __wxStatusBarStyles_1[1] = { wxSB_NORMAL };
StatusBar1->SetFieldsCount(1,__wxStatusBarWidths_1);
StatusBar1->SetStatusStyles(1,__wxStatusBarStyles_1);
SetStatusBar(StatusBar1);
FileDialog1 = new wxFileDialog(this, _("Select file"), wxEmptyString, wxEmptyString, _("EDS files (*.eds)|*.eds"), wxFD_OPEN|wxFD_FILE_MUST_EXIST, wxDefaultPosition, wxDefaultSize, _T("wxFileDialog"));
FileDialog2 = new wxFileDialog(this, _("Select file"), wxEmptyString, wxEmptyString, _("BIN files (*.bin)|*.bin"), wxFD_SAVE|wxFD_OVERWRITE_PROMPT, wxDefaultPosition, wxDefaultSize, _T("wxFileDialog"));
FileDialog3 = new wxFileDialog(this, _("Select file"), wxEmptyString, wxEmptyString, _("BIN files (*.bin)|*.bin"), wxFD_OPEN|wxFD_FILE_MUST_EXIST, wxDefaultPosition, wxDefaultSize, _T("wxFileDialog"));
FileDialog4 = new wxFileDialog(this, _("Select file"), wxEmptyString, wxEmptyString, _("TXT files (*.txt)|*.txt"), wxFD_SAVE|wxFD_OVERWRITE_PROMPT, wxDefaultPosition, wxDefaultSize, _T("wxFileDialog"));
BoxSizer1->Fit(this);
BoxSizer1->SetSizeHints(this);
Connect(ID_BUTTON1,wxEVT_COMMAND_BUTTON_CLICKED,(wxObjectEventFunction)&BinaryConverterFrame::OnButton1Click);
Connect(ID_BUTTON2,wxEVT_COMMAND_BUTTON_CLICKED,(wxObjectEventFunction)&BinaryConverterFrame::OnButton2Click);
Connect(ID_BUTTON3,wxEVT_COMMAND_BUTTON_CLICKED,(wxObjectEventFunction)&BinaryConverterFrame::OnButton3Click);
Connect(ID_BUTTON4,wxEVT_COMMAND_BUTTON_CLICKED,(wxObjectEventFunction)&BinaryConverterFrame::OnButton4Click);
Connect(idMenuQuit,wxEVT_COMMAND_MENU_SELECTED,(wxObjectEventFunction)&BinaryConverterFrame::OnQuit);
Connect(idMenuAbout,wxEVT_COMMAND_MENU_SELECTED,(wxObjectEventFunction)&BinaryConverterFrame::OnAbout);
//*)
}
- evstevemd
- Part Of The Furniture
- Posts: 2409
- Joined: Wed Jan 28, 2009 11:57 am
- Location: United Republic of Tanzania
Re: wxStaticLine resizing
Can you try to *Not* expanding the line, just to see how it behaves?
to
also can you add wxSHAPED to sizer, that is
and
I would be interested to know how each behaves. That will give an idea of what is happening. Also delete all build files to make sure that nothing is cached
Code: Select all
FlexGridSizer1->Add(StaticLine1, 0, wxALL|wxEXPAND, 5);
Code: Select all
FlexGridSizer1->Add(StaticLine1, 0, wxALL, 5);
Code: Select all
FlexGridSizer1->Add(StaticLine1, 0, wxALL|wxSHAPED, 5);
Code: Select all
FlexGridSizer1->Add(StaticLine1, 0, wxEXPAND|wxALL|wxSHAPED, 5);
Chief Justice: We have trouble dear citizens!
Citizens: What it is his honor?
Chief Justice:Our president is an atheist, who will he swear to?
Citizens: What it is his honor?
Chief Justice:Our president is an atheist, who will he swear to?
Re: wxStaticLine resizing
>FlexGridSizer1->Add(StaticLine1, 0, wxALL, 5);
Line is not visible.
>FlexGridSizer1->Add(StaticLine1, 0, wxALL|wxSHAPED, 5);
Not visible, on resize it becomes square like in my previous picture, but just on the left side of the window.
>FlexGridSizer1->Add(StaticLine1, 0, wxEXPAND|wxALL|wxSHAPED, 5);
Same as above.
I don't have patience anymore with this, so I am just gonna hide it and be done with it. Sincere thank you for your best help.
Line is not visible.
>FlexGridSizer1->Add(StaticLine1, 0, wxALL|wxSHAPED, 5);
Not visible, on resize it becomes square like in my previous picture, but just on the left side of the window.
>FlexGridSizer1->Add(StaticLine1, 0, wxEXPAND|wxALL|wxSHAPED, 5);
Same as above.
I don't have patience anymore with this, so I am just gonna hide it and be done with it. Sincere thank you for your best help.
- evstevemd
- Part Of The Furniture
- Posts: 2409
- Joined: Wed Jan 28, 2009 11:57 am
- Location: United Republic of Tanzania
Re: wxStaticLine resizing
It's unfortunate that you have to go that way. But if you come back to it make a very minima example, handwritten that one can test on their machine. That way you get real help quickly. We lack time to take the whole thing and make it work.
Again, sorry
Again, sorry
Chief Justice: We have trouble dear citizens!
Citizens: What it is his honor?
Chief Justice:Our president is an atheist, who will he swear to?
Citizens: What it is his honor?
Chief Justice:Our president is an atheist, who will he swear to?