lmi
[Top][All Lists]
Advanced

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

Re: [lmi] Quoting in diagnostic messages


From: Greg Chicares
Subject: Re: [lmi] Quoting in diagnostic messages
Date: Wed, 23 Nov 2005 15:42:13 +0000
User-agent: Mozilla Thunderbird 1.0.2 (Windows/20050317)

On 2005-11-23 12:26 UTC, Vadim Zeitlin wrote:
> On Wed, 23 Nov 2005 01:45:31 +0000 Greg Chicares <address@hidden> wrote:
> 
> GC> Wendy pointed out that messages like
> GC>   Value '' invalid
> GC> for empty strings are too easy to misread as
> GC>   Value " invalid
> GC> or even
> GC>   Value "invalid
> GC> with default msw fonts.
> 
>  This is why I think using double quotes is better.
> 
>       Value "" is invalid.
> 
> looks quite readable IMHO.

That does sound like a better idea. Probably we won't use it soon
because it looks like it would require changing 871 lines in 100 files:

  C:/lmi/src/lmi[0]$grep "<<.*'" *.?pp |wc -l
      871
  C:/lmi/src/lmi[0]$grep --files-with-matches "<<.*'" *.?pp |wc -l
      100

> GC> I think it would be best to spend our time instead on adding a
> GC> facility to copy the contents of the 'diagnostics' static-text
> GC> control.
> 
>  This is very useful regardless of the other considerations, of course.
> 
> GC> I tried making it a wxTE_READONLY | wxTE_NOHIDESEL
> GC> wxTextCtrl, but the builtin msw right-click handler wouldn't
> GC> copy its contents;
> 
>  This is strange, it should. I might look into this if you wish.

Sure, if you like: you might find something I overlooked.

Here's what I did, from memory:

 - change 'wxStaticText' to 'wxTextCtrl' here in 'xml_notebook.cpp':

  wxStaticText* XmlNotebook::DiagnosticsWindow()
  {
      // Confirm that the xml dialog resource provides a static-text
      // 'diagnostics' control.
      wxStaticText* diagnostics_window = dynamic_cast<wxStaticText*>
  ...

and in its header (which has a comment that would need to be changed);

 - change 'xml_notebook.xrc':

    <object class="wxStaticText" name="diagnostics">
        <style>wxSUNKEN_BORDER|wxST_NO_AUTORESIZE</style>

making the class 'wxTextCtrl' and the style 'wxTE_READONLY|wxTE_NOHIDESEL'
and noting that we'd have to change other '.xrc' files if this experiment
proves successful.

Right-clicking gave me the usual msw menu, but with only 'Select All'
and 'Paste' enabled, IIRC, but not 'Copy'.

> Also note
> that in any case you can copy wxTextCtrl contents by selecting it and doing
> Ctrl-C or Ctrl-Ins.

I didn't think of trying that.

> GC> so I think we'd be better off leaving it as a wxStaticText control
> 
>  It's possible but wxTextCtrl is simpler...

However, I seemed to sense a problem with focus treatment. At least for now
(and I have no plan to change this), the 'diagnostics' control is used only
for messages that complain about something invalid typed in a wxTextCtrl.
When that happens, lmi retains focus in the invalid field, so if this is
really a problem, it's a problem in every case where the 'diagnostics'
control would be used. I can't be more specific about the problem I think I
saw because I didn't investigate it; if it's for real, then I'm sure it can
be fixed.

You might ask why we don't use the 'diagnostics' control in other situations.
My answer is that controls other than wxTextCtrl don't need it, because they
can make invalid input impossible. A checkbox can be grayed if it mustn't be
changed. A combobox can permit only valid choices. And so on. There are some
cases that pop up a messagebox, but I think those indicate logic problems
that should be addressed by fixing them instead of changing the way they're
reported.




reply via email to

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