octave-maintainers
[Top][All Lists]
Advanced

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

Re: [unclassified] Re: problem with radio values in color_property


From: Kai Habel
Subject: Re: [unclassified] Re: problem with radio values in color_property
Date: Thu, 05 Jul 2007 22:30:19 +0000
User-agent: IceDove 1.5.0.12 (X11/20070607)

Shai Ayal schrieb:
On 7/4/07, Kai Habel <address@hidden> wrote:

Now we can create a line object in octave:

octave:1> line([1 2],[1 2])
octave:2> h=line([1 2],[1 2])
h = -7
octave:3> get(h,'color')
ans = none

Fine, 'none' is chosen as default value, but if we try to change the
color to 'flat', this happens.

octave:4> set(h,'color','flat')
warning: invalid color specification
octave:5> get(h,'color')
ans =

   2.1220e-314   4.9407e-324   2.7025e-310

Apperently the set command fails, but I have no idea why. So, maybe you
can help here.
(Setting a color value e.g. 'r', 'red', [10 0] works fine.)

For all properties which are not based on a radio_value, the set of
allowable values is fixed at compile time, and so a constructor with
an octave_value as it's only argument can define the property. For
radio value based properties, the set of allowable values is defined
at run time, so we cannot construct such an object with just an
octave_value -- we need to specify the set of allowable values.

If you look at graphics.cc line 1567:
    color = color_property (val);
you see that set works by assigning a new object to color. This in
effect removes the set of allowable values and you are left with a
pure color properties. My solution is to add
 color_property& operator = (const octave_value& val)
which will check val as you do in your patch and then use
color = val
in line 1567. This would keep the set of allowable values, defined in
line_properties intact.

I am sorry not to be sending this as a patch -- I will have time later hopefully

Shai

Hello,

thanks for the tip regarding the assignment operator, that did it for me. So, I will wait for your patch on that ;-) and continue to work on the patch object.

Thanks again,
Kai


reply via email to

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