Re: [flexcoders] TextArea.text confusion
Exactly. Thanks for the tip, Alex. R. On 3/16/07, Alex Harui [EMAIL PROTECTED] wrote: Sounds like he wants the light grey add comments in the TA and then have it clear on focus in. For sure, textChanged will be false by the time you get back from super.commitProperties so I think I'd check the text before calling super.commitProperties and change it to the default if needed. -- *From:* flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] *On Behalf Of *Tracy Spratt *Sent:* Thursday, March 15, 2007 5:33 PM *To:* flexcoders@yahoogroups.com *Subject:* RE: [flexcoders] TextArea.text confusion What is the problem behavior? I need a bit more detail before I run or analyze the code. Tracy -- *From:* flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] *On Behalf Of *Roman Protsiuk *Sent:* Thursday, March 15, 2007 7:04 AM *To:* flexcoders@yahoogroups.com *Subject:* [flexcoders] TextArea.text confusion Hi, all. I'm extending TextArea to make it show default text if it's empty. It will be cleared (if needed) on focusIn. The problem I've faced is that when I set text property in commitProperties method that text isn't shown in the TextArea itself. :\ Following is my class: package { import flash.display.DisplayObject; import flash.events.FocusEvent; import mx.controls.TextArea; public class ExtendedTextArea extends TextArea { public function get defaultText() : String { return _defaultText; } public function set defaultText(value : String) : void { _defaultText = value; _defaultTextChanged = true; invalidateProperties(); } public function get defaultTextFunctional() : Boolean { return _defaultTextFunctional; } public function set defaultTextFunctional(value : Boolean) : void { _defaultTextFunctional = value; } override public function get text() : String { if (_showingDefaultText) { return ; } else { return super.text; } } override public function set text(value : String) : void { super.text = value; _textChanged = true; invalidateProperties(); } override protected function commitProperties() : void { super.commitProperties (); if ((_textChanged || _defaultTextChanged) text == ) { setText(_defaultText, true); } _textChanged = false; _defaultTextChanged = false; } override protected function focusInHandler(event : FocusEvent) : void { super.focusInHandler(event); if (contains(DisplayObject( event.target)) _showingDefaultText !_defaultTextFunctional) { setText(); } } override protected function focusOutHandler(event : FocusEvent) : void { super.focusOutHandler(event); if (contains(DisplayObject(event.target)) !_defaultTextFunctional text == ) { setText(_defaultText, true); } } private function setText(value : String, isDefaultText : Boolean = false) : void { text = value; _showingDefaultText = isDefaultText; } private var _defaultText : String = ; private var _defaultTextChanged : Boolean; private var _textChanged : Boolean; private var _showingDefaultText : Boolean; private var _defaultTextFunctional : Boolean; } } The class is far from complete. Here's sample application: ?xml version=1.0 encoding=utf-8? mx:Application xmlns:mx=http://www.adobe.com/2006/mxml; layout=vertical ExtendedTextArea width=220 height=80 defaultText=Album description goes here... / mx:Button label=button / /mx:Application Can anyone explain me this behavior and/or where is my mistake? Thanks, R.
Re: [flexcoders] TextArea.text confusion
The working version of this component (ExtendedTextArea) can be found here http://roma-ch.blogspot.com/2007/03/one-down-more-to-go.html. Thanks everyone, R.
[flexcoders] TextArea.text confusion
Hi, all. I'm extending TextArea to make it show default text if it's empty. It will be cleared (if needed) on focusIn. The problem I've faced is that when I set text property in commitProperties method that text isn't shown in the TextArea itself. :\ Following is my class: package { import flash.display.DisplayObject; import flash.events.FocusEvent; import mx.controls.TextArea; public class ExtendedTextArea extends TextArea { public function get defaultText() : String { return _defaultText; } public function set defaultText(value : String) : void { _defaultText = value; _defaultTextChanged = true; invalidateProperties(); } public function get defaultTextFunctional() : Boolean { return _defaultTextFunctional; } public function set defaultTextFunctional(value : Boolean) : void { _defaultTextFunctional = value; } override public function get text() : String { if (_showingDefaultText) { return ; } else { return super.text; } } override public function set text(value : String) : void { super.text = value; _textChanged = true; invalidateProperties(); } override protected function commitProperties() : void { super.commitProperties(); if ((_textChanged || _defaultTextChanged) text == ) { setText(_defaultText, true); } _textChanged = false; _defaultTextChanged = false; } override protected function focusInHandler(event : FocusEvent) : void { super.focusInHandler(event); if (contains(DisplayObject(event.target)) _showingDefaultText !_defaultTextFunctional) { setText(); } } override protected function focusOutHandler(event : FocusEvent) : void { super.focusOutHandler(event); if (contains(DisplayObject(event.target)) !_defaultTextFunctional text == ) { setText(_defaultText, true); } } private function setText(value : String, isDefaultText : Boolean = false) : void { text = value; _showingDefaultText = isDefaultText; } private var _defaultText : String = ; private var _defaultTextChanged : Boolean; private var _textChanged : Boolean; private var _showingDefaultText : Boolean; private var _defaultTextFunctional : Boolean; } } The class is far from complete. Here's sample application: ?xml version=1.0 encoding=utf-8? mx:Application xmlns:mx=http://www.adobe.com/2006/mxml; layout=vertical ExtendedTextArea width=220 height=80 defaultText=Album description goes here... / mx:Button label=button / /mx:Application Can anyone explain me this behavior and/or where is my mistake? Thanks, R.
RE: [flexcoders] TextArea.text confusion
What is the problem behavior? I need a bit more detail before I run or analyze the code. Tracy From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Roman Protsiuk Sent: Thursday, March 15, 2007 7:04 AM To: flexcoders@yahoogroups.com Subject: [flexcoders] TextArea.text confusion Hi, all. I'm extending TextArea to make it show default text if it's empty. It will be cleared (if needed) on focusIn. The problem I've faced is that when I set text property in commitProperties method that text isn't shown in the TextArea itself. :\ Following is my class: package { import flash.display.DisplayObject; import flash.events.FocusEvent; import mx.controls.TextArea; public class ExtendedTextArea extends TextArea { public function get defaultText() : String { return _defaultText; } public function set defaultText(value : String) : void { _defaultText = value; _defaultTextChanged = true; invalidateProperties(); } public function get defaultTextFunctional() : Boolean { return _defaultTextFunctional; } public function set defaultTextFunctional(value : Boolean) : void { _defaultTextFunctional = value; } override public function get text() : String { if (_showingDefaultText) { return ; } else { return super.text; } } override public function set text(value : String) : void { super.text = value; _textChanged = true; invalidateProperties(); } override protected function commitProperties() : void { super.commitProperties (); if ((_textChanged || _defaultTextChanged) text == ) { setText(_defaultText, true); } _textChanged = false; _defaultTextChanged = false; } override protected function focusInHandler(event : FocusEvent) : void { super.focusInHandler(event); if (contains(DisplayObject( event.target)) _showingDefaultText !_defaultTextFunctional) { setText(); } } override protected function focusOutHandler(event : FocusEvent) : void { super.focusOutHandler(event); if (contains(DisplayObject(event.target)) !_defaultTextFunctional text == ) { setText(_defaultText, true); } } private function setText(value : String, isDefaultText : Boolean = false) : void { text = value; _showingDefaultText = isDefaultText; } private var _defaultText : String = ; private var _defaultTextChanged : Boolean; private var _textChanged : Boolean; private var _showingDefaultText : Boolean; private var _defaultTextFunctional : Boolean; } } The class is far from complete. Here's sample application: ?xml version=1.0 encoding=utf-8? mx:Application xmlns:mx=http://www.adobe.com/2006/mxml http://www.adobe.com/2006/mxml layout=vertical ExtendedTextArea width=220 height=80 defaultText=Album description goes here... / mx:Button label=button / /mx:Application Can anyone explain me this behavior and/or where is my mistake? Thanks, R.
RE: [flexcoders] TextArea.text confusion
Sounds like he wants the light grey add comments in the TA and then have it clear on focus in. For sure, textChanged will be false by the time you get back from super.commitProperties so I think I'd check the text before calling super.commitProperties and change it to the default if needed. From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Tracy Spratt Sent: Thursday, March 15, 2007 5:33 PM To: flexcoders@yahoogroups.com Subject: RE: [flexcoders] TextArea.text confusion What is the problem behavior? I need a bit more detail before I run or analyze the code. Tracy From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Roman Protsiuk Sent: Thursday, March 15, 2007 7:04 AM To: flexcoders@yahoogroups.com Subject: [flexcoders] TextArea.text confusion Hi, all. I'm extending TextArea to make it show default text if it's empty. It will be cleared (if needed) on focusIn. The problem I've faced is that when I set text property in commitProperties method that text isn't shown in the TextArea itself. :\ Following is my class: package { import flash.display.DisplayObject; import flash.events.FocusEvent; import mx.controls.TextArea; public class ExtendedTextArea extends TextArea { public function get defaultText() : String { return _defaultText; } public function set defaultText(value : String) : void { _defaultText = value; _defaultTextChanged = true; invalidateProperties(); } public function get defaultTextFunctional() : Boolean { return _defaultTextFunctional; } public function set defaultTextFunctional(value : Boolean) : void { _defaultTextFunctional = value; } override public function get text() : String { if (_showingDefaultText) { return ; } else { return super.text; } } override public function set text(value : String) : void { super.text = value; _textChanged = true; invalidateProperties(); } override protected function commitProperties() : void { super.commitProperties (); if ((_textChanged || _defaultTextChanged) text == ) { setText(_defaultText, true); } _textChanged = false; _defaultTextChanged = false; } override protected function focusInHandler(event : FocusEvent) : void { super.focusInHandler(event); if (contains(DisplayObject( event.target)) _showingDefaultText !_defaultTextFunctional) { setText(); } } override protected function focusOutHandler(event : FocusEvent) : void { super.focusOutHandler(event); if (contains(DisplayObject(event.target)) !_defaultTextFunctional text == ) { setText(_defaultText, true); } } private function setText(value : String, isDefaultText : Boolean = false) : void { text = value; _showingDefaultText = isDefaultText; } private var _defaultText : String = ; private var _defaultTextChanged : Boolean; private var _textChanged : Boolean; private var _showingDefaultText : Boolean; private var _defaultTextFunctional : Boolean; } } The class is far from complete. Here's sample application: ?xml version=1.0 encoding=utf-8? mx:Application xmlns:mx=http://www.adobe.com/2006/mxml http://www.adobe.com/2006/mxml layout=vertical ExtendedTextArea width=220 height=80 defaultText=Album description goes here... / mx:Button label=button / /mx:Application Can anyone explain me this behavior and/or where is my mistake? Thanks, R.