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: Evgeniy Tarassov
Subject: Re: [lmi] A validating schema for wxxrc?
Date: Sun, 10 Jun 2007 22:31:09 +0200

On 6/8/07, Greg Chicares <address@hidden> wrote:

Here's another example, using the same file:

-             <bitmap>basicdlg.xpm</bitmap>
+             <bitmap>basicdlg.XPM</bitmap>

Suppose that such an X pixmap exists, and its name is all lowercase.
Maybe it works under msw (just a guess), but won't under GNU/Linux.
Or suppose it were misspelled as, say, 'basicdlg.xmp': that's a typo
of which I know I'm capable.

It is very nice feature to have, but AFAIK it is not possible (in WXS
neither in RNG) to access filesystem information. But as you have
mentioned -- probably the best place to do such a validation would be
to check for files in C++ when the XRC files is first loaded:
wxXmlResource::Get()->Load("XXX.xrc");

Here's an example of a few things that I guess would be caught at
runtime, if someone actually loads this particular dialog, but which
might be better to catch in a schema:

  wxWidgets-2.8.3/samples/xrc/rc/derivdlg.xrc

37                 <object class="sizeritem">
38                     <flag>wxALIGN_CENTRE|wxALL</flag>
39                     <border>5</border>
40                     <object class="wxCheckBox" name="my_checkbox">
41                         <label>Enable listbox</label>
42                     </object>
43                 </object>

Let me mangle that:

                 <Objekt Klass="WxSizerItem">
                     <flag>WxALIGN_IN_THE_CENTRE|wxBCE</flag>
                     <border>cinq</border>
                     <objet classe="wxChequeBox" nom="my_checkbox">

I guess I don't often make mistakes like that, and I find them
soon enough; but a schema would probably find them sooner, if I
routinely used it before committing any wxxrc file.

That indeed would be a really good feature to have. Myself, I'm a
person that does a lot of errors (typing or spelling errors), that's
why working with XRC for me is rather painful experience (compared to
other tasks).

--
Best wishes,
Evgeniy Tarassov




reply via email to

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