News:

When registered with our forums, feel free to send a "here I am" post here to differ human beings from SPAM bots.

Main Menu

wxSmith - tutorial

Started by byo, November 05, 2005, 12:18:33 AM

Previous topic - Next topic

wxSchmidt

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)

byo

Quote from: wxSchmidt 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)

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

Adam01

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?

Jenna

Quote from: Adam01 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?

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.

Adam01

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.

Adam01

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?

byo

You can use such scheme to convert wxString into const char*:

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

Master

#37
hello , and sorry i just figured it out that i shouldnt have posted here ! ,

many tanx MortenMacFly
a man's dream is an index to his greatness...

MortenMacFly

Quote from: Master on October 04, 2008, 10:28:15 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.
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: [url="https://www.codeblocks.org/docs/main_codeblocks_en.html"]https://www.codeblocks.org/docs/main_codeblocks_en.html[/url]
C::B FAQ: [url="https://wiki.codeblocks.org/index.php?title=FAQ"]https://wiki.codeblocks.org/index.php?title=FAQ[/url]

Master

Quote from: MortenMacFly on October 04, 2008, 03:50:50 PM
Quote from: Master on October 04, 2008, 10:28:15 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.
tanx, edited .
a man's dream is an index to his greatness...

Grom

#40
Quote from: MortenMacFly on October 04, 2008, 03:50:50 PM
Quote from: Master on October 04, 2008, 10:28:15 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:
gcc+winXP+suse.

Fex

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
void Tutorial_4Frame::OnButton3Click(wxCommandEvent& event)
{
    FirstFrame* frm = new FirstFrame(this);
    frm->Show();
}


Shouldn't there be a

delete frm;

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

Fex.

Pecan

#42
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

Fex


ollydbg

Quote from: Pecan 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

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.