CWnd::PreCreateWindow

If you are using the main C++ distribution of wxWidgets, Feel free to ask any question related to wxWidgets development here. This means questions regarding to C++ and wxWidgets, not compile problems.
Post Reply
mubashar
Knows some wx things
Knows some wx things
Posts: 38
Joined: Mon Nov 01, 2004 3:26 am
Location: Lahore, Pakistan

CWnd::PreCreateWindow

Post by mubashar » Tue Nov 02, 2004 7:10 am

hello :(

What is the Replacement of overrideable function CWnd::PreCreateWindow and CWnd::OnNotify (MFC) in wxWindow class of wxWidgets.



i am waiting axiously .... :( :( :( :(
i was master of wxWidgets just! forgotton how to build :(

Jorg
Moderator
Moderator
Posts: 3971
Joined: Fri Aug 27, 2004 9:38 pm
Location: Delft, Netherlands
Contact:

Post by Jorg » Tue Nov 02, 2004 7:43 am

There is none as far as I know. Why would you ""stop" creating a window? Consider the following:

button *but = wxMyButton(...);
but->Enable(false);

If there would be such a thing as PreCreateWindow, the new constructor would have to return 0 as pointer, or the window itself should not be valid. That means for every control I create I have to check first that the window is valid or not. In my oponion this is a silly MFC quirk and should not be used because it makes your code unstable and unpredictable.

I am quite interested what you want to do yourself in this method anyway. In all my years of MFC programming I have never used it.

As for OnNotify I think you can substitute any other event for that it depends on what you want to "notify". It might be a usful addition to wxWidgets to send user notification messages to controls, but they would be more generic, so you can attach a class or what else.

HTH,
- Jorgen
Forensic Software Engineer
Netherlands Forensic Insitute
http://english.forensischinstituut.nl/
-------------------------------------
Jorg's WasteBucket
http://www.xs4all.nl/~jorgb/wb

mubashar
Knows some wx things
Knows some wx things
Posts: 38
Joined: Mon Nov 01, 2004 3:26 am
Location: Lahore, Pakistan

Post by mubashar » Tue Nov 02, 2004 7:56 am

Jorg wrote: I am quite interested what you want to do yourself in this method anyway. In all my years of MFC programming I have never used it.
Well i also never used it... :( it all have done by our PM but he also didn't pur any extra implimentation in it. wel ok let it go....

OnNotify: if there are some event against this function then one must write handler of these events each time in the container class. and if we have some orriderable function then we can write a sigle function in drived class and this works more easily... what do you say ...
i was master of wxWidgets just! forgotton how to build :(

ezequielv
Earned a small fee
Earned a small fee
Posts: 19
Joined: Sun Oct 10, 2004 9:20 pm
Location: Berkshire, England

Post by ezequielv » Tue Nov 02, 2004 10:15 am

Jorg wrote:As for OnNotify I think you can substitute any other event for that it depends on what you want to "notify". It might be a usful addition to wxWidgets to send user notification messages to controls, but they would be more generic, so you can attach a class or what else.
Please see Observer pattern (aka. Notifications) for wxWidgets.

I'm still working on it, and I've added templates support to it to make it more strongly-typed. The templates support is optional, and you can still use the classic wxWidgets style (that is, using wxObject-based classes) for the "notification destination" class.

I think it's looking good, and I can use some ideas/suggestions, especially from wxWidgets veterans :)

Post Reply