Author Topic: How to use "Extra Code" function in wxsmith  (Read 3955 times)

Offline testcode

  • Single posting newcomer
  • *
  • Posts: 3
How to use "Extra Code" function in wxsmith
« 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:



[attachment deleted by admin]
« Last Edit: April 04, 2008, 01:59:22 am by testcode »

Offline gReaen

  • Multiple posting newcomer
  • *
  • Posts: 18
Re: How to use "Extra Code" function in wxsmith
« Reply #1 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....

Offline testcode

  • Single posting newcomer
  • *
  • Posts: 3
Re: How to use "Extra Code" function in wxsmith
« Reply #2 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...

Offline gReaen

  • Multiple posting newcomer
  • *
  • Posts: 18
Re: How to use "Extra Code" function in wxsmith
« Reply #3 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...

Offline testcode

  • Single posting newcomer
  • *
  • Posts: 3
Re: How to use "Extra Code" function in wxsmith
« Reply #4 on: April 05, 2008, 07:24:13 am »
Thanks!!!