(There is a paragraph missing. The complete text is:)

I'm happy to say that the openlaszlo 4.6.1 release fixed some miscellaneous view discrepancies that were cropping up in 4.5, mostly all revolving around how things are stretched or pixellocked, or some combination therein. Sometimes things that were 1px tall were stretched to 2 px when i didn't want it, and that's gone away. They all look normal again, so thank you.

There is one problem i'm having about clickability i'd like to share. I have a view that is clickable="false" when i think it should not have to be, and even adding that clause doesn't make it invisible to clicks. i refer to the following line:

<text name="label_view" align="center" valign="middle" text="${parent.label}" fgcolor="0xcccccc" clickable="false"/>

where i don't believe that it should be clickable without a subhandler, etc, even given the attribute. Am I correct?

The following complete class and instantiating line in SWF9 demonstrate this, i believe.

<!-- field is like a normal edittext that has a default value
         which persists until input is received -->

<class name="field" extends="edittext" fgcolor="green">
<attribute name="label" type="string" value=" "/>
<attribute name="original_text" type="string"/>
<attribute name="altered" type="boolean"/>
<attribute name="success" type="boolean"/>

<!-- when we are first made display our label -->
<handler name="oninit">
            this.setAttribute('text', this.original_text);
</handler>

<!-- when we get focus remove feedback -->
<handler name="onfocus">
            Utils.anim(this.feedback, 'opacity', 0);
            this.label_view.setAttribute('opacity', 0);
</handler>

<!-- when success is true/false/null, reflect that state -->
<handler name="onsuccess">
            if(this.success === true){
                this.feedback.setAttribute('bgcolor', '0x00ff00');
                this.feedback.setAttribute('opacity', 0.5);
                Utils.anim(this.feedback, 'opacity', 0.1, 1000, {});
            }

            else if(this.success === false){
                this.feedback.setAttribute('bgcolor', '0xff0000');
                this.feedback.setAttribute('opacity', 0.5);
                Utils.anim(this.feedback, 'opacity', 0.2, 1000, {});
            }

            else if(this.success === null){
                Utils.anim(this.feedback, 'opacity', 0);
            }
</handler>

<!-- when we lose focus, if we have no input reset the field, else run the validation on the input -->
<handler name="onblur">
            if(this['text'] == '')
                this.label_view.setAttribute('opacity', 1);
            else
                this.setAttribute('success', this.validate(true));
</handler>

<!-- when the text is explicitly set, capture it as our 'original_text' and calcuate whether we are altered from that -->
<handler name="ontext">
<![CDATA[
                if(this['text'] == '')
                    this.label_view.setAttribute('opacity', 1);
                else
                    this.label_view.setAttribute('opacity', 0);

                this.setAttribute('original_text', this['text']);
                this.setAttribute('altered', false);
            ]]>
</handler>

<!-- calcuate whether we are altered from the stored 'original_text' -->
<handler name="onvalue">
<![CDATA[
this.setAttribute('altered', (this['text'] != this['original_text']));
            ]]>
</handler>

<!-- this resets the field to the original state -->
<method name="reset">
if(this['text'] == '') this.setAttribute('text', this['label']); else this.setAttribute('text', this['original_text']);

            Utils.anim(this.feedback, 'opacity', 0);
</method>

<!-- override this to make your own validation evaluation -->
<method name="validate" args="ignore">
            return null;
</method>

<view name="feedback" x="0" y="0" width="${parent.width}" height="${parent.height}" bgcolor="green" opacity="0.0"/> <text name="label_view" align="center" valign="middle" text="${parent.label}" fgcolor="0xcccccc" clickable="false"/>
</class>

<!-- if a link is already set display it, and if not have a default. When text changes from default, enable link button --> <field valign="middle" x="20" width="${parent.width-40}" label="http://yoursite.com"/>


thanks,

.james robey.

Reply via email to