[Oberon] WMProperties.StringProperty

Dan Parnete dan.parnete at fastwebnet.it
Tue Nov 22 15:36:29 CET 2005


Ulrike Glavitsch wrote:

> Hello,
>
> the way the empty element is treated in a StringProperty so far is to 
> have a NIL-pointer in the value-field of the StringProperty. There are 
> several locations in the code, e.g. PROCEDURE DrawBackground in 
> WMStandardComponents.Button, that depend on this convention.
> So we basically have two options:
> (1) we leave the code as it is with the implication that programmers 
> need to know that the empty element is represented by a NIL value or
> (2) we make the proposed change but have to adapt all pieces of code 
> that are affected by this change.
> I agree that it is more consistent to represent an empty string in an 
> existing string object.
>
> As the correction requires a bit of work (implementation and tests) it 
> will not come in the very next release. But thanks for the proposal.
>
> Ulla Glavitsch
>
> Dan Parnete wrote:
>
>> Hello,
>>
>> The properties could be set by FromXML method. The StringProperty 
>> could not be reseted by FormXML because it doesn't treat the empty 
>> element.
>> I propose this correction:
>>
>>        PROCEDURE FromXML*(xml : XML.Element);
>>            VAR en : XMLObjects.Enumerator;
>>            p : PTR;
>>        BEGIN
>>            en := xml.GetContents();
>>            p := en.GetNext();
>>            IF p # NIL THEN
>>                IF p IS XML.Chars THEN
>>                    Set(p(XML.Chars).GetStr())
>>                END
>>            ELSE  Set(Utilities.NewString(""))
>>            END
>>        END FromXML;
>>
>> Thanks,
>> Dan Parnete
>> -- 
>> Oberon at lists.inf.ethz.ch mailing list for ETH Oberon and related systems
>> https://lists.inf.ethz.ch/mailman/listinfo/oberon
>
>
>
>
I agree with the NIL value. But the problem here is the actual code did 
not set the NIL value. If you want to put:
    ELSE Set(NIL)
it's fine. Now ELSE doesn't exist, and that excludes the possibility to 
reset the string property using en empty element like <strprop/>.

Thanks,
Dan Parnete


More information about the Oberon mailing list