What's the best way to detect that text fits into ContainerControllers without scrolling?

Hi.
Question
What's the best way to detect that text typed by user (or added programmatically) exceeds available container space and find out where starts truncated part? Is there available some other (than described bellow) easy way to detect it or disallow set of controllers to receive more characters that can be displayed in given composition area?
My partialy failed attempt (simplified)
For example lets say that I've got an editable textflow with attached two instances of ContainerController.
var flow:TextFlow = createSomeFlowFromGivenString(sampleText),
    firstController = new ContainerController(firstSprite, 100, 30),
    lastController = new ContainerController(secondSprite, 600, 30);
flow.interactionManager = new EditManager(new UndoManager());
flow.flowComposer.addController(firstController);
flow.flowComposer.addController(lastController);
flow.flowComposer.updateAllControllers();
With enabled vertical scroll policy I can compare height of the composition in last controller with height of the content:
var bounds:Rectangle = lastController.getContentBounds(),
    overflow:Boolean =  lastController.compositionHeight < bounds.height;
trace('Content does not fit into given area?', overflow)
But when I switch vertical scroll policy off (lastController.verticalScrollPolicy = ScrollPolicy.OFF) - unfortunately this no longer works...(In my case scrolling should be dissabled, since text areas might have only one line with restricted width)
Use case
I want to create fillable form. Field might have a single or multiple lines. One field might start in the middle of the page, continue in the next line where it spreads through whole page and end in the - quarter of page width long  - third line. Text typed by the user can't exceed given area since it might cover some static text that sits right after/below field.
Something like ascii image bellow:
|                <PAGE>                    |
|                                          |
|                                          |
|                                          |
|               [Field starts here........ | 
| ........................................ |
| ........................................ |
| Ends here..]                             |
|                                          |
|                                          |
| [Another field] xxxx  xxxx xxxxxxxx x xx |
| xxxxxxxxxxxxxxxxxxx                      |
|                                          |
|                              [One more.. |
| .....]                                   |
|                                          |
|                                          |
|                                          |
|                                          |
|                                          |
|                                          |
|                                          |
|                                          |
Info:
[......]  <-- form fields starts with '[' character, and ends with ']'
xxx       <-- sample, static text
| and _   <-- page borders

I've tried something like that previously, but it didn't work because then I've got vertical scroll policy to set to 'auto'. After changing verticalScrollPolicy to ScrollPolicy.OFF  in the last container it worked like a charm.
Thanks zhen bian

Similar Messages

  • What is the best way to detect peak to peak voltage for the following waveform ?

    I have two channels of waveform train ( ie W1 & W2 ), each of them is of frequency 64KHz.
    Each channel of waveform train consists of sinewaves of 64KHz of fixed amplitude, say 2 V pk to pk, running for 100 cycles, and then rest for 0.15 sec continue with a sinewave of 64KHz of another fixed amplitude, say 1 V pk to pk running for 100 cycles as well, and then rest for 0.15 sec. The above cycle considered as a complete waveform cycle.
    The above complete waveform cycle repeat for 10 cycles and rest for 1.3 sec and repeated itself.
    From the two simulated waveforms (ie W1 & W2), I need to detect and measure the peak to peak voltage of each of the 100 cycles sinewaves.
    What is th
    e best way to achieve that ?

    The waveform is free running as described above, ie sinewave running at approximate 64 KHz for about 100 cylce at fixed amplitude, say 2V ( actual number of cylce unknown, could slightly more or sightly less, depanding on the machine ) then rest for approximately 0.15sec, another sinewave running at approx. 64KHz at fixed amplitude, say 1.5V ( actual number of cylce unknown, could slightly more or sightly less, depanding on the machine ) running for approx 100 cycles continue...then rest for approx. 0.15 sec .....the above waveform repeated itself and free running .....I would like to capture or trigger each of the 100 cycles sinewave (rest time of 0.15 sec between each approx100 cycles of sinewave) to measure the peak to peak voltage and st
    ore them in array for analysis purpose....what is the best way to achieve that as I do not have time reference, I only know that the waveform is running at the pattern described above.
    Thanks for your help !

  • I have a Pages file that I would like to make secure. What's the best way to do that?

    I have a Pages file that I would like to make secure. What's the best way to do that?

    Inspector  > Document > Document > Require password to open
    Peter

  • I used MobileMe/idisk to hold all of my files and access from my iPad.  It worked beautifully.  What is the best way to do that now?

    I used MobileMe/idisk to hold all of my files and access from my iPad.  It worked beautifully.  What is the best way to do that now?
    In particular, I am having issues with documents that already exist on my Mac and trying to get my iPad to access them. 

    A popular option seems to be DropBox.

  • I bought a new computer and want to transfer pics from a regular folder to the new computer.  What's the best way to do that?

    I bought a new computer and want to transfer pics from a regular folder to the new computer.  These aren't in the cloud so they didn't transfer automatically.  What's the best way to do that?  Can I sync my old computer to my new computer through I tunes and transfer them that way?

    iTunes will only transfer them to your iPad, and once transferred to your iPad they cannot be imported to your other computer (only camera roll photos can).  You will either have to use a usb flash drive or external drive to transfer them, or use an app like PhotoSync, which will transfer photos between your devices and computers over your wifi.

  • What is the best way to merge a file content into log file

    What is the best way to merge a file content into log file.
    In worst case, I will read the file line by line as string, then use
    logger.info(lineString)to output to log file.
    However, is there better way to do this?
    The eventual log file will be something like:
    log message 1
    log message 2
    content from file line 1
    content from file line 2
    content from file line 3
    log message 3
    log message 4Thanks

    John618 wrote:
    Thank you and let me explain:
    1. What do you mean by better?
    I would like to see better performance. read line by line and log each line as string can be slow. Did you measure this and determine that it is actually a problem for your application? Or are you guessing?
    Regardless of what you do you are still going to need to read the file.
    >
    2.The only better way I can think of is not having to do it, but I assume you have a very good reason to want to do this.
    Yes, I have to do it beacuse the requirement is to have that file content be part of logging.
    Any idea?How is it supposed to be part of it? For example which of the following is better?
            File AAA - contents
                       First Line
                       Second Line XXX
            Log 1
                    2009-03-27 DEBUG: Random preceding line
                    2009-03-27 DEBUG: First Line
                    2009-03-27 DEBUG: Second Line XXX
                    2009-03-27 DEBUG: Random following line
            Log 2
                    2009-03-27 DEBUG: Random preceding line
                    2009-03-27 DEBUG: ----- File: AAA -------------
                    First Line
                    Second Line XXX
                    2009-03-27 DEBUG: Random following lineBoth of the above have some advantages and disadvantages.
    The first in a mult-threaded app can end up with intermittent log entries in between lines, so having log lines with thread ids becomes important.
    The first can be created by reading one line at a time and posting one at a time.
    The second can be created by reading the entire file as a single string and then posting using a single log statement.

  • What's the best way to convert a current website into a Fluid Grid Laout?

    As the title says....
    What's the best way to convert a current website into a Fluid Grid Laout?

    See "Using Fluid Grid Layouts (video)"
    http://tv.adobe.com/watch/learn-dreamweaver-cs6/using-fluid-grid-layou ts/
    Nancy O.
    Alt-Web Design & Publishing
    Web | Graphics | Print | Media  Specialists 
    http://alt-web.com/
    http://twitter.com/altweb
    http://alt-web.blogspot.com/

  • I have two users on the same MAC and want to have separate ITunes libraries stored on my time capsule.  what's the best way to ensure that is done?

    I have 2 users on a MAC each with separate accounts (email, photo, ITunes) and I want to migrate my ITUnes Library over to a time capsule so that each usewr still has their own library bu don't want to duplicate songs.  What is the best way to have both Itunes pointed to separate libraries both stored on the Time Capsule?

    A bit of basics on iTunes.  iTunes does 99% of what you see through a library.itl file in the iTunes folder.  This file is a database and in it are references to the actual media files.  These files can be anywhere in theory, but if you have iTunes set to default then they are nicely organized in media folders in the iTunes folder.  You have probably moved them to some central shared location in the past, then built up two individual libraries around that central location.
    iTunes is very fussy about a person dragging files to a different location, and that goes double if the other location is on a different drive.  You can move files, but it is best to let iTunes do it so it can keep track.  If this was just for one person I'd say go into preferences, select the other drive for media location, then close preferences. My understanding (never done this before) is iTunes will then ask you if you want to move your media.  Say yes and iTunes will move it and keep track of it -- for your library.  Now when you go to the other person's library, it opens and you see loads of ! because their library is still looking for the media on the same  drive as the library is located on.  I don't think it will work (but you could always try) to re-assign the media location to the external drive because the reference in the database is to look for such-and-such a file on the internal drive.  iTunes did that for the first library as part of the move, but not for the second one.  Note that typically when you want to move a single user's collection from drive to drive we advise moving the whole iTunes folder, library files and all, to another drive, but you don't have that structure.
    So I'm not sure what to advise.  If it were me and I was absolutely gung-ho on doing this I would re-assign the media with one library.  Then edit the .xml version of the library file for the second library so it points to the new file locations and import this into a fresh iTunes library for the second user.  This isn't the perfect solution because nominally the .xml version does not 1005 replicate all the characteristics of the original .itl file (which cannot be edited).
    Or maybe some other user bas a better idea.

  • I want to take photos from someone's gallery and import them into my iphoto.  what's the best way to do that?

    A friend sent me a gallery.  I select the pic I want and download.  They show up on my screen in Preview.  What's the best way to get them into my Iphoto library? 

    Greetings,
    Drag them from where you downloaded them (Like the Downloads folder) and drop them on the iPhoto icon in the dock (little camera with the sunset behind it).
    When you drag and drop an image on the iPhoto icon it imports that picture (or many pictures if you drag more than one at once).
    Cheers.

  • What is the best way to plug my iPhone 5 into a mixer for live music performances?

    I'm thinking of performing live with my iPhone 5 or maybe an iPad that I haven't bought yet. What is the best way to get the sound for the device to a mixer or PA? I'm wondering if anyone has any experience with wireless options. I'm wondering if it is stable enough for live performance. There doesn't seem to be any audio interface options yet.

    there is always the 3.5mm minijack out connector sure it's analogue but a cable with male minijack in 1 and and 2 rca in the other would work with most mixers and or pa's

  • What is the best way to make a program fit different monitor resoultions?

    In our lab all our test stations have 1280x1024 resoultion monitors. In the "other lab" all the test station monitors are 1440x900 resoultion.
    Now I am tasked with making my programs run on the test stations in the other lab. I have tried setting the options "maintain proportions of windows for different monitor resoultions" and "Scale all object on front panel as the windows resizes" and of course neither one of these options really does what I would expect it to do.
    What is the best way to make programs fit different monitor resoultions?

    J-M wrote:
    I resize the Front Panel when the program start to fit the monitor resolution.  After that, I use the "SBE_Determine If Screen Resized.vi" from TomBrass (http://forums.ni.com/t5/LabVIEW/Resizing-controls-on-a-tab-control-within-a-pane/td-p/1520244 ).  This vi is very useful if you don't want to monopolize the CPU with the "Panel Resize" event.
    I don't like this function for a couple reasons.  First for the example you don't need any custom code to handle the window resizing, just use a couple splitters.  Even if you did need to handle the resize, you only resize after the mouse is up after the resize which is not how normal Windows programs work they resize as the mouse moves.  So I modified the VI to resize objects as you resize the window.  Then because doing this can generate 100 events very quickly, I use a boolean in a shift register to make sure that we only handle the resize event if there is no new resize events after 0ms.  This essentially makes a lossy queue and handles the last resize event.
    Unofficial Forum Rules and Guidelines - Hooovahh - LabVIEW Overlord
    If 10 out of 10 experts in any field say something is bad, you should probably take their opinion seriously.
    Attachments:
    Resizable_Graph.vi ‏22 KB

  • I want to transmit a square pulse through USB port, is it possible?? if not then what is the best way to do that, preferable is with serial then parallel, and its compatibility with vista,XP,and @))7 windows

    hi froends
    i want to transmit a square pulse using lab-view, please help how to do that, the preference  will be USB,SERIAL, Parallel ports, it it must be compatible with all the os versions, like 2007 windows, vista,XP and other.
    please help..................

    sanghi wrote:
    OK I WANT TO DRIVE A RELAY.
    SUGGEST SOMETHING 
    Calm down!
    People can't read your mind.  If you want help, repsect those who contribute their time for free to try to help you.
    Put yourself in our shoes.  If I tell you I want to build a rocket, what information would you give me?  You would need to know if it's for a hobby, something bigger, carries a payload, carries living organism, how far does it go, where does it land (if at all), etc...  
    First of all, we still don't know what you want to do with this relay.  Using a computer to generate is series of pulses is not usually the best way.  What is the frequency of the pulses that you want to transmit?  And why do you want to use a relay?  What are you driving?  Can the relay that you are using fast enough to follow the pulse train that you'll be sending?
    Provide information, ask questions politely and people will help you.

  • What is the best way to detect loss of OPC Server connection when using DSC Tags?

    I'm using the DSC Module on a new project and I'm pretty impressed so far. The HMI Wizard has saved me quite a bit of time.
    My application is configured where the DSC Tags are connected to remote OPC Server Tags.
    The issue I'm having is that I cannot detect a loss of the OPC Server when the application is running. Read's of the front panel controls/indicators still return values and the little "connection" icon next them is still green. Even if the connection icon turned red it wouldn't help since the Front Panel is not visible when the main application is running. It is a Sub-VI that's in charge of OPC Data Interfacing. The rest of the application uses the data from the OPC Sub-
    VI.
    I cannot effect a change on the OPC Servers, so I need a method of detection when the Server is lost on my end.
    Any ideas on the best way to do this?
    Thanks,
    Jim

    Hi Jim,
    Ideally, error-reporting and -handling should be the way to handle this. However, if errors are not reported/handled as is sometimes the case with OPC, a quick-n-dirty way to do this would be to check for a "heartbeat" signal from your OPC Server. This could be a boolean tag which toggles On and Off (or a counter ticking). You then read this Tag in DSC in a slow loop using the Read Tag VI (not the front-panel control). And keep track of the Changed? output from this Read Tag VI.
    As long as the 'Changed?' output is true, you are receieving data from the OPC Server, and hence it's alive. You may add some deadband logic to wait for a specific period of time before declaring the Server's really dead!
    Hope this helps,
    K
    halid

  • What is the Best Way to reimport my iPhoto library into Aperture 2?

    I used the Aperture 1.5 trial version and imported my iPhoto library (most of it anyway).
    I then bought Aperture 2 and I want to reimport my iPhoto library but don't want to screw it up and erase projects and things I've done in Aperture 2.
    Also, I don't like or know how to change the Aperture 2 "folders" under Projects that reference my photos. I want to reimport the photos with dates or something to show what they are (wish Aperture had Events on the left like iPhoto).
    Can anyone tell me the best way to do this so I don't screw up the photo changes (extensive) and projects that I have made in Aperture? I think I just reimport and make sure I don't import duplicates, etc. but I would like some reassurances.
    Also, I have no idea what a vault or a stack is in Aperture.
    Thanks for the help!

    There isn't a way to reimport the iPhoto library yet have it maintain the changes you made to images in Aperture. Now you can upgrade to 2.1 and Aperture will upgrade your current library keeping your changes intact.
    Aperture and iPhoto go about their organization based on different principals. Apple thinks you'll use iPhoto for the snaps from your kids graduation or the family BBQ, hence the events. Aperture, being a professionally oriented program, is based on the idea of projects. That's why they don't have the same structure on the left.
    You can get something similar to iPhoto's events in Aperture however, by clicking on "All Projects" under your library.

  • What's the best way to load FieldPoint measurement data into PI System?

    I am finding the best way to load data collected by NI Field Point (FP2220) into the PI system of our power plant.
    I found pieces of information about FieldPoint OPC server in NI.com. Not sure if it comes with Field Point Hardware, sold by NI as a separate product or it is actually non-standard NI products. Anyway, I know that there exists a thing called FieldPoint OPC server.
    The PI system I mentioned has a OPC client software called PI-OPC interface. It is able to communicate with standard OPC DA server. If that FieldPoint OPC server is a standard OPC DA server provide data collected by Field Point complying to OPC standard, than that's perfect.
    Anyone familar with PI system and NI product, please help if the above is going to work or if there is a better way to put Fieldpoint data into PI.

    Hi Eric,
    This information really helpful, thanks. Regarding to the NI OPC server for NI FieldPoint, I have the other query.
    In my setup, there are two sets of FieldPoint located in two different locations on my ethernet network. They are going to be controlled by a single PC. If I am going to connect both my FieldPoint sets with OPC standard, how many NI OPC server for FieldPoint do I need to connect to? Are there two NI OPC servers each serves one FieldPoint set? Or there is only NI OPC server which serves both FieldPoint sets?
    I am concerning about the number of NI OPC server instances running, because the number of OPC client license I need to purchase depends on how many OPC server I need to connect to. If one NI OPC server serves both my FieldPoint sets, I only need to buy one OPC client license; otherwise, I need to purchase two. In the future, I am going to have another two sets of FieldPoint sets, so the answer of my query determines how many OPC clients I need to purchase eventually - One or four. A huge price difference.
    Looking forward to your reply.
    Regards,
    Roger

Maybe you are looking for

  • Connection Pooling much faster but eventually brings down the site

    Hello, We are running Oracle 11g, with ODP.net. When we have connection pooling turned off the site is very slow. When we turn it on, the site runs very fast, but will all of a sudden slow down to a crash and require an IIS restart. (We will receive

  • Adding logo with Alpha channel to Quicktime and exporting as .mp4

    I'm adding a PNG file with alpha channel to my existing movie file using "Add to Selection and Scale". I then have my movie with the overlayed graphic. When I then Export as an mp4, the alpha channel is ignored! Any help, anyone?

  • How to set an ActiveX Property

    Hi   I am having problems understanding how I can set a property of an ActiveX control in lookout. Here is what I am trying to do. I have an activex contol that shows a cctv camera's video.The video is showing up properly on my lookout screen. The na

  • Trying to use authorization schema but getting ORA-00907: missing right par

    Hi, I am fairly new to HMTLDB. I am busy going through the Issue Tracker Tutorial. I am on the last part of Tutorial. This part involves authorizing a user based on their roles in the company. I now keep getting the following when I load my pages ORA

  • DW CS3 a year old

    I just noted that Dw CS3 is now over a year old - according to my files which say they were mostly created on 20th March 2007. Sad to see that in that period Adobe have not seen fit to issue any updates to the program to fix a few of the bugs :-( ~Ma