Angus Leeming wrote:
> 
> Incidentally, you remember your request about removing the 
> text_warning area and instead setting the widget label to red if 
> the input is invalid?
> 
> Well attached is a proper patch that does just this for 
> LyXGlueLengths and which I have implemented for the Space Above 
> field in the paragraph dialog.
> 
> Perhaps you might like to try it out and incorporate it in your 
> mega patch if it does as you desire.

Sure, YES! I'll happily add this to my patch here and extend its use
into the other forms as well. I have two comments/questions.

With your setup, a call in, f.ex. FormParagraph.C, is as follows:

 > +
 > +    bc().addCheckedWidget(
 > +            new CheckedGlueLength(dialog_->input_space_above,
 > +                                  dialog_->choice_value_space_above,
 > +                                  dialog_->choice_space_above));

This is very specific for the Paragraph case, which has a choice, input and
a unit-choice. However, generally a length + unit has not the last choice entry.
For example see Width & Height input in the graphics dialog.

So the third argument should be removed altogher, or default to NULL, in which
case NULL must be ignored when trying to change the color of its label.
If the input is invalid, also color the background of the inputfield FL_RED
for the case the third argument was NULL.

Another thing: if every call to "bc().addCheckedWidget()" requires a
"new CheckedGlueLength()" call, I'd rather move the creation of the new class
object into addCheckedWidget(), so we will only need to type:

        bc().addCheckedWidget(dialog_->input_space_above,
                                dialog_->choice_value_space_above);

Or would that violate a fundamental C++ rule?

How about rename "addCheckedWidget()" into "addCheckGlueLength()"?

Regards,
Rob.
-----------------
PS: how do you create a diff file from CVS with new files showing up in the
diff file as:

Index: src/frontends/xforms/checkedwidgets.h
===================================================================
RCS file: src/frontends/xforms/checkedwidgets.h
diff -N src/frontends/xforms/checkedwidgets.h
--- /dev/null   1 Jan 1970 00:00:00 -0000

When I do "cvs diff -Nu > cvs.diff", the file has in the top lines:
? src/frontends/xforms/checkedwidgets.C
? src/frontends/xforms/checkedwidgets.h

Without the contents of the new files in the diff.

Reply via email to