Sizing a TextView to fit its contents (e.g., tooltip, chat bubble, etc.)

In Flex 3, with a Text component, I can make the component fit its contents (use case: multi-line tooltip, chat-bubble) so that I restrict the max width and the height grows as necessary.<br /><br />To do this in Flex 3, you need to patch the Text component, e.g.<br /><br /><?xml version="1.0" encoding="utf-8"?><br /><mx:Text xmlns:mx="http://www.adobe.com/2006/mxml"><br />     <!--<br />          Text fields do not wrap correctly as reported in this bug:<br />          https://bugs.adobe.com/jira/browse/SDK-12826<br />          <br />          This fix, suggested by Mike Schiff, fixes the issue, so that we can set a minWidth of 0, <br />          maxWidth, and width=100% and have speech bubbles correctly size themselves.<br />          https://bugs.adobe.com/jira/browse/SDK-12826#action_157090<br />     --><br />     <mx:Script><br />          <br />               override protected function updateDisplayList(unscaledWidth:Number, unscaledHeight:Number):void {<br />                    super.updateDisplayList(unscaledWidth, unscaledHeight);<br />                    textField.wordWrap = textField.wordWrap || (Math.floor(measuredWidth) != Math.floor(width)); <br />               }<br />          <br />     </mx:Script><br /></mx:Text><br /><br />Then you can:<br /><br /><naklab:TextWithWrap<br />    htmlText="{someText}"<br />    width="100%"<br />    maxWidth="220"<br />    minWidth="0"<br />    fontWeight="normal"<br />    fontSize="12"<br />    color="#000000"<br />/><br /><br />I cannot find a way to do this with the TextView component in Gumbo. How would you recommend making a TextView component fit its contents and should I file an ECR on this or am I missing something? (Otherwise, how would you handle the use cases above in Gumbo?)<br /><br />Thanks,<br />Aral

OK, the forum ate my code :(
Not sure how to get it to display. Feel free to close the topic as it doesn't make sense. I'll ask elsewhere.
Thanks,
Aral

Similar Messages

  • Sizing a scrollPane to fit its contents' width and height

    Hi,
    I have a MC loaded into a ScrollPane and have attempted to
    detect the MC's width and height and use that to set the size of
    the scrollPane per the documentation at
    Adobe
    Live Docs. I am probably not adapting the code correctly (well,
    duh), but what I have isn't working and I don't know why. Does
    anyone around here have a clue? Thanks in advance.

    OK, the forum ate my code :(
    Not sure how to get it to display. Feel free to close the topic as it doesn't make sense. I'll ask elsewhere.
    Thanks,
    Aral

  • How to force a container redraw to fit-to-content?

    Hi,
    This has been driving me crazy for a long time now.
    Example:
    <panel id="outer">
    <panel id="inner">
    <textarea text="blah blah blah"/>
    </panel>
    </panel>
    The above works fine, the outer panel's size perfectly fits
    its content.
    But if the mxml starts out with only the outer panel, and
    then I add the inner panel as result of some user event at a later
    time, then outer panel will not resize to fit. It will be really
    small and just add some scrollbars when the new content is added.
    I've tried several combinations of the following on the
    various elements with no luck...
    container.invalidateDisplayList();
    container.invalidateSize();
    container.validateDisplayList();
    container.validateNow();
    container.validateSize(true);
    Doing these things seem to have no effect. Arrgh.. please
    help!
    Thanks

    Thanks Greg, you are right. It does work. I guess my problem
    was related to the fact that I had a more complex hierarchy of
    containers, including an HDivideBox which apparently will not
    resize. So taking out layout=absolute, and cleaning up my container
    hierarchy seems to have fixed the problem. Your answer got me back
    on the right track.

  • Dynamic sizing of a component to fit the content

    Hi All,
    How can I make my component so that it will be dynamically sized to fit the content height?  I would like to create a component that will have a variable height.  It has a serious of user input controls.  Depending on the answers given, more input from the user may be necessary--specifically, they will have to provide an explanation in a textbox.
    So, my thinking is that I don't want to display the textbox unless they answer "yes" to any questions that require additional explanation.  If they do, then I want display the TextArea control along with instructions to enter an additional explanation here.
    However, when I do that, it will cause my component's height to grow.  I don't want to reserve space for that textbox in the component's dimensions--I would prefer it simply grow (pushing anything below it further down) if and when the textbox appears.
    How would I go about doing this?
      -Josh

    I think the standard JSF solution would be not to do the create/delete of inputs on the client side, but to do it on the server side.
    If that is not your cup of tea, I think that the standard components will not be sufficient. So you are looking at either not binding the inputs to a component and just getting the values via the request parameters or creating a custom component capable of dealing with this.

  • Sizing a JPanel on its contents

    Hi everybody,
    Does anyone know of a way to resize a JPanel around its contents? I have a panel that will be filled with 3, 5, or 7 lines of text, depending on a button click, and I'd like the panel to size appropriately on the button click. Is there a way to do this? I already have working code, working buttons, working lines, everything, but I just don't know how to do the resizing on demand. If anyone could point me in the right direction, I'd appreciate it.
    Thanks,
    Jezzica85

    Thanks Darryl,
    It looks like you posted just ahead of me, I was whipping up a SSCCE. For some reason, revalidate() isn't doing the job; it's probably something weird I'm doing, maybe this will help :
    import java.awt.BorderLayout;
    import java.awt.GridLayout;
    import java.awt.event.ActionEvent;
    import java.awt.event.ActionListener;
    import javax.swing.JButton;
    import javax.swing.JFrame;
    import javax.swing.JLabel;
    import javax.swing.JPanel;
    public class ResizeTest extends JPanel {
        private int entries;
        private static final long serialVersionUID = 5290537936355330083L;
        public ResizeTest( int number ) {
            entries = number;
            create();
        public void changeEntries( int entries ) {
            this.entries = entries;
            removeAll();
            create();
            revalidate();
            repaint();
        private void create() {
            setLayout( new GridLayout( entries, 1 ) );
            for( int i = 0; i < entries; i++ ) { add( new JLabel( "Line" ) ); }
            revalidate();
        // testing
        public static void main( String args[] ) {
            final ResizeTest panel = new ResizeTest(5);
            JPanel buttonPanel = new JPanel( new GridLayout( 1, 7 ) );
            for( int i = 3; i <= 15; i+=2 ) {
                JButton button = new JButton( "Change to " + i );
                final int blah = i;
                button.addActionListener( new ActionListener() {
                    public void actionPerformed( ActionEvent e ) {
                        panel.changeEntries( blah );
                buttonPanel.add( button );
            JFrame frame = new JFrame();
            frame.setLayout( new BorderLayout() );
            frame.add( panel );
            frame.add( buttonPanel, BorderLayout.SOUTH );
            frame.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );
            frame.pack();
            frame.setLocationRelativeTo( null );
            frame.setVisible( true );
    }Thanks,
    Jezzica85

  • DataGrid fitting to content

    How to set DataGrid column width fit to its content dynamically.

    Here is a basic example. Notice the use of outerDocument and how I removed width="100%" from the Text control. Also notice my use of measuredWidth instead or width.
    As I said, this can get complex and might not always work, but in theory, it can be done.
    If this post answers your question of helps, please mark it as such.
    <?xml version="1.0"?>
    <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml">
      <mx:Script>
        <![CDATA[
          import mx.collections.ArrayCollection;
          public var localVar:String="Application localVar";
          [Bindable] private var initDG:ArrayCollection = new ArrayCollection([
            {Artist:'Pavement', Album:'Slanted and Enchanted', Price:11.99},
            {Artist:'Pavement', Album:'Brighten the Corners', Price:11.99}
        ]]>
      </mx:Script>
      <mx:DataGrid id="myGrid" dataProvider="{initDG}"
        variableRowHeight="true">  
        <mx:columns>
          <mx:DataGridColumn dataField="Artist"/>
          <mx:DataGridColumn id="albumCol" dataField="Album">
            <mx:itemRenderer>
              <mx:Component>
                <mx:VBox>
                  <mx:Text id="albumName"
                    text="{data.Album}"
                    creationComplete="outerDocument.albumCol.width=albumName.measuredWidth"/>
                </mx:VBox>
              </mx:Component>
            </mx:itemRenderer>
          </mx:DataGridColumn>   
          <mx:DataGridColumn dataField="Price"/>
        </mx:columns>      
      </mx:DataGrid>     
    </mx:Application>

  • How to move some xml element and its content to a new frame

    Hi All,
    How to move some xml element and its content to a new frame.

    Hi Chinnadk,
    Sorry my code its comment some lines. Now only I check the forum thread, you just try one more time.
    #target InDesign;
    #include "/Program Files (x86)/Adobe/Adobe InDesign CS5.5/Scripts/XML Rules/glue code.jsx"
    var myDoc = app.activeDocument;
    //____________________ XML RULE SET
    var myRuleSet = new Array (new margintag);
    with(myDoc){
        var elements = xmlElements;
        __processRuleSet(elements.item(0), myRuleSet);
    function margintag(){
        this.name = "margintag";
        //this.xpath = "//margintag[@type='mn2']";
        this.xpath = "//margintag";
        this.apply = function(myElement, myRuleProcessor){
            with(myElement){
                app.select(myElement);
                try{
                    var myPrePara = app.selection[0].paragraphs[-1].parentTextFrames[0].paragraphs.previousItem(app.selection[0].paragraphs[-1]);
                    if(myPrePara.characters[-1].contents=="\r"){
                        myPrePara.characters[-1].remove();
                    var myTextframe = myElement.placeIntoInlineFrame(["7p9","6p"]);
                    myTextframe.appliedObjectStyle= myDoc.objectStyles.item("MN1");
                    myTextframe.fit(FitOptions.FRAME_TO_CONTENT);
                    myTextframe.parentStory.paragraphs.everyItem().appliedParagraphStyle = app.activeDocument.paragraphStyles.itemByName("MN1");
                    }catch(e){}
                app.selection = null;
            return true;
    thx,
    csm_phil

  • Can a div auto-detect the width of its contents?

    By default, a div's width will extend as far as its container allows (100%) and we can restrict this by specifying width values. But I'm not looking to do either one. Instead, I'd like to know if there's a way to make a div adopt the width value of its contents dynamically?
    In other words, wrap tightly around its contents, instead of expanding to fill whatever space allows.
    <div>
      <img src="image.jpg">
    </div>
    Where image.jpg is 200px wide and so is the div that's containing it.

    jyeager11 wrote:
    By default, a div's width will extend as far as its container allows (100%) and we can restrict this by specifying width values. But I'm not looking to do either one. Instead, I'd like to know if there's a way to make a div adopt the width value of its contents dynamically?
    Where image.jpg is 200px wide and so is the div that's containing it.
    Yes you can do it.  You need to float the DIVs either left or right.  The process of floating the div shrinks the div to fit the contents.  Try it and let us know if this works in your case.
    Good luck.

  • Backing up iPhoto Library (or its contents) to DVD

    I currently use Time Machine to backup my iPhoto Library to an external hard drive. However, I would also like to back up the library itself, or at least its contents, to DVD. Does iPhoto have a built-in backup to disc utility like iTunes does? If not, can you suggest a good method/app for backing up the library to disc? My iPhoto Library is around 8 GB, so it won't fit on a single DVD. I do have Toast, although it's an old version (Version 8, I believe). Could I use that?

    Does iPhoto have a built-in backup to disc utility like iTunes does?
    No.
    My iPhoto Library is around 8 GB, so it won't fit on a single DVD.
    If you have a drive capable of writing to dual layer double sided DVDs, the library will fit. Other options include control-clicking the iPhoto Library item in the Finder and compressing or archiving it, or showing its contents in the Finder, splitting that over multiple DVDs, and fully reassembling it before attempting to access it from iPhoto.
    (3153)

  • I used to have an application in my iPhone 4 and 4s that captures business card and creates its content to my contacts. Its no longer working with my i5. Can you recommend me a new apps for this same function

    I used to have an application in my iPhone 4 and 4s that captures business card and creates its content to my contacts. Its no longer working with my i5. Can you recommend me a new apps for this same function

    Try CardMunch it works well for me

  • [ADF] stetching/shrinking PanelBox to match its content weird

    On my page I have two panel boxes.
    Altrough thay has similar content (tree) - for some reason top is much bigger then the bottom one and do not change its height according to its content.
    Second panel is working good, but it stretching to some limit.
    I need both Panels to have minimal height, stretching according to its content.
    How to?
    Screens to discribe:
    [pic1|http://imageshack.us/a/img233/2465/pic1yfc.jpg]
    [pic2|http://imageshack.us/a/img692/8352/pic2bk.jpg]
    Page code is:
    <f:facet name="first">
    <af:panelStretchLayout id="psl2" endWidth="300px">
    <f:facet name="center">
    <af:panelFormLayout id="pfl1">
    *....read-only form here*
    </af:panelFormLayout>
    </f:facet>
    <f:facet name="end">
    <af:panelStretchLayout id="psl3">
    <f:facet name="center">
    <af:panelGroupLayout layout="scroll" id="pgl2">
    <af:panelBox text="PanelBox2" id="pb2">
    <f:facet name="toolbar"/>
    <af:tree ... styleClass="AFStretchWidth">
    *...tree code here*
    </af:tree>
    </af:panelBox>
    <af:panelBox text="PanelBox1" id="pb3">
    <f:facet name="toolbar"/>
    <af:tree ... styleClass="AFStretchWidth">
    *...tree code here*
    </af:tree>
    </af:panelBox>
    </af:panelGroupLayout>
    </f:facet>
    </af:panelStretchLayout>
    </f:facet>
    </af:panelStretchLayout>
    </f:facet>

    Thank you for pointing. My bad.
    The problem was solved by setting PartialTriggers of panelBox to its content tree
    but now I have anoter trouble, its not connected I think, but...
    If no data in TreeModel of tree, I get doubeling of "No data to display". So my tree is looks like
    No data to display
    No data to display
    On refresh it writing "No data to display" and then for a half of second i get hint like "Gethering data" and then second "No data to display" appears.
    What it could be coused by?

  • I backed up my old core 2 duo imac and and was trying to transfer files to my new 2011 imac and when i go to oppen a folder from what i transferred it says "The folder "Music" can't be opened because you don't have permission to see its contents."?

    I backed up my old core 2 duo imac and and was trying to transfer files to my new 2011 imac and when i go to oppen a folder from what i transferred it says "The folder “Music” can’t be opened because you don’t have permission to see its contents".  Why cant i access the files from my old mac?  I tried the time machine and that isnt working either.  I have files that I need to use on my new mac, all my old programs and such.  I thought they said it was easy to get your files from one mac to another.  Please help.

    Your account names are probably different on the two Macs. If you know the UNIX command line, open a terminal window and run:
    $ id 
    You should see a line that starts with something like this:
    uid=501(your_user_id_here)
    now check the owner of the folder you copied over:
    $ ls -ld Music
    drwx------+ 8 some_user_id_here  staff  272 May 14 16:08 Music
    Do the IDs match? If not, you could change the ownership. Say your id is "johnsmith"
    $ chown -R johnsmith Music
    Now try and access it with iTunes.

  • Document Creation error - "We're sorry. We can't open document name because we found a problem with its contents"

    Morning Friends,
    I have created a SharePoint 2010 "Site Workflow" that is designed to take information from a form and create a Word doc with the gathered information and store this Word doc in a document library.
    I am using Sharepoint 2013 with Office 2013 
    I understand there are a lot of steps (19) outlined below and I can provide more information as needed but the bottom line is this, workflow successfully takes info from an initiation form, uses the info to create a Word doc. Places this Word doc in a library.
    When attempting to open / edit doc, receive error
    "We're sorry. We can't open <document name> because we found a problem with its contents"
    Details - No error detail available.
    Any info or advice would be greatly appreciated. 
    Very high level view of what I have done:
    1 - Created content type called "Letters"
    2 - Added site columns " First Name" and "Last Name"
    3 -  Created and saved to my desktop a very basic Word document (Letter.docx) that says "Hello, my name is XXXX XXXX"
    4 - In the advanced settings of the "Letters" content type I uploaded this "Letter.docx" file as the new document template.
    5 - Created a new document library called "Letters"
    6 - In Library Settings - Advanced Settings, clicked "Yes" to enable the management of content types.
    7 - Then I clicked "Add from existing content types" and added the "Letters" content type
    8 - Back in the advanced settings of the "Letters" content type I selected "Edit Template" and replaced the first XXXX with the Quick Part "First Name" and the second XXXX with the Quick part "Last Name"
    9 - Created a new 2010 Site workflow called "Create a Letter"
    10 - To the workflow I added the action "Create List Item"
    11 - Configured the action to create Content Type ID "Letters" in the document library "Letter" 
    12 - For the "Path and Name" I gave it a basic name of "Letter to"
    13 - The next step was to create the Initiation Form Parameters and added to form entries "First Name" and "Last Name"
    14 - I then linked the initiation form fields to the data source "Workflow Variables and Parameters" to their respective Field from Source parameters
    15 - Went back to the "Path and Name" and modified the basic name of "Letter to" to include the first and last name parameters.
    16 - Saved - published and ran the work flow.
    17 - As expected, Initiation Form prompts for First and Last Name. ("John Doe") Then click "start
    18 - Go to document library "Letters" and see a new Word document created titles "Letter to John Doe" 
    19 - Go to open / edit the Word document and receive the following error
    thoughts? Any info or advice would be greatly appreciated. 

    See this MS support article for SP2010 workflows and generating Word docs:
    https://support.microsoft.com/kb/2889634/en-us?wa=wsignin1.0
    "This behavior is by design. The Create
    List Item action in the SharePoint
    2010 Workflow platform can't convert Word content type file templates to the correct .docx format."
    I've had success in using SP 2013, Word 2013 (saving a .docx as the template instead of .dotx for the document library content type), and an SP 2010 workflow using SP Designer 2013.

  • How can I  sync without losing content of my ipod and transfer its contents to itunes library

    How can I sync my ipod classic w/o losing content and therefore able to transfer its content to the itunes library?

    See this older post from another forum member Zevoneer covering the different methods available for copying content from your iPod back to your computer and into iTunes.
    https://discussions.apple.com/thread/2452022?start=0&tstart=0
    B-rock

  • HT201250 i'm getting message: can't be opened because you don't have permission to see its contents. and he operation can't be completed because an unexpected error occurred (error code -8003).

    I took my computer in to have the Backup restored onto my computer after having a new harddrive put onto my 1year 1/2 old MacBook Pro. When i got it home there was a new User that i had to logout of to getting into my normal user. Don't know why this was, just figured the Mac guys that installed my backup did this for some odd reason. Today i could not open any of my files in the backup on the time machine. All the folder had line going thought them and when i clicked on them I revieved this message: can’t be opened because you don’t have permission to see its contents. After talking with that same mac store. I decided to just delete all the files out of the time machine as it was just put back on my computer and i have everything i need. Hours later when i tried to empty the trash i got this messsage: the operation can’t be completed because an unexpected error occurred (error code -8003).
    Any advise how to fix my problem?
    thanks in advance

    While you see a single trash can, in reality there are trash folders on each mounted volume.  I don't use TM but what you are describing implies that a TM drive is no different with the way trash is treated.  So when the TM is unmounted the trash folder on there is gone and thus the trash looks empty.  Remount the drive, the trash folder on it now causes the trashcan to look like something is in it.
    If TrashIt! could not remove the file, I'm sorry, you will need to use the terminal.  We can do this one step at a time so you only have to copy/paste the lines into terminal (except the first time).  So launch Terminal (in utilities).  You might want to make the window that is shown a bit larger with the grow box since it's pretty small.
    This first line is the only exception to the copy/pasting since you have to enter some information.
    sudo ls -laR /Volumes/your-TM-volume-name/.Trashes
    where your-TM-volume-name is the name of your TM volume.  That's the part you have to fill in since I don't know it.
    When you hit return the sudo in that command will cause a prompt for your admin password.  Enter it and hit return again.  Note the password will not be shown as you type it.  Post the results so I can tell you what to do next.
    Note this ls command is not doing anything but listing the files in the TM's .Trashes folder.  Remember I said each drive has it's own trash folder.  .Trashes is it.

Maybe you are looking for

  • Unable to Load JdbcOdbc library -- Linux

    I know this question has been asked a lot, but I couldn't find a helpful answer in all my searches. I'm trying to use JdbcOdbc to connect to MySQL via ODBC on Linux. I have to use ODBC as part of an assignment, which is rather annoying, since the MyS

  • How to preserve original size when converting to PDF in Preview.

    I'm using Preview in Snow Leopard. Trying to create multipage PDFs from document scans. I'm finding that when the scanned image (tiff, png, jpg) is converted to PDF in Preview the size reduces. Selecting 'View actual size' shows the image with someti

  • Shrinking BLOB tablespace in Oracle 10g

    Hello, I have table created with 32 GB in Oracle 10g with BLOB field containing images. after that I have deleted some of the images from the table but when I'm checking free space, it is show full 32 GB. But when I'm looking at Toad it shows me out

  • Hi, How do I delete my entire catalog in Elements 12 so I can reload it?

    Hi, How do I delete my entire catalog in Elements 12 so I can reload it?

  • SMB, CIF, MSHOME, etc - 2 PCs + One Mac

    I have a Mac dual G4 with OSX 10.4.4 connected to two PCs, each with Windows XP SP2, via ethernet. I would like to make one entire volume "Giant" available to the PCs for read/write. I would also like to have the entire "C:" volumes on both PCs to be