User forums > Help
Problems with wxSmith hello world prog
Matroc:
Hi,
im having some problems with the prog generated by wxSmith when creating a new app using the wizzard.
in the wizzard i used default options and enabled XRC.
When i compile and run it using the latest CB nightly with VCToolkit and WX 2.6.3 unicode, there seem to be some problems with the menu and statusbars.
They seem to overlay parts of the panel in the window.
The line "Hello World !!!" is not visible by default (its underneath the menu bar), but it becomes visible if i enlarge the window.
Any ideas?
cyberkoa:
may you provide the the code generated by the wizard ? (with screenshot of the problem even better), thx
Matroc:
Ok, no problem.
this is what it looks like on startup:
and this is how it should look (i resized the window):
ok now the generated code, this should be everything that's important:
--- Code: ---MainFrame::MainFrame(wxWindow* parent,wxWindowID id)
{
//(*Initialize(MainFrame)
wxXmlResource::Get()->LoadFrame(this,parent,_T("MainFrame"));
StaticText1 = XRCCTRL(*this,"ID_STATICTEXT1",wxStaticText);
//*)
wxMenuBar* mbar = new wxMenuBar();
wxMenu* fileMenu = new wxMenu(_(""));
fileMenu->Append(idMenuQuit, _("&Quit\tAlt-F4"), _("Quit the application"));
mbar->Append(fileMenu, _("&File"));
wxMenu* helpMenu = new wxMenu(_(""));
helpMenu->Append(idMenuAbout, _("&About\tF1"), _("Show info about this application"));
mbar->Append(helpMenu, _("&Help"));
SetMenuBar(mbar);
SetStatusBar(new wxStatusBar(this,-1));
}
--- End code ---
and the xrc:
--- Code: ---<resource>
<object class="wxFrame" name="MainFrame">
<title>wxSmith template</title>
<centered>1</centered>
<style>wxCAPTION|wxTHICK_FRAME|wxSYSTEM_MENU|wxRESIZE_BOX|wxCLOSE_BOX|wxMINIMIZE_BOX</style>
<bg>wxSYS_COLOUR_BTNFACE</bg>
<object class="wxBoxSizer">
<orient>wxHORIZONTAL</orient>
<object class="sizeritem">
<option>1</option>
<border>5</border>
<flag>wxALL|wxALIGN_CENTER</flag>
<object class="wxStaticText" name="ID_STATICTEXT1">
<label>Hello world !!!
==============

This is template for wxWidgets application using wxSmith RAD gui editor
You can add new resources through wxSmith menu.
All resources managed inside wxSmith are listed in Resources tab.

</label>
<pos>-1,-1</pos>
<style>wxALIGN_CENTRE</style>
<font>
<size>10</size>
<weight>bold</weight>
<face>MS Shell Dlg 2</face>
</font>
</object>
</object>
</object>
</object>
</resource>
--- End code ---
my guess is, that this bug is caused by the fact that the xrc frame layout is altered within the source but im not shure about this...
byo:
Try adding this:
--- Code: (cpp) ---if ( GetSizer() )
{
GetSizer()->SetSizeHints(this);
}
else
{
Fit();
}
Layout();
--- End code ---
at the end of MainFrame ctor, right after SetStatusBar(). Perhaps Layout could be skipped.
This is caused by fact that minimal window size is set up before adding menu/status bar.
Matroc:
Thx, works perfectly :-D
Navigation
[0] Message Index
[#] Next page
Go to full version