You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@flex.apache.org by gpi <gr...@inosa.no> on 2014/06/13 09:48:30 UTC

setStyle destroy UndoManager

Hi,
during programming I found strange problem with UndoManager related to
textFlow in RichEditableText. When I try to set some style for RET (by
setStyle), all steps stored in UndoManager are reseting.

Here is simple example online:
http://op2.pl/undo/test.swf <http://op2.pl/undo/test.swf>  

When enter some text an click "Undo" - everything is ok, but when after
enter text click on "Set Style" (ret.setStyle('backgroundColor',
'#CC6699');) - Undo doesn't work.



--
View this message in context: http://apache-flex-users.2333346.n4.nabble.com/setStyle-destroy-UndoManager-tp6827.html
Sent from the Apache Flex Users mailing list archive at Nabble.com.

Re: setStyle destroy UndoManager

Posted by gpi <gr...@inosa.no>.
Thank you Jake for your reply, but I'm affraid that is no lost focus problem.
I added one more empty button, and when I click on it (focus is lost from
RET) UndoManager still working.



--
View this message in context: http://apache-flex-users.2333346.n4.nabble.com/setStyle-destroy-UndoManager-tp6827p6833.html
Sent from the Apache Flex Users mailing list archive at Nabble.com.

Re: setStyle destroy UndoManager

Posted by gpi <gr...@inosa.no>.
Last method is "setBg":

private function setBg(e:MouseEvent)



--
View this message in context: http://apache-flex-users.2333346.n4.nabble.com/setStyle-destroy-UndoManager-tp6827p6888.html
Sent from the Apache Flex Users mailing list archive at Nabble.com.

Re: setStyle destroy UndoManager

Posted by Alex Harui <ah...@adobe.com>.
The code example does not look complete.  Should there be code for setBG()?

On 6/17/14 1:23 AM, "gpi" <gr...@inosa.no> wrote:

>Any ideas ?
>
>
>
>--
>View this message in context:
>http://apache-flex-users.2333346.n4.nabble.com/setStyle-destroy-UndoManage
>r-tp6827p6858.html
>Sent from the Apache Flex Users mailing list archive at Nabble.com.


Re: setStyle destroy UndoManager

Posted by gpi <gr...@inosa.no>.
Any ideas ?



--
View this message in context: http://apache-flex-users.2333346.n4.nabble.com/setStyle-destroy-UndoManager-tp6827p6858.html
Sent from the Apache Flex Users mailing list archive at Nabble.com.

Re: setStyle destroy UndoManager

Posted by gpi <gr...@inosa.no>.
This is code of this example:    

<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
creationComplete="init()"><s:layout><s:VerticalLayout /></s:layout>
<fx:Script></fx:Script>

        <s:Label text="Write text under:" />
	<s:RichEditableText id="ret" width="300" height="80"
selectionHighlighting="whenActive" />
	<s:Button label="Undo" id="undo" click="doUndo(event)" />
	<s:Button label="Set Style"  click="setBg(event)" />
	<s:Button label="Custom button" />

</s:Application>



--
View this message in context: http://apache-flex-users.2333346.n4.nabble.com/setStyle-destroy-UndoManager-tp6827p6837.html
Sent from the Apache Flex Users mailing list archive at Nabble.com.

Re: setStyle destroy UndoManager

Posted by Jake Knerr <ja...@ardisialabs.com>.
gpi,

Please post the code for the small example you created.  Thanks.

- Jake


On Fri, Jun 13, 2014 at 4:18 AM, gpi <gr...@inosa.no> wrote:

> Thank you Jake for your reply, but I'm affraid that problem is not in lost
> focus. I added one more empty button, and when I click on it (focus is lost
> from RET) UndoManager working OK.
>
>
>
> --
> View this message in context:
> http://apache-flex-users.2333346.n4.nabble.com/setStyle-destroy-UndoManager-tp6827p6834.html
> Sent from the Apache Flex Users mailing list archive at Nabble.com.
>

Re: setStyle destroy UndoManager

Posted by gpi <gr...@inosa.no>.
Thank you Jake for your reply, but I'm affraid that problem is not in lost
focus. I added one more empty button, and when I click on it (focus is lost
from RET) UndoManager working OK.



--
View this message in context: http://apache-flex-users.2333346.n4.nabble.com/setStyle-destroy-UndoManager-tp6827p6834.html
Sent from the Apache Flex Users mailing list archive at Nabble.com.

Re: setStyle destroy UndoManager

Posted by Jake Knerr <ja...@ardisialabs.com>.
Hi gpi,

When the RichEditableText component loses focus it clears all undo steps by
default.  Therefore, in your demo when you click the "setStyle" button the
editable text loses focus and the undo steps are lost. This is the expected
behavior.

To prevent this from happening you need to set the "clearUndoOnFocusOut"
property to false for the RichEditableText component. Unfortunately, this
property is marked mx_internal so you access it you must include the
mx_internal namespace.

Hope this helps.

- Jake


On Fri, Jun 13, 2014 at 1:48 AM, gpi <gr...@inosa.no> wrote:

> Hi,
> during programming I found strange problem with UndoManager related to
> textFlow in RichEditableText. When I try to set some style for RET (by
> setStyle), all steps stored in UndoManager are reseting.
>
> Here is simple example online:
> http://op2.pl/undo/test.swf <http://op2.pl/undo/test.swf>
>
> When enter some text an click "Undo" - everything is ok, but when after
> enter text click on "Set Style" (ret.setStyle('backgroundColor',
> '#CC6699');) - Undo doesn't work.
>
>
>
> --
> View this message in context:
> http://apache-flex-users.2333346.n4.nabble.com/setStyle-destroy-UndoManager-tp6827.html
> Sent from the Apache Flex Users mailing list archive at Nabble.com.
>