On Sun, 21 May 2000, Mike Nordell wrote:

> Martin Sevior wrote:
> 
> > The widget pointer is cast as a (void *) and stored that way in
> > xap_App. If there is no running id the value of the pointer
> > is (void *) NULL, which is valid C++ on all platforms.
> 
> So is storing a Win32 HWND or a BeOS BWindow* as a void* in the
> baseclass, but it's  still platform dependent data (albeit in "hidden"
> form) in XP code. 

Yes, that was EXACTLY the idea. Every platform needed to be able to get to
a centrally stored widget pointer. The best place to put them all was in
XAP_App since then I only need to write the code once, not N times for
XAP_UnixApp, XAP_WinApp etc. I needed
this at first when I was doing my bottom-up coding to make the thing work.
Now I can see I don't need to store platform-specfic widget pointers in
XAP_App. However I will rewrite isRunning so that it is only in
XAP_Dialog_Modeless and not a virtual function without refering to widget
pointers. It doesn't need to be virtual since if it's "ID" is in the
modelessID table in xap_App it running. 

I've always been a bottom-up programmer. I think the best way to
write C++ is do bottom up coding to work out how to code it and to find
out just what you need to make a task work. After that the bottom up
design can be rewritten into a proper class heiracy. Of course this won't
always work but it is a good way for me to procede right now.

> can't really *get* to that data, much less *set* it, without violating
> some very basic design principles, and in that case that void* is
> probably the lesser of the problems.
> 
 While I agree with the asthetics of this sometimes pragmatism has its
place. That code got the modeless dialogs up and running solid. I can see
this point now and in fact there is a fair bit of extraneous code left
over from the original implementation. I'll clean all that up and
hopefully fix Jaoquin's segfault by tomorrow night.

Cheers

Martin





Reply via email to