Author Topic: wxSmith - tutorial  (Read 71544 times)

wxSchmidt

  • Guest
Re: wxSmith - tutorial
« Reply #30 on: November 05, 2007, 06:59:18 pm »
Hi, im new to wxsmith, but it seems to be a powerful GUI-creation-tool.
Are there any other tutorials than "HELLO WORLD" available? :D 8)

Offline byo

  • Plugin developer
  • Lives here!
  • ****
  • Posts: 837
Re: wxSmith - tutorial
« Reply #31 on: November 05, 2007, 10:38:06 pm »
Hi, im new to wxsmith, but it seems to be a powerful GUI-creation-tool.
Are there any other tutorials than "HELLO WORLD" available? :D 8)

Currently AFAIK there are no other tutorials, I could write some but don't have enough time :(. Maybe you could add something there if you figure out how wxSmith works :) I could help in case of problems :)

Regards
  BYO

Offline Adam01

  • Single posting newcomer
  • *
  • Posts: 9
Re: wxSmith - tutorial
« Reply #32 on: August 24, 2008, 12:57:50 am »
Does anyone know how to make a function, called when a button is clicked?
The tutorial uses  frame::OnButtonClick(wxCommandEvent& event){}, but the function prototype needs to the declared first, I did that in the frame class, but still nothing happened.
Does anyone know anything about button events?

Offline Jenna

  • Administrator
  • Lives here!
  • *****
  • Posts: 7255
Re: wxSmith - tutorial
« Reply #33 on: August 24, 2008, 09:58:19 am »
Does anyone know how to make a function, called when a button is clicked?
The tutorial uses  frame::OnButtonClick(wxCommandEvent& event){}, but the function prototype needs to the declared first, I did that in the frame class, but still nothing happened.
Does anyone know anything about button events?

If you chose the button in the wxs-tab you see the propertygrid in the resources-tab in the manager.
Between the resouces-tree of your project(s) and the propertygrid belonging to the active element, there are two buttons/icons.
One is activated (the one that looks like a list).
Click on the one with the two curly braces and you can assign an event to the button by chosing "Add new Handler" from the dropdownlist on the right.

Offline Adam01

  • Single posting newcomer
  • *
  • Posts: 9
Re: wxSmith - tutorial
« Reply #34 on: August 24, 2008, 11:11:18 am »
Thanks, I worked that out just after I posted that question.
Does wx have its own threading system?, so I could multi-thread gauges and other animations.

Offline Adam01

  • Single posting newcomer
  • *
  • Posts: 9
Re: wxSmith - tutorial
« Reply #35 on: August 25, 2008, 01:43:30 am »
Also, using wxFileSelector, how can I use ofstream to open the return value?
It is a wxString, but is there anyway to convert it to a char?

Offline byo

  • Plugin developer
  • Lives here!
  • ****
  • Posts: 837
Re: wxSmith - tutorial
« Reply #36 on: September 03, 2008, 10:24:38 pm »
You can use such scheme to convert wxString into const char*:

Code
wxString someString;
const char* chars = someString.mb_str(wxConvLocal);

This may work in many cases but will probably cause big problems when some local characters are used in the path due to different character encodings.

Did you try to use wxFileStream class instead? I'm not familiar with it so I can not tell whether it works like standard iostreams.

Regards
   BYO

Offline Master

  • Multiple posting newcomer
  • *
  • Posts: 53
Re: wxSmith - tutorial
« Reply #37 on: October 04, 2008, 10:28:15 am »
hello , and sorry i just figured it out that i shouldnt have posted here ! ,

many tanx MortenMacFly
 
« Last Edit: October 04, 2008, 06:23:07 pm by Master »
a man's dream is an index to his greatness...

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9694
Re: wxSmith - tutorial
« Reply #38 on: October 04, 2008, 03:50:50 pm »
hello, i got some questions!:
Sorry to interrupt here, but these question go far beyond the scope of our forums. Thus in fact they violate our forum rules. I suggest you ask in a programming and/or wx related forum.
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ

Offline Master

  • Multiple posting newcomer
  • *
  • Posts: 53
Re: wxSmith - tutorial
« Reply #39 on: October 04, 2008, 06:25:27 pm »
hello, i got some questions!:
Sorry to interrupt here, but these question go far beyond the scope of our forums. Thus in fact they violate our forum rules. I suggest you ask in a programming and/or wx related forum.
tanx, edited .
a man's dream is an index to his greatness...

Offline Grom

  • Almost regular
  • **
  • Posts: 206
Re: wxSmith - tutorial
« Reply #40 on: October 05, 2008, 01:35:07 am »
hello, i got some questions!:
Sorry to interrupt here, but these question go far beyond the scope of our forums. Thus in fact they violate our forum rules. I suggest you ask in a programming and/or wx related forum.

Edit: [REMOVED NON ENGLISH CONTENT] :lol: :lol: :lol:
« Last Edit: October 05, 2008, 01:58:06 pm by MortenMacFly »
gcc+winXP+suse.

Fex

  • Guest
Re: wxSmith - tutorial
« Reply #41 on: November 02, 2008, 03:14:29 am »
I'm working my way through the wxsmith tutorials. They are really good  :)

I have not worked with wxwidgets before but I do have a fair bit of programming experiance. I have a question about tutorial 4

http://wiki.codeblocks.org/index.php?title=WxSmith_tutorial:_Working_with_multiple_resources

The code says
Code
void Tutorial_4Frame::OnButton3Click(wxCommandEvent& event)
{
    FirstFrame* frm = new FirstFrame(this);
    frm->Show();
}

Shouldn't there be a

Code
delete frm;

in there somewhere to ensure no memory leaks? Or does it automatically handle them somehow?

Fex.

Offline Pecan

  • Plugin developer
  • Lives here!
  • ****
  • Posts: 2750
Re: wxSmith - tutorial
« Reply #42 on: November 02, 2008, 03:05:59 pm »
I learned the hard way, that if you delete a control/frame/window that is owned by wxWidgets, wxWidets will have a stroke and die.

When a wxWidgets owned frame is destroyed by wxWidgets, all its children will be destoyed automatically.

The objects you need to delete are the ones you created outside the wxWidgets knowledge, such as "myvartype* myvar = new (myOwnArray)" etc. wxWidgets doesn't know about these.

There was a good post about this by Thomas on the forum some time back(Here), but the links became obsolete. I think they were these:

http://docs.wxwidgets.org/2.8.6/wx_windowdeletionoverview.html
http://wiki.wxwidgets.org/Avoiding_Memory_Leaks

Key words: wxWidgets ownership responsibility deleting avoiding memory leaks deletion overview
« Last Edit: November 02, 2008, 04:15:59 pm by Pecan »

Fex

  • Guest
Re: wxSmith - tutorial
« Reply #43 on: November 04, 2008, 10:58:45 pm »
Thanks Pecan  :D

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5910
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: wxSmith - tutorial
« Reply #44 on: December 26, 2008, 05:28:35 pm »
I learned the hard way, that if you delete a control/frame/window that is owned by wxWidgets, wxWidets will have a stroke and die.

When a wxWidgets owned frame is destroyed by wxWidgets, all its children will be destoyed automatically.

The objects you need to delete are the ones you created outside the wxWidgets knowledge, such as "myvartype* myvar = new (myOwnArray)" etc. wxWidgets doesn't know about these.

There was a good post about this by Thomas on the forum some time back(Here), but the links became obsolete. I think they were these:

http://docs.wxwidgets.org/2.8.6/wx_windowdeletionoverview.html
http://wiki.wxwidgets.org/Avoiding_Memory_Leaks

Key words: wxWidgets ownership responsibility deleting avoiding memory leaks deletion overview

This is a good tutorials on wxWidgets creation and destroying! thanks for your explanation.
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.