Code::Blocks Forums

User forums => Help => Topic started by: testcode on April 04, 2008, 01:53:19 am

Title: How to use "Extra Code" function in wxsmith
Post by: testcode on April 04, 2008, 01:53:19 am
I am new to Code::Blocks.

Can  any one help me how to use "Extra Code" function in wxsmith:

(http://forums.codeblocks.org/index.php?action=dlattach;topic=8160.0;attach=2547;image)

[attachment deleted by admin]
Title: Re: How to use "Extra Code" function in wxsmith
Post by: gReaen on April 04, 2008, 08:30:05 pm
I'm not really very good in CB too but extra code can be used to add any code related to the widgets being added to the dialogs or frames. For example, if we add a menu bar to a frame the code to append the items in it can be written in it. It'll be put together with the code for creating a new menu bar....
Title: Re: How to use "Extra Code" function in wxsmith
Post by: testcode on April 05, 2008, 12:55:42 am
Hi gReaen, Thank you for your answer.

I added the following code into "Extra Code" column:
$(THIS) ->SetLabel(wxT("Hello");
However, I didn't see the "Extra Code" add to my project source code...
Title: Re: How to use "Extra Code" function in wxsmith
Post by: gReaen on April 05, 2008, 04:18:02 am
I added the line you gave in the 'Extra code' part of a wxDialog and it worked for me..
MyDialog::MyDialog(wxWindow* parent,wxWindowID id)
{
    //(*Initialize(MyDialog)
    Create(parent, id, _("Client"), wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE, _T("id"));
    SetClientSize(wxSize(334,219));
this->SetLabel(wxT("Hello"));
....
}
This is where it was inserted, in the constructor... Although, i removed the $ sign in mine since i got an error for that. The title of the dialog changed to 'Hello' after i ran the program...
Title: Re: How to use "Extra Code" function in wxsmith
Post by: testcode on April 05, 2008, 07:24:13 am
Thanks!!!