lmi
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [lmi] A validating schema for wxxrc?


From: Greg Chicares
Subject: Re: [lmi] A validating schema for wxxrc?
Date: Sat, 28 Jul 2012 08:40:34 +0000
User-agent: Mozilla/5.0 (Windows NT 5.1; rv:14.0) Gecko/20120713 Thunderbird/14.0

I noticed this in a WXXRC file that I had written, and wondered whether it
makes sense to specify <flag> for wxStaticBoxSizer:

        <object class="sizeritem">
            <flag>wxGROW|wxALL</flag>
            <object class="wxStaticBoxSizer">
                <flag>wxGROW|wxALL</flag>   <!-- does this do anything? -->
                <orient>wxVERTICAL</orient>
                <label>Insured</label>
                <object class="sizeritem">
                    <flag>wxGROW|wxALL</flag>
                    <border>2</border>
                    <object class="wxFlexGridSizer">

I checked the online documentation:
  http://docs.wxwidgets.org/2.9.4/overview_xrcformat.html
which lists only <orient> and <label> as wxStaticBoxSizer properties, and
gives <flag> as a property only of 'sizeritem', 'spacer', and wxWrapSizer.
But I'm not sure that's meant to be exhaustive, so I wondered whether a
schema for WXXRC exists...and google pointed me to this mailing list. Did
we ever settle the question whether a schema for WXXRC can be written?

On 2007-06-10 20:37Z, Vadim Zeitlin wrote:
> On Sun, 10 Jun 2007 22:31:09 +0200 Evgeniy Tarassov <address@hidden> wrote:
> 
> ET> On 6/8/07, Greg Chicares <address@hidden> wrote:
[...]
> ET> > Here's an example of a few things that I guess would be caught at
> ET> > runtime, if someone actually loads this particular dialog, but which
> ET> > might be better to catch in a schema:
> ET> >
> ET> >   wxWidgets-2.8.3/samples/xrc/rc/derivdlg.xrc
> ET> >
> ET> > 37                 <object class="sizeritem">
> ET> > 38                     <flag>wxALIGN_CENTRE|wxALL</flag>
> ET> > 39                     <border>5</border>
> ET> > 40                     <object class="wxCheckBox" name="my_checkbox">
> ET> > 41                         <label>Enable listbox</label>
> ET> > 42                     </object>
> ET> > 43                 </object>
> ET> >
> ET> > Let me mangle that:
> ET> >
> ET> >                  <Objekt Klass="WxSizerItem">
> ET> >                      <flag>WxALIGN_IN_THE_CENTRE|wxBCE</flag>
> ET> >                      <border>cinq</border>
> ET> >                      <objet classe="wxChequeBox" nom="my_checkbox">
> ET> >
> ET> > I guess I don't often make mistakes like that, and I find them
> ET> > soon enough; but a schema would probably find them sooner, if I
> ET> > routinely used it before committing any wxxrc file.
> ET> 
> ET> That indeed would be a really good feature to have. Myself, I'm a
> ET> person that does a lot of errors (typing or spelling errors), that's
> ET> why working with XRC for me is rather painful experience (compared to
> ET> other tasks).
> 
>  Most of the errors above OTOH should be caught by the validation:
> 
> 1. "Objekt" (invalid tag name) definitely will
> 2. Assuming it's corrected to "object", both missing (required) "class"
>    attribute and the unknown "Klass" one will be detected too
> 3. <flag> contents will be validated too
> 4. non-numeric <border> argument should be caught (except it can also be
>    expressed in dialog units so it's not as simple as checking for whether
>    it's a number but the point is that it will still be caught)
> 
>  The "wxChequeBox" won't be a fatal error however as it could be a custom
> class. Hopefully there should be a warning along the lines of "unable to
> validate the contents of a custom class without custom schema" for it
> though.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]