On Mon, Oct 20, 2008 at 2:12 AM, Klaas Holwerda wrote:
> Bionic Badger wrote:
>
>>
>> So I created a wrapper class to enable the form builder to create an
>> a2dDocumentFrame instead of a wxFrame, and it seems to have fixed the
>> crashing-on-exit with respect to the dragging tool.  However, the
>> world-preview view still does not get drawn correctly at startup.  Is
>> there any way to force a post-layout re-render or something of that
>> sort to get it to redraw the contents, or a view invalidation?
>
> a2dCanvas::
>
> Refresh( true )
> void SetMappingShowAll( bool centre = true );
>
> OR
>
> drawerView->Update( a2dCANVIEW_UPDATE_ALL );
>
> a2dCANVIEW_UPDATE_ALL invalidates the wholebuffer of the view, and redraw it
> from the document. After that it generates a blit too in a2dCanavs::OnPaint
>
> Refresh same stuff more or less.

I think I've tried the SetMappingShowAll() and Refresh() (which is
called in that ZoomFull() function).  However, I didn't try the last
one.
>> Do you think in the future there could be a wxFrame-compatible
>> constructor for the a2dDocumentFrame?
>
> Only a constructor?
> In that case users needs to set the view afterwards. Not impossible, but ...

Yes, I have to do that, but it spares me having to manually create the
GUI for a given app, especially if I want to add new elements to it
(explained better below).

>  That way I wouldn't need to use
>>
>> a wrapper at all, and people could build interfaces directly using
>> a2dDocumentFrame in wxFormBuilder.
>
> Never used it. And don't understand why its needs such a constructor??
> Can you really use a2dDocumentFrame after that, or is it just a trick to
> make it work.

wxFormBuilder allows the user to design an interface using the
wxWidgets, by writing out the GUI code in a derived class, and then
the user derives *that* class for use in in their own programs.  It
also has nice event handling construction, etc. so that all the
aspects of GUI design are managed by the wxFormBuilder.  It works with
all the standard wxWidget widgets; however, it can be made to work
with non-wxWidget classes or derived classes, so long as they
replicate or extend the functionality of the originals.  This means
the constructor must be the same, and the custom class accepts the
same GUI construction methods as the original classes.  So if I wanted
to use my own custom class to replace the wxFrame that wxFormBuilder
expects to use, I need to ensure the constructor has the same
interface, and that I can create GUI elements inside it in much the
same manner.  Ther a2dDocumentFrame generally does this; however, the
constructor does not follow the same form of as a standard wxFrame, so
the parameters passed to it would conflict since wxFormBuilder just
generates source code for the interface, expecting a wxFrame
constructor.

So what I've done is make a class derived from a2dDocumentFrame with a
constructor interface that mimics the wxFrame.  However, as I don't
know the intricacies of the a2dDocumentFrame, I also have it calling
its parameterized constructor from this derived class's constructor,
as I was unsure whether a2dDocumentFrame requires setup code to enable
it to use wx GUI elements directly.  If that's so, I'll just let the
user call Create() instead of automatically calling it via the
constructor.

Take a look at wxFormBuilder.  It's actually quite nice for layouts,
and it'd be really nice to see some wxArt2D widgets added to it.

>> design aspect a lot easier.  It'd be really great if there were native
>> widgets that could be placed into the interface in wxFormBuilder, but
>> that'd be a pain to compile for it.  Here's the wrapper class I used
>> if anyone is interested.  Unfortunately, it makes some assumptions
>> about how the frame is initialized:
>
> Exactly, so that last part still needs to be done.

And that's really not too bad, since I end up performing them anyway.

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Wxart2d-users_dev mailing list
Wxart2d-users_dev@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wxart2d-users_dev

Reply via email to