News:

The new Release 25.03 is out! You can download binaries for Windows and many major Linux distros here .

Main Menu

Problems with wxSmith hello world prog

Started by Matroc, April 23, 2006, 01:29:46 PM

Previous topic - Next topic

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:
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));
}


and the xrc:
<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 !!!&#x0A;==============&#x0A;&#x0A;This is template for wxWidgets application using wxSmith RAD gui editor&#x0A;You can add new resources through wxSmith menu.&#x0A;All resources managed inside wxSmith are listed in Resources tab.&#x0A;&#x0A;</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>


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) Select

if ( GetSizer() )
{
  GetSizer()->SetSizeHints(this);
}
else
{
  Fit();
}
Layout();


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


byo

Glad to hear that :)

By the way, where have You this skin (WinXP I guess) from ? It looks interesting :)

sethjackson

Quote from: byo on April 24, 2006, 11:29:35 PM
By the way, where have You this skin (WinXP I guess) from ? It looks interesting :)

Yeah please tell us. It looks nice. :D

takeshimiya


Matroc

yep, its thallos.
i'm pretty happy with it, it doesnt like non standard dpi settings though (the screenshot is from my normal pc)...
well, many windows progs don't like different dpi settings (absolute pixel positioning sucks!).
It's a pain in the ass with a 1600x1200 15" laptop screen.