André Bargull wrote:
I wonder if we really should be examining the contract of __initTextProperties; should it really be getting the whole args list, or just a subset?
It's just easier to pass the whole args list, let me sum up which attributes are needed in each runtime:
DHTML:
text+inputtext: font, fontsize, fontstyle
=> easy going

SWF:
text: password, selectable, multiline, font, fontsize, fontstyle, height
inputtext: password, selectable, multiline, font, fontsize, fontstyle, text, width, height, maxlength, pattern
=> hmm, a bit more...
So, that's why we're doing this kludge.

And... I see that __initTextProperties seems to already look for LzInitExpr for some of its args. It seems we ought to be doing this in one place or the other not some in each.
That depends on the runtime, e.g. dhtml doesn't care about any constraints for "height", whereas swf needs/wants to do some special tricks... :-(

Actually, it would be really nice if DHTML automatically sized its height as well.

Would it be simpler if at the LzText level we just look for the font properties not being defined and default them to parent value, and then worry about the LzInitExpr in __initTextProperties?
Then we're going to have three times the same code for each runtime. Because apparently we need to have these initial font-infos at the very beginning (for textwidth calculations?).

Can't we pass a single hash of values to initTextProperties() and have it do its thing?

On 5/28/2008 7:39 PM, P T Withington wrote:
That's a bit clearer.

I wonder if we really should be examining the contract of __initTextProperties; should it really be getting the whole args list, or just a subset? Then you wouldn't have to smash args back and forth. And... I see that __initTextProperties seems to already look for LzInitExpr for some of its args. It seems we ought to be doing this in one place or the other not some in each.

Would it be simpler if at the LzText level we just look for the font properties not being defined and default them to parent value, and then worry about the LzInitExpr in __initTextProperties?

On 2008-05-28, at 12:27 EDT, André Bargull wrote:

Less voodoo in the LFC?  :-)
(To be honest, I wasn't really convinced by my work, too. But on the other hand, I didn't want to blow up the code resp. slow it down too much: e.g. by having two booleans variables per argument, which would have been a waste as I don't want to save 2^2 states,
or by creating a copy of the args-object through LzInheritedHash.)

So, next try. Maybe that's easier to follow:
var argsMap:Object = {font:fontname, fontsize:fontsize, fontstyle:fontstyle};
   var argsCpy:Object = {};
   for (var key:String in argsMap) {
       var val:String = argsMap[key];
var hasArg:Boolean = (key in args) ? true : false;//swf9 forces me to do this...
       var initExpr:Boolean = hasArg && args[key] is LzInitExpr;
       argsCpy[key] = initExpr ? args[key] : LzNode._ignoreAttribute;
       if (hasArg && !initExpr) {
           this[val] = args[key];
       } else {
           this[val] = args[key] = this.searchParents( val )[ val ];
       }
   }
var tsprite:LzTextSprite = (this.sprite cast LzTextSprite); tsprite.__initTextProperties(args);
       for (var key:String in argsCpy) {
       args[key] = argsCpy[key];
   }


On 5/28/2008 5:18 PM, P T Withington wrote:
Is there any way we could straighten out the logic so it is easier to understand? I'm having a hard time figuring out what's going on here. Since you set and read the tri-state flags within a few lines of each other, it seems there ought to be an easier way to do this.

On 2008-05-24, at 19:18 EDT, André Bargull wrote:

Update: last change contained a braino, which is now fixed.

Change 20080524-bargull-KxK by [EMAIL PROTECTED] on 2008-05-24 23:55:34
in /home/Admin/src/svn/openlaszlo/trunk
for http://svn.openlaszlo.org/openlaszlo/trunk

Summary: make font-attributes constrainable again

New Features:

Bugs Fixed: LPP-6038

Technical Reviewer: ptw
QA Reviewer: promanik
Doc Reviewer: (pending)

Documentation:

Release Notes:

Details:
Font attribute (fontname, fontsize, fontstyle) are special cased in "LzText#construct(..)". And since constraints are no longer held in the
$refs object, the special casing need to be adjusted.


Tests:

Files:
M WEB-INF/lps/lfc/views/LzText.lzs

Changeset: http://svn.openlaszlo.org/openlaszlo/patches/20080524-bargull-KxK.tar








--
Regards,
Max Carlson
OpenLaszlo.org

Reply via email to