Width of the text box

Hello

I am eager to find the width of a text box and if it is longer than say 200 pixels, decrement the (points) by one font size until the width of the text box is less than 200 pixels. I guess I'm going to need some form of loop here but I have problems with this.

I have not included all my code just the important parts.

TextItem.Size = 50

TextItem.Kind = 2 (for me to find the width)

Var TextWidth = TextItem.Width

Now my thoughts for the loop are...

While TextWidth > 200

TextItem.Size-= 1

TextWidth = TextItem.Width

End while

I'm not the best programmer so don't know if the loop is just fine but my idea is that, while the width of the text box is greater than 200, reduced by one font size, find the new width of the text box, then if it's still higher than 200, repeat the process until it is less.

Is the part that I seem to have a problem with the "'TextWidth = TextItem.Width ' inside the while loop." Tests, I know that when the width of text box is greater than 200 pixels, correctly enter in the loop, decreases the font size, BUT I can't seem to find the new width of the text box. Instead, it seems to be still using the original value for the width and therefore without end of the loop.

Can someone tell me please in the direction where I'm wrong?

Thanks in advance.

This code looks like VBS (or some other flavor of VB). If VBS works in the same way javascript, change the size of the text will not change the width of the text box.

There are two types of text layers, point and paragraph text. The width property is applicable to the text of the paragraph but corresponds to the width of the bounding box of the text, not the width of the text itself.

You should be able to get the width of the text of the bounds of the text layer property.

Tags: Photoshop

Similar Questions

  • Under Type menu - Insert a special character - markers - current Page number in the text frame on the Master Page gives the letter A and also a horizontal black line the width of the text box.   This line is not a rule.  Turn on the Wellin gives another l

    Is anyone out there?

    I found the problem.  It was a rule after all.  I didn't the insertion point to the right place.  Everything is OK now.

  • Reorganization of the text boxes so that they mix upwards or downwards

    Hello

    I'm not sure to understand what happens when the text inline boxes are dragged - I have 6 on a page that are the width of the page but different heights and I would like to re - order them so they mix it up or down depending on where I drag them, but at the moment they go to the bottom of the page or disappear completely I can't work on the behavior.

    I think there must be a way of formatting.

    Thank you

    James

    Select each text box and if you use v5 Pages, visit the reorder menu and text wrapping set to None. Now, the text box are not repellent, and you can position them as you please. If you always use the Pages ' 09 and then again, select each text box and the Wrap Inspector, deselect object causes wrap.

  • Implementation of the text box

    Hello

    I need to put in place the text box in my application. I have created custom textbox his works well, enter when the button I get no second line, but the focus moves to the next field. Please

    class TextBox extends VerticalFieldManager {
        int managerWidth;
        int managerHeight;
        private EditField editField;
    
        int width = Display.getWidth()-70;
        int height = 18;
        int maxvalue=2000;
        public TextBox() {
            super(Manager.NO_VERTICAL_SCROLL);
            managerWidth = width;
            managerHeight = height;
            VerticalFieldManager vfm = new VerticalFieldManager(Manager.VERTICAL_SCROLL |               VerticalFieldManager.FIELD_VCENTER);
            // vfm.setPadding(3,0,0,5);
            editField = new EditField("","",maxvalue,Field.FIELD_HCENTER){
                public void paint(Graphics g) {
                    getManager().invalidate();
                    this.setFont(Utilities.getAppFont());
                    super.paint(g);
                }
            };
            vfm.add(editField);
            add(vfm);
        }
        public void paint(Graphics graphics) {
            graphics.setColor(Color.WHITE);
            graphics.fillRoundRect(0, 0, getWidth(), getHeight(), 10, 10);
            graphics.setColor(0x00000000);
            super.paint(graphics);
            graphics.setColor(0x0BBBBBB);
            graphics.drawRoundRect(0, 0, getWidth(), getHeight(), 10, 10);
        }
        public void sublayout(int width, int iHeight) {
            if (managerWidth == 0) {
                managerWidth = width;
            }
            if (managerHeight == 0) {
                managerHeight = iHeight;
            }
            super.sublayout(managerWidth, managerHeight);
            int iNumFields = getFieldCount();
            int iYPos = 5;
            int iXPos = 5;
            Field fField = null;
    
            for (int i = 0; i < iNumFields; i++) {
                fField = this.getField(i);
                setPositionChild(fField, iXPos, iYPos);
                //get height for layout and height
                int tmpHeight = managerHeight;
                //draw field
                layoutChild(fField, getWidth(), tmpHeight);
                iYPos = iYPos + tmpHeight+5;
            }
            //now we reset our extent to include padding   
    
            this.setExtent(managerWidth, Math.max(iYPos, getPreferredHeight()));
            setVirtualExtent(managerWidth, Math.max(iYPos, getPreferredHeight()));
        }
        public int getPreferredHeight() {
            height = 5;
            int iNumFields = getFieldCount();
            for (int i = 0; i < iNumFields; i++) {
                height += getHeight(getField(i))+5;
            }
            return height;
        }
    
        private int getHeight(Field f) {
            return Math.max(Math.max(f.getContentHeight(), f.getHeight()),f.getPreferredHeight());
        }
        public String getText() {
            return editField.getText();
        }
        public void setText(String text) {
            editField.setText(text);
        }
        public void setMaxSize(int max) {
            editField.setMaxSize(max);
        }  
    
    }
    

    Help me create the text box

    Sorry not looked seriously at your code, but there are some problems with it I think.

    Rather than trying to fix your code, it does the job for you?

    http://supportforums.BlackBerry.com/T5/Java-development/TextBoxField-revisited/Ta-p/548410

  • How to make your table force widths to the width of the text block?

    Hello

    Is there a way to save a lot of time by forcing the tables to redistribute the column widths (by percentage or otherwise) depending on the size of the text box?

    Currently, we resize each column individually.

    See you soon

    Ben

    If your table is on a single page, you can enter the lower right corner (with the type tool selected) to resize all the columns proportionally. (you will see a two-headed diagonal area when you are on the right place to catch)

  • How can I make the text in all the boxes down following objects when the text box is changed from 1 to 2 lines?

    Hi people Muse.

    I'm faced with a problem of text box:

    At the bottom of my page, I have the title "ACTING ERMUTIGEN ZUM". Without any manual adjustment, I was happy to see that the text box pushes down the following objects as soon as the title Exchange of 1 to 2 lines. Point out clearly: I didn t add any point to stop or change any additional settings to achieve this, it just happened automatically and that's exactly what I want to happen.

    To my confusion, I can´t find a way to apply this behavior for the second title 'COURAGE OBSERVES UND LOSEN. It s on the same page. When I drag the breakpoint controller in the design-time view from the left to the breakpoint 900 pxor do it in the browser after export of the site, the title changes from 1 to 2 lines, as assumed, , but then the next Don t objects react and stay in the same place they stay when the title takes only 1 line.

    You will find the site on businesscatalyst:

    WILLKOMMEN

    I´d appreciates your support very well. I m sure it s not a big problem, but after an hour of re - try and control and do not receive a millimeter in advance, I thought, he could be one of these 'Don t worry - here comes the solution'- Muse hero there, read this. What you...? ;-)

    Thank you in advance.

    Moritz

    –––

    1st Title: everything works fine...

    Bildschirmfoto 2016-03-15 um 17.24.43.png

    Bildschirmfoto 2016-03-15 um 17.25.25.png

    –––

    2nd title: the 1200 px BP do everything ready...

    Bildschirmfoto 2016-03-15 um 17.26.13.png

    .. .but as I drag the marker of BP to the left just as I did with the title 1, the 2nd title doesn´t lower content:

    Bildschirmfoto 2016-03-15 um 17.26.30.png

    If you set the text block "ZUM ACTING... "sensitive width via the resizing control, rather than"Stretch to the width of the browser", which will provide the behavior you're looking for.

    We will study the design compared to the difference of the browser view. It seems that how items are grouped in resizing behavior is different in the case of elements with parameters width Resize mixed, in the mode of creation of the Muse and the browser.

  • I can expand the text boxes CBC and link in the properties box floating?

    Just moved to CS5 to CC and to see that the text boxes are always short fixed width despite URLs always larger than the size of the content.

    At hope that they corrected it because it is really difficult to type manually or correct a URL in these boxes of short.

    Is there is way to be extended to a larger width of character?

    TIA

    NO.

  • How can I view the dimensions of the text boxes?

    The MUSE toolbar (if it is the correct name for it) to view the size - width and height of the text boxes, while I was working on page layout. This is very important with presentations of several columns that are not complying with the grid column - what types of old school like me know that * measures. (Not a description of PC, but that's what they were called in the publishing at least the last 50 years).

    Watch the presentation of my website http://www.londonsriver.com and you'll see what I mean.

    But in the latest version, that happened the next day - it disappeared. It shows the coordinates X and Y, so I can see where is the box (not that I really care). But it does not show the DIMENSIONS which is what I want. They used to be next to the coordinates on the toolbar or Ribbon or whatever this is.

    Am I missing something? I tried several options, but they do not appear. I may be stupid, but I want to just my rear dimensions. Bypass it is laborious: make the first box of the column, and then draw another box above it, and then drag on the second position. And so on. And very tedious if I already have two or three columns of text on a page that I re - works. What should I do? Guess? If they are "similar" to Muse they will even when the site is updated?

    I don't even begin to understand what many new features are Muse - perhaps one day I'll have the time to learn. Maybe my site is boring, but I come from the world of newspapers, is what it is and I know how to do. I want to just my size back!

    Thank you. And by the way, many thanks to all those involved in invent, develop, and deliver the Muse. I can now create pages in minutes, using the same basic page design and modification of the skills that I used for years - instead of living the demimonde of techspeak and coding where another website, construction tools wanted to take me!

    Have a look here:

    I don't get width and height of the menu options

  • Sheer centering in the text box?

    Okay, let's say...

    -J' have a text box 600 pixels wide.

    -Have a peak of 300 pixels wide I paste in the text box.

    -Text wrapping options that I must have the text to the right, left, or top and bottom.

    -Currently, when I put it to the clothing of adobe and below, the photo is not centering within the pirxel 600 width text box (so there would be 150 pixels on each side). Instead, the captain remains stuck to the left, but yes, the text goes above and below.

    Am I'm missing something or some setting he throws? In Dreamweaver, for example, if I clicked on the photo and click the "Center" button (as if the captain was the text), it works for this - way is not ideal to do, but works. Muse if...?

    Thanks again!

    D

    Works, thanks!

    D

  • How resize the text box (box) without stretch text

    Hello! I'm editing a brochure in Illustrator CS4. There are blocks of text. I want to make the same width. But when I enter the width, I want... it extends (or fun upward) the text. When I manually stretch the text box, it works fine. But I can't get exactly do this way. Is it possible to enter the width and do NOT have the text distorted when resizing the box? Thank you.

    Julie

    Julie,

    You can directly select the path (white arrow).

    IIn this case, you can ClickDrag the segment you want to move.

    The guides are your friends.

  • Set the focus to the text box of the embedded NumericStepper control

    I have an application that requires I use NumericStepper edit control as ItemEditor of a DataGrid column.

    I have two problems that I can't seem to overcome, one being the result of the solution to another:

    (1) I need to instantiate the component NumericStepper during execution, because I don't ' know advance what columns it will require.  More important still, I need to specify default attributes (styles, min, max, width, etc.).  I can't understand how to specify these attributes other than in a .mxml file.  To handle this, I have crreated a component 'wrapper' that's an HBox with a NumericStepper inside her, and I can specify my attributes on the tag NumericStepper.

    (2) now that I did #1 above, although, when I click a DataGrid cell that uses this component editing, the editor comes back but the text box is NOT centered, which means that the user must click a second time if he wants to type a number.  It's very irritating, but I do not know how to manage the focus such as when my HBox-with-embedded-NumericStepper' control rises, it concentrates and its selected data, NumericStepper, just as the 'base' is.

    So, my questions are:

    (1) can I somehow assign property values to a standard when executing NumericStepper, so that I can avoid using my built-in custom control HBox?

    (2) how can I manage the focus so that when my control HBox is in place, the text box is selected and fucused?

    That sounds confusing, but I have a small program to demonstrate this.  The "QtyBad" column uses my own NumericStepper HBos-based and not to be put in the correct focus when activated.  The "QtyGood" column has demonstrated APPROPRIATE behavior, as exposed by the native NumericStepper component, but I can't specify additional attributes / s on this subject.

    Here are all of the program - called "DGNumStepperDemo" - here:

    DGNumStepperDemo.mxml

    <? XML version = "1.0" encoding = "utf-8"? >
    " < = xmlns:mx mx:Application ' http://www.Adobe.com/2006/MXML "layout ="absolute"creationComplete =" onInitialize () "> "
    < mx:Script source = "DGNumStepperDemo.as" / >
    < mx:DataGrid id = "dg1" editable = "true" top = "20" left = "20" width = "350" height = "124" >
    < / mx:DataGrid >
    < / mx:Application >

    DGNumStepperDemo.as


    ActionScript file
    Import mx.collections.ArrayCollection;
    Import mx.controls.DataGrid;
    Import mx.controls.dataGridClasses.DataGridColumn;
    //---------------------------------------------------------------------------------------- -------
    [bindable]
    private var gridData:ArrayCollection = new ArrayCollection([{Qty:0},{Qty:5},{Qty:10}]);

    private function onInitialize (): void
    {
    CDL of the var: Array = new Array();
    var dgc:DataGridColumn;

    DGC = new DataGridColumn ("QtyBad");
    dgc.dataField = "Qty";
    DGC. Width = 75;
    dgc.itemEditor = new ClassFactory (EditorDGNumericStepper);
    dgc.editorDataField = "value";
    cols.push (DGC);

    DGC = new DataGridColumn ("QtyGood");
    dgc.dataField = "Qty";
    DGC. Width = 75;
    dgc.itemEditor = new ClassFactory (mx.controls.NumericStepper);

    dgc.editorDataField = "value";
    cols.push (DGC);

    DG1. Columns = cols;
    DG1. DataProvider = gridData;
    }

    EditorDGNumericStepper.mxml

    <? XML version = "1.0" encoding = "utf-8"? >
    " < = xmlns:mx mx:HBox ' http://www.Adobe.com/2006/MXML ""4"verticalAlign ="middle"paddingRight ="4"paddingLeft = verticalScrollPolicy ="off"horizontalScrollPolicy ="off"> "
    < mx:Script >
    <! [CDATA]
    public function get value(): number {return itemQuantity.value ;}
    []] >
    < / mx:Script >
    < mx:NumericStepper id = "itemQuantity" value = "{data.". Qty}"minimum maximum ="0"="100"/ >
    < / mx:HBox >

    If anyone who bothers to run it, you can see what I mean about the focus problem in the QtyGood and QtyBad columns.

    Any help is appreciated!

    Quick response to the #2 is to change the EditorDGNumericStepper.mxml to the following:

    
    http://www.adobe.com/2006/mxml"
               verticalAlign="middle" paddingRight="4" paddingLeft="4"
               verticalScrollPolicy="off" horizontalScrollPolicy="off"
               creationComplete="focusManager.setFocus(itemQuantity)">
         
              
         
         
    
    

    The only thing I did was put the NumericStepper to 100% width so it fills the column like the standard NumericStepper and it looks a bit better and I added a creation complete event handler that sets the focus to the NumericStepper.  I tested it and it will be emphasis each time on it like a standard stepper.  There may be a more "preferred" way, but it's simple and effective.

    On the #1 question, you want to change the properties, styles, etc. of a NumericStepper standard once it has been added to the data grid?

  • How to follow the overview of the border of the text box?

    Hi all

    I really need an idea. I use the text box that is mobile. It moves when you drag.

    Now, I want to move only by clicking on the border. If you've seen the text box in powerpoint on that, if you place the cursor on the border it shows a + cursor.

    I would like to implement the same in flex. Does anyone have an idea?

    Thank you

    -CK

    Add a listener to the mouseMove event in the text box.

    ta.addEventListener (MouseEvent.MOUSE_MOVE, onMouseMove);

    private var upperThreshold:int = 5;

    private var lowerThreshold:int = 10;

    private var leftThreshold:int = 3;

    private var rightThreshold:int = 6;

    private void onMouseMove(evt:MouseEvent):void {}

    var isOnBorder:Boolean = false;

    If (your .mouseY<=>

    isOnBorder = true;

    } ElseIf (your .mouseY > = ta.height - lowerThreshold) {}

    isOnBorder = true;

    } ElseIf (your .mouseX<=>

    isOnBorder = true;

    } ElseIf (your .mouseX > = ta.width - rightThreshold) {}

    isOnBorder = true;

    }

    If {(isOnBorder)

    define your styles and watch a mouse down event

    } else {}

    Remove your styles and the mouse to the bottom of the event listener

    }

    }

    In the example above, you also need to listen to a mouse out even so you can delete the styles and the unwanted event listeners.

  • Filling of contextual data in the text box in the application

    Hello

    Is someone can you please tell me how we can fill data popup in the text box in the application. What is required to do.

    Thanks in advance.

    Not succedding upload...

    Please copy & paste the code into your files & then try...

    EmpInfo.mxml


    http://www.Adobe.com/2006/mxml"layout ="absolute">
       
            Import mx.managers.PopUpManager;
    public function popUp (): void
    {
    var titleWindow:PopUp = PopUp (PopUpManager.createPopUp (this, PopUp, true));
    titleWindow.empInfo = this;
    PopUpManager.centerPopUp (titleWindow);
    }
    ]]>
       

       
       

    PopUp.mxml


    http://www.Adobe.com/2006/mxml"layout ="absolute"width ="400"height ="300"close ="PopUpManager.removePopUp (this); » >
       
            Import mx.managers.PopUpManager;
    public var empInfo:EmpInfo;
    public function setDataToParent (): void
    {
    empInfo.txtArea.text = ("" + txtInpName.text + "" + txtInpAdd.text + ""+ txtInpPh.text);
                   
    PopUpManager.removePopUp (this);
    }
    ]]>
       

       
           
               
                   
           

           
               
                   
           

           
               
                   
           

           
       

    Thank you.

  • You can change the font size using the form in the preview (not with the text box). Having also arrow drawing trouble in preview.

    You can change the font size using the form in the preview (not with the text box). Having also arrow drawing trouble in preview.

    What problems are you having with the arrow? You go to Tools-> annotate-> arrow and an arrow appears. Then you can drag around the head and tail to make it to the desired location.

  • Drag and drop the text box color - pages

    Hello

    I just upgraded from Pages 09 to 5.6 Pages. Pages 09, if I did drag a color from the menu of color on a text box, it might change the color of the text. 5.6 pages this action changes the fill of the text box, not the color of the text. Is it possible to force the behavior of 09 to 5.6? I change the color of the text much more often than the color of the background of the text box.

    Thank you very much!

    Force the behavior of Pages ' 09 v5.6? Absolutely not.

    Pages ' 09 and v5 are entirely different applications and not surprisingly, they work differently also. In the Pages v5, fill, text and a text box border color come from different parts of the application, not a central color palette.

Maybe you are looking for

  • Restarting a I - Pad after download

    I've just updated my I - Pad with the latest operating system, as it was pushed to me by Apple.  When I try to reboot the i - Pad, he asks me to go through the clouds.  I tried my Apple ID, but it does not accept it.  I can't access my I - Pad at all

  • a macbook pro with retina display becomes hot when in use?

    A macbook pro with retina display becomes hot when in use?

  • Spinning wheel of death, all applications!

    Since yesterday my desktop Mac is very slow and showing the spinning wheel in absolutely all applications I use. I run OnyX, did a scan complete McAfee, rebooted and came back a month using time machine and yet nothing made a difference. I have limit

  • dv9740us 17 "screen of flag: install vista to windows pro 8.1

    Does anyone has installed windows pro 8.1 on this machine.  I did a test of compatibility of windows 7 and has shown is not a problem.  Some drivers will need to be updated, but other that that, it should be ok.  I'm a little hestant of departure bec

  • Pavilion C4M16EA #ABU: network adapter

    CAN SOMEONE HELP A 301 ERROR SO I REPLACED MY HDD NOW I HAVE NO INTERNET AND IT SAYS I HAVE TO INSTALL NETWORK ADAPTER HOW DO I DO