How to apply text formatting immediately?

Hello!
I apply text formatting to the empty newly created text flow. It seems to be strange that the formatting is not applied immediately, but when I start editing.
The small sample demonstrates the problem.
<?xml version="1.0" encoding="utf-8"?>
<mx:Application 
xmlns:mx="http://www.adobe.com/2006/mxml"layout="
vertical"creationComplete="onCreationComplete()"
>
<mx:Script>
<![CDATA[
import flashx.textLayout.events.FlowOperationEvent; 
import flashx.textLayout.formats.ITextLayoutFormat; 
import flash.text.engine.RenderingMode; 
import flash.text.engine.FontLookup; 
import flashx.textLayout.formats.TextLayoutFormat; 
import mx.controls.SWFLoader; 
import flashx.textLayout.edit.EditManager; 
import flashx.textLayout.container.ContainerController; 
import flashx.textLayout.elements.TextFlow; 
private var textFlow:TextFlow; 
private function onCreationComplete():void { 
var container:Sprite = new Sprite();canvas.rawChildren.addChild(container);
var containerController:ContainerController = new ContainerController(container, canvas.width, canvas.height);textFlow=
new TextFlow();textFlow.flowComposer.addController(containerController);
textFlow.interactionManager=
new EditManager();textFlow.flowComposer.updateAllControllers();
private function onClick():void { 
var charFormat:TextLayoutFormat = new TextLayoutFormat(); 
var containerFormat:TextLayoutFormat = new TextLayoutFormat(); 
var paragraphFormat:TextLayoutFormat = new TextLayoutFormat();charFormat.fontSize=36;
textFlow.interactionManager.selectAll();
(textFlow.interactionManager
as EditManager).applyFormat(charFormat, paragraphFormat, containerFormat);textFlow.interactionManager.refreshSelection();
textFlow.flowComposer.updateAllControllers();
]]>
</mx:Script>
<mx:Canvas id="canvas"width="
200"height="
200" borderStyle="solid"/>
<mx:Button id="button"label="
Push me"click="onClick()"
/>
</mx:Application>
When you click the button new font size is set. But the cursor in text field is not changed to a bigger one until I start editing. Also if to look at the textFlow internals in debugger you can see that new font size is not set...
How can I force this?
Kind Regards

This is arguably a bug with a few things conspiring to cause the problem.  The general idea is that each paragraph ends with a paragraph terminator and the final terminator isn't selectable - that seems to be the core of the problem.  The other conspirator is that with a point selection character level format changes aren't applied until the next character is entered.  So with an empty document you always have a point selection. I could see character level format changes applying instantly to empty paragraphs.  I'll file a bug for more investigation.
As for workarounds - well there's always direction model calls - just set the format directly on the span.  Another possibility would be to detected exactly this case and insert a character and then undo it.
Note in your sample code the refreshSelection and updateAllControllers calls after applyFormat are redundant and can be safely removed.  Also any of the formats passed to applyFormat can be null.
Hope that helps,
Richard

Similar Messages

  • How to do text formatting?`

    I would like to ask how to do text formatting in println?
    I need to print out a series of data with column heading, for example
    Heading1 Heading2 Detail
    abc cdea 222222
    22222 22222222 33
    is there any function like C++ that we can format the string before we print it out?

    Java doesn't have a built-in sprintf equivalent, but here are a couple of third-party tools:
    http://www.braju.com/
    http://developer.java.sun.com/developer/technicalArticles/Programming/sprintf/

  • How to provide text formatting options to user from a text field

    Hi,
    My requirement is - in the interactive form, a comments field needs to be provided where user should be able to enter text with formatting options like
    Headers
    indentations
    bold/italic
    bullet points and numbers
    Once user enters the formatted texts in a text field, data needs to be displayed/printed in the same format. Could you help me on how to provide these formatting options to the user for a particular text field?
    I understand that once I define the text field with format XHTML (with RTF), user formatting can be captured and displayed in the same way. But I am not sure on how to provide the formatting options for the text field.
    Thank you,
    Madhu

    Hi,
    if you select a text field for Rich Text and the press Ctrl + E you'll get a bar for all available text formatting options in Acrobat/Reader.

  • How to strip text formatting from text field value ??

    Hi everyone,
    Have tried to get some info on this but no luck.... I've
    created a simple contact form in Flash, but the URL which it's
    generating contains the text formatting from the text input fields.
    As a result the script that processes the mail send doesn't work.
    How do I strip the text formatting out of text1, text2 and text3
    before I use getURL() ??
    on (release) {
    url_var =
    "your_name="+text1+"&your_e-mail="+text2+"&message="+text3;
    getURL("contact.php?"+url_var, "_blank", "GET");
    text1 = "";
    text2 = "";
    text3 = "";
    }

    text1.text = "";
    text2.text = "";
    text3.text = "";
    …that should strip the textfields. You probably also
    want to add this property (text) in the getURL()

  • An editable region, how to keep text formatting?

    Hello fellas.
    Is there any way to keep the text formatting when I paste it
    into my edible region of the template?
    Every time I attempt it - dreamweaver gives me message "
    making this change would require code change which is locked by a
    template". The only way to paste anything into a region is by
    turning off any copy/paste text formatting completely, which is
    painful to edit, especially with a large number of articles.
    Would greatly appreciate any help.

    This is a common alert when the page you are working on
    contains *any*
    coding anomalies (perhaps in a location other than the
    editable region).
    Does the page validate before the paste? Does the code you
    are pasting
    validate?
    The answer is, of course, it's possible to retain formatting
    (provided all
    code is valid). What app are you pasting from?
    Murray --- ICQ 71997575
    Adobe Community Expert
    (If you *MUST* email me, don't LAUGH when you do so!)
    ==================
    http://www.dreamweavermx-templates.com
    - Template Triage!
    http://www.projectseven.com/go
    - DW FAQs, Tutorials & Resources
    http://www.dwfaq.com - DW FAQs,
    Tutorials & Resources
    http://www.macromedia.com/support/search/
    - Macromedia (MM) Technotes
    ==================
    "dreamweaver_novice" <[email protected]>
    wrote in message
    news:f3s8v2$daj$[email protected]..
    > Hello fellas.
    >
    > Is there any way to keep the text formatting when I
    paste it into my
    > edible
    > region of the template?
    > Every time I attempt it - dreamweaver gives me message "
    making this
    > change
    > would require code change which is locked by a
    template". The only way to
    > paste
    > anything into a region is by turning off any copy/paste
    text formatting
    > completely, which is painful to edit, especially with a
    large number of
    > articles.
    >
    > Would greatly appreciate any help.
    >
    >
    >

  • How to keep text formatting from a php flatplan to Indesign

    Hi forum users
    my question is this:
    My company uses a PHP flatplan to recive and store work ready for the deisgners to place in indesign, however any text formatting ie bold, italics etc when copied from the flatplan dont keep when pasted into indesign, im just wondering if there is a way to keep the formatting if anyone knows.
    Currently using Indesign 5.5 but wondering if Indesign 6 has any fixes for this etc
    many thanks

    It may not work for PHP, but there is an option in the prefs to include all information, or text only, when pasting from external applications.

  • How to make text formatting stick on book cover when sent to Apple or to PDF?

    In iPhoto '11 (version 9), one can format text on book covers and in text blocks by selecting the text and right clicking.  Font, size, color, and shadowing can be selected and changed.  All of this displays correctly and sticks when the book is saved, etc.  However, if the book is "previewed" or exported to a PDF (which I believe is the format sent to Apple for actual printing) some of the formatting is lost, permanently.  It just goes away.  Why?  And, more importantly, how can I make this formatting stick?  I'm mainly interested in shadowing as it gives the text a 3d look.  All shadowing is lost - font and size do stick.  I have successfully done this shadowing in several previous releases of iPhoto, and actually had it printed by Apple.  Any ideas out there?  Or is this another wonderful "feature" ?
    Thanks for playing.

    Sorry LN, but that is the problem.  When I do either the preview or the export to PDF, the shadow formatting disappears.  There is another forum discussion where some person discovered this only after receiving their three hard cover books.  I'm pretty sure it is a bug.  I have Snow Leopard and iPhoto '11 (v9) both with latest updates.
    One other note - when applying the text shadow, anytime I adjust either of the three shadow sliders, the shadow disappears and I must click on the main shadow button to make the adjusted shadow reappear.   As I said, it does then stick until I do either the preview or PDF as described in the article you referenced.  Very, very, very annoying.
    Will try to contact Apple today, although I have had very poor luck with ever getting them to admit to any problem in the past.  ( pride goeth before the fall....). Hope they will listen, but I have a close deadline on this book.

  • How to apply a format to all hyperlink in CS4 file

    Hello, this is my first post,
    We are writing a magazine that we will publish as a PDF. We would like all hyperlink to stand out (we created a character style with these attributes: Candara Bold, Dark Red). The magazine will have a lot of hyperlinks in the form of numbers ("go to section 145") so manually formatting them is our last resort.
    We could not find an option in CS4 to do so. Any idea? Maybe GREP rules? Something else?
    Thank you.

    If you were a bit more specific in your request, I think we could come up with better advice for you. John's seemingly less-than-helpful suggestion is, I think, actually the best solution if you are keying your text directly into ID. But we don't know how your magazine is being written (Word content placed correctly with File -> Place? copied and pasted from web browser? Google Docs? database?), so it's hard to make appropriate suggestions. If you're keying it in manually every time, do you have enough control over the people doing the keying so they type the same "go to section ###" everytime? Is there any chance that they'll say "please see section ###" instead? If so, and if it's easier to trust 'em to type it the same way everytime than it is to trust 'em to apply a character style, then maybe a GREP style is the way to go.
    If they are already set up as links in ID, then you can shift-select them all in the Hyperlinks panel and choose "Hyperlink Options" and associate 'em all with a character style in one go. This is completely obvious to me but once again we don't really know what it's like on your side.

  • Apply text format to text yet to be added in a textfield

    I have a text field where user can type and few controls to customize the text properties like: font, size, color etc.
    If a user has typed say "Hello World", the caretindex is next to d of World. I want that if now the user makes some changes to the cusomization properties like: changes font size, then the text appearing next is of the font size set and not that of d. How can I do that?

    assign the defaultTextFormat property for your textfield.

  • Why does text formatting not copy from RH project to RH project?

    In RoboHelp 9, I'm copying text, from one RoboHelp project to another. How come the text formatting is not retained? The indenting is off and the small Roman numerals and small letters are changed to bullets.

    Different CSS files?
    See www.grainge.org for RoboHelp and Authoring tips
    @petergrainge

  • How do I enable bold/italic text formatting in blog module on website?

    For some reason I can't figure out how to enable more text formatting options on our blog. We used the blog module on a muse template. I customized the module to apply fonts we used on our website. The main text on the blog is Lato.
    Link to blog: Coupar Consulting
    When we go in to write a post you can use the bold/italics options and it shows up in the edit window as shown in the screenshot below:
    The font is not correct, but because I set the font in the module to use Lato it does show as lato when you publish, see preview below (notice no bold or italic text):
    What am I missing??
    Thanks in advance!!

    Use your browsers console and inspect tool. This stuff becomes very easy.
    address,caption,cite,code,dfn,em,strong,th,var,optgroup
      font-style: inherit;
      font-weight: inherit;
    Line 34 ish in - http://www.couparconsulting.com/css/site_global.css?3869595648
    This overides the font bold style on strong.

  • How do I apply conditional formatting using SharePoint Designer 2013?

    I'm attempting to apply Conditional Formatting to a list view web part via SharePoint Designer 2013, and I can't seem to find the option to do so.
    I've a horrible feeling I'm just being daft, but here's what I've done so far:
    - Created a new page (I've tried both web part and wiki)
    - Added a list "App part" and saved the page
    - Checked-out and opened the page via Designer
    - Clicked the "Edit file" option
    - Selected the XsltListViewWebPart tag
    So far I can't find any options to add it. If I open the Conditional Formatting pane via the View menu it tells me the following:
    > To use conditional formatting, select an HTML tag, data value, or
    > range of text, and then click Create to specify formatting options.
    I've tried selecting the web part tags in all manner of combinations with no luck. In previous version I would have simply selected the previewed data rows in the now-absent Preview pane.
    Am I missing something?

    Create and edit a Wiki Page
    Click Inset > Data View and Select “Empty Data View”
    Click Inside the <DataSources> tags </DataSources>
    Click Insert > Data Source “Your Data Source Name”
    Hold down Ctrl button and select the Rows in the order you want them to appear from your “Data Source Details” Window.
    After the Rows are selected click on the drop down “Insert Selected Fields as…” at the top of the “Data Source Details” Window. 
    Select “Multiple Item View” option (This will create the xsl where we need to add the conditional formatting to)
    Find the <tr> tag that contains the Row Data.  Insert the following right below the <tr> tag:
    <xsl:attribute name="style">
    <xsl:if test="@FieldName = 'Something'">background-color: #FF0000;</xsl:if>
    </xsl:attribute>
    I hope this helps.  I figured this out by using the old 2010 Designer to figure out the where to place the code and how to do this.

  • How do I keep my text formating when pasting from other InDesign files?

    I'm trying to post charts from one InDesign file to another.  The chart I'm trying to paste has hand-made fractions in them. The font is superscript and baseline shifted. When I paste it into a new document, the text loses all that formatting. It seems like a preferance thing, but I can't find it.

    Even if Placing an .indd file retains the formatting, it's a non-starter. The reason I needed to paste the formatted text in the first place was to create a variation of the ad for a different purpose, so I need to be able to edit the text - something you can't do with a placed file. 
    For instance, I created an ad for an exhibit that includes the date of the reception and the address of the museum, etc. Then I want to create a poster for the wall of the exhibit, so I create a new document with different specs. Placing the ad copy would serve no use since I have to edit the copy (removing the address and reception date) and then readjust the emphasis of each line slightly.
    Then I created another new file (RGB, tall and skinny) for the email invite. So I needed to copy the ad copy  and again put emphasis in different places.
    I hope you can see that there is a real need to be able to copy and paste manually formatted text from one document to another while retaining the special formatting. In these kinds of jobs there is no need to create a new style for each line of text since each line is tweaked and tweaked to death.
    This copy & paste behavior is not intuitive and is obviously causing problems for users for no  reason whatsoever except that "Adobe knows best". Why can't Adobe trust that I knew what I was going when I applied the formatting in the first place?
    Considering how easy it it to remove formatting and revert to the original style, I would say the nod should be given to retaining formatting upon pasting. Both Word and Quark do this, so it's not anything unusual. Or give us the choice with a Paste Special dialog. But saying this behavior is "as designed" or suggesting you need to place a file or PDF, is not the solution.

  • How can I show only text edits and not text formatting when using print comments summary?

    Acrobat 9.3.0 for Mac.
    Here is the scenario: I used the Compare command to see the changes between 2 PDFs. The resulting file some edits are inserts and some are deletions. I want to print a comments summary only showing the text edits. In the Compare Option pane, I select Text and deselect Images, Annotations, Formatting, Headers/Footers, and Backgrounds. Now on the screen I see inserts are highlighted in blue and deletions are marked with sort of a caret and vertical bar symbol. So all looks good at this point. However, when I show the Comments List, I see addtional comments that indicate "Replace - The following text attributes were changed: fill color." Those comments do not appear in the page view unless I check the Formatting check box to show them. With Formatting unchecked, I print a comments summary and all of the "Replace - Fill Color" comments" appear on the resulting comments summary.
    I only want to show text edits, not text formatting changes. So questions are:
    1. Why, when the Formatting checkbox is unchecked, do the text formatting comments still appear in the comments list when they do not appear on the page display.
    2. How can I print only the text content edits and not show the text formatting changes when using Print Comments Summary.

    Hi,
    You can set ExecuteWithParams as default activity in the task flow then method activity to return total no of rows passing to Router activity if your method has value 0 then call Create insert operation else do directly to page.
    Following idea could be your task flow
    Execute With param (default) > SetCurrentRowWithKey > GetTotalNoOfRows (VOImpl Method)
    |
    v
    Router
    1. If pageFlowScope outcome is 0 then call CreateInsert > MyPage
    2. if pageFlowScope outcome > 0 then MyPage
    hope it helps,
    Zeeshan

  • How to print text in paper format iin smartforms

    Hi all,
      I want a question that  how to print text in paper format like  paper divides into 2 parts and if the firstpart is full of text i.e., it exceeds the first page the text will be displyed in the second part of the first page.
    Usefull answers will be awarded.
    Thanks all...

    Hi,
    U create two windows in the page and same as like second page.
    but in first page first window select the condition print only on first page.
    in second window select conditin print only on second page.
    first try without creating a secondpage. if that doesn't workout create secondpage and try.
    Assign points if useful.
    Regards
    (YUGANDHAR.P)

Maybe you are looking for