Position of the cursor Set for TextInput

Does anyone know of a method that I can call on TextInput focus to define the position of the cursor or select certain passages in the input field? I try to get the cursor always start typing at the end of the pre-populated text.

I tried these, but they do not seem to be valid methods for TextInput (I wasn't expecting to work because they are not in the documentation, but worth the try):

mytxtInput.setSelection(mytxtInput.text.length, mytxtInput.text.length);

OR

mytxtInput.selectRange(mytxtInput.text.length, mytxtInput.text.length)

Any help would be greatly appreciated!

Thank you to all members of this forum for everything that they great posts! They have really helped answer many of my questions.

Hey,.

you have the right idea, but instead to apply the method setSelection on your TextInput object, you must apply to the internal textField property reference to the textfield inside.

Here is a code example of an old NET that selects all of the text into a TextInput object:

package{   import flash.display.Sprite;  import flash.display.StageAlign;  import flash.display.StageScaleMode;  import flash.events.FocusEvent;   import flash.events.MouseEvent;

  import qnx.ui.buttons.LabelButton;    import qnx.ui.text.TextInput;

  [SWF(width="1024",height="600",backgroundColor="#CCCCCC",frameRate="30")] public class TextInputTest extends Sprite {

       private var myInput:TextInput;

      public function TextInputTest()       {         super();

          // support autoOrients            stage.align = StageAlign.TOP_LEFT;            stage.scaleMode = StageScaleMode.NO_SCALE;

          myInput = new TextInput();            myInput.setSize(300,50);

          addChild(myInput);          

          var newBtn:LabelButton = new LabelButton();           newBtn.label = "Click Me";            newBtn.setPosition(325, 0);

          newBtn.addEventListener(MouseEvent.CLICK, selectMyText);

          addChild(newBtn);

      }     private function selectMyText(e:MouseEvent):void      {         stage.focus = myInput;            myInput.textField.setSelection(0, myInput.textField.length);      } }}

This line is where it does the trick:

myInput.textField.setSelection(0, myInput.textField.length);

the first parameter is the selection of the starting points and the last parameter is how much it should be chosen.

Here is the link to the thread that the code comes for more details:

http://supportforums.BlackBerry.com/T5/Tablet-OS-SDK-for-Adobe-Air/how-to-select-all-text-with-QNX-T...

hope that helps. Good luck!

Tags: BlackBerry Developers

Similar Questions

  • Set the position of the cursor in the text added (to make the part of the text in index) in WORD using Report Generation Toolkit

    I would like to generate a report in WORD using the report generation toolkit.

    Whenever a text is added to the report, the program should put part of the text index. The problem I am facing with is to set the cursor position in the current location of the text.

    Any suggestions?

    Hello!
    I think that's what you wanted (see attachment).

    First, you must set position for each loop, so after adding the table, your cursor index need to increase the number of added characters. That's why I have included the text of the report, Append - to get the position of the cursor at the end.

    Indexing begins with 0, so you need to set the 3 and 7.

    Hope you get what I mean

  • Problem to find the Position of the cursor by using Java Script for an input TextField

    Hello

    I have a problem to find the position of the cursor in a field inputText component.

    The following code of java script to achieve. The same functionality works fine if I run in a simple html page. But when it is used the same javascript inside the jsff does not the position of the cursor.
    var adfComponent = AdfPage.PAGE.findComponentByAbsoluteId("r1:1:it3");
    var adfComponentClientId = adfComponent.getClientId();
    var div = document.getElementById(adfComponentClientId + '::content');
    div.focus();
    var docSelectionRange = document.selection.createRange();
    
    docSelectionRange.moveStart ('character', -div.value.length);
    
    var iCaretPos = docSelectionRange.text.length;
    
    alert("iCaretPos --> "+iCaretPos);  ---> This statement always returning '0'. Instead, i want the cursor position inside the text box.
    Please let me know what I'm missing.

    For your reference, sending the sample page html that works fine with the same kind of code.
    <html>
     
     <body style="font-family: tahoma; font-size: 8pt;">
     
      <script language="JavaScript">
     
       /*
       **  Returns the caret (cursor) position of the specified text field.
       **  Return value range is 0-oField.length.
       */
       function doGetCaretPosition (oField) {
     
         var iCaretPos = 0;
              alert(oField);
         if (document.selection) { 
     
           // Set focus on the element
           oField.focus ();
     
           // To get cursor position, get empty selection range
           var oSel = document.selection.createRange ();
     
           // Move selection start to 0 position
           oSel.moveStart ('character', -oField.value.length);
     
           // The caret position is selection length
           iCaretPos = oSel.text.length;
         }
     
         // Firefox support
         else if (oField.selectionStart || oField.selectionStart == '0')
           iCaretPos = oField.selectionStart;
     
         // Return results
         return (iCaretPos);
       } 
      
     
     
      </script>
     
      <form name="blah">
     
       Text Field: <input type="text" name="nameEdit" value="">
       <input type="button" value="Get Caret" onClick="document.getElementById('where').value=doGetCaretPosition (document.forms[0].elements[0]);">
    <input id="where">
      
     
      </form>
     
     </body>
     
    </html>
    Thank you and best regards,
    Kiran kristelle

    Published by: Kiran kristelle on February 6, 2012 12:00

    ... had the chance to look at the source code of the sample. ADF Faces renders text as HTMLTextArea fields when the value of the rows property. The JavaScript code used in the example of client works differently for FF and IE if the input is a text box. This could be a problem in IE or just used JavaScript code. The rows back to a single line (remove) property makes the text as HTML input feldworking with the JavaScript for IE and FF.

    Frank

  • Set the Position of the cursor in the Console (console or Windows default or CVI) window

    Hi all

    I'm working on a project for my college class with a large amount of data acquisition. Unfortunately, the part of the assignment asks to do entirely in the console rather than through a User Interface.

    I've programmed in C++ and have used the command gotoxy(). However, this is not part of the ANSI C standard. I can't find any additional information about the position of the cursor in C or CVI standards. Is it possible to position the cursor in CVI? If I have to, I'll resort to create a matrix of character as a screen buffer and encode them manually.

    Thanks again!

    -Bryan

    CVI 8.5

    These functions are part of the windows kernel. simply #include . If you get a link error, these functions should be in 'kernel32.lib' comes with LabWindows/CVI: Add kernel32.lib to the project and everything should be good (search folder x:\Program NIUninstaller Instruments\ to locate, its complete location depends on the version of the CVI you use).

    of course, this means that you must install the Windows SDK: it is an option in the installer of LabWindows/CVI. (you can also download the Windows SDK from the microsoft Web site, but you would be better with one that comes with CVI).

    a short guide on the documentation for the Windows SDK: each function is documented in a single page on every page of documentation for function, there is always a short summary at the end of the page telling you how to use the function: which header file you include, what library file, you must link with and on what version of Windows , the function is supported. Unfortunately, until the CVI 8.5.1 (I don't know for the CVI 9.0), the documentation for the SDK does not include the table of contents, which prevents to find something useful, unless you know what you are looking for the function.

  • Flex TextInput to get the current position of the cursor

    TextInput component in how to get the current position of the cursor? Because I want to record a loss of focus on the location of TextInput dynamically add text.

    Here:RichEditableText is a part of the skin of the class spark TextInput and is what is doing all the text in the editing/rendering of work. If you need to make all text advanced operations, they need to go through the property here. Because it is a part of the skin, you need to make sure that is not null before doing anything on this subject.

    Fixed typo: it is the property here is, not textInput

  • How can I enable the display of the position of the cursor?

    I just noticed that my cursor position does not appear when I work in illustrator.  I looked through all the settings and tried to find information on the web but experiencing problems.  I use CS5.5.

    Thanks for your help.

    Suzette

    Shown in what way?

    The cursor position is displayed in the Info Panel (window > info)

    Or if you show up on some guides (view > SmartGuides) you'll see things like positions of anchor or distances when establishing, but this isn't really the position of the cursor more precisely.

  • Select the text of the position of the cursor at the end of the story

    Hi scripters

    I want to cut, copy and paste text from the position of the cursor at the end of the story in a new block of text?

    How can I do this?

    Thanks in advance

    concerning

    a you are the

    Hi Arul,

    Here's an example for you. You can change the position and size of the text box according to your requirement.

    If (app.selection [0].constructor.name! = "PointInsertion")

    {

    Exit();

    }

    MyPage var = app.selection [0] .parentTextFrames [0] .parent;

    App.Select (app.selection [0].parentStory.insertionPoints.itemByRange (app.selection [0] .index, app.selection [0].parentStory.characters [-1] .index))

    App.Cut ();

    var FO = mypage.textFrames.add ({geometricBounds: [0,0,100,100]})

    App.Select(TF.insertionPoints[0])

    App.Paste ();

    Shonky

  • I have Sony Dsc - hx1 and not good mountain photos so I want the best setting for photography

    I have Sony Dsc - hx1 and photos in wrong mountain in which side of the photo is great and the other does not appear with better view

    so I want the best setting for photography

    http://www.Sony-MEA.com/support/product/DSC-HX1

  • How can I change the language setting for 4500 WANT after the initial Setup

    The language setting for the ENVY 4500 e-all-in-one printer has been mistakenly or inadvertently put in CHINESE (not sure how this can happen).  Now, the display is incomprehensible, so I can not understand how to change the language to ENGLISH.  Is there a simple way to change the language or reset the printer by default so that I can fix this problem?

    Thank you.

    Hi scfessler,

    Welcome to the HP Forums.

    I see you have a problem with the printer displayed in another language.

    On the front screen of the printer, press the top left button ( Home button).  Once on the home screen, press the arrow UP 2 times, this brings you to the preferences Menu, press OK.  Once in the Preferences menu, the first highlighted area is the enacted area please just press OK again.  The first language highlight is English, please press OK and then Yes to make the changes.

    If you still have questions, please let me know.

    Thanks for your time.

    See you soon,.

  • How to change the default setting for Australian News & Sport?

    How to change the default setting for Australian News & Sport?

    What setting, probably your browser home page, and how you do that depends on what browser you ar using.

    If using IE opens this page, then click on the "gear" icon to the rt at the top of the page, select Internet Options and look in the general tab

  • How to add text to the position of the cursor in HTMLEditor in JavaFX

    I know how to add new button to HTMLEditor and I want all of my action button to paste text at the current position of the cursor.


    //HTMLEditor html;
    //String IMAGE_URL = "http://...";
    Node node = html.lookup(".top-toolbar");
    if (node instanceof ToolBar) {
      
    ToolBar bar = (ToolBar) node;
      
    ImageView graphic = new ImageView(new Image(IMAGE_URL, 32, 32, true, true));
      
    Button myButton = new Button("", graphic);
      bar
    .getItems().add(myButton);
      myButton
    .setOnAction(new EventHandler<ActionEvent>() {
      
    @Override
      
    public void handle(ActionEvent arg0) {
      
    //needs code
      
    }
      
    });
    }

    Use the webkit API, so this isn't something you want to use in production since there is no guarantee that JavaFX will use webkit in the future. Really, the HTMLEditor should have an API editor that makes all of this transparent.

    You will need to import javafx.scene.web.WebView, com.sun.javafx.webkit.Accessor, and com.sun.webkit.WebPage;

                myButton.setOnAction(new EventHandler() {
                    @Override
                    public void handle(ActionEvent arg0) {
                        WebView webView = (WebView)htmlEditor.lookup("WebView");
                        WebPage webPage = Accessor.getPageFor(webView.getEngine());
                        webPage.executeCommand("insertText", " World Cup Soccer ");
                    }
                });
    
  • What is the best setting for H264 Blu Ray bit rate, which will play OK on most / all blu ray players.

    What is the best setting for H264 Blu Ray bit rate, which will play OK on most / all blu ray players. When you use CBR and VBR. What are the benefits of progressive and interlaced with regard to playback on all players.

    You don't need to worry about compatibility with Blu - ray playback.

    I prefer a variable bitrate for its effectiveness.  (Not necessary spending 25 MB on a framework in need of 10 right?)

    Using interlaced or progressive will depend on what you shot.  (Take note that 30 p is an atypical, so do not pull that.  Pull only 720 p/24, 720 p/60, 1080 p/24 or 1080i/30).

  • DPS: Judge to use the parameter Raster or vector in the States of the objects when the majority of the page is a photo. What is the best setting for the overall performance?

    I am trying to decide whether to use the parameter Raster or vector in the States of the object when the majority of the screen is a picture (with a modest but important legend for children to read). The legend certainly makes it look more net as vector. But does the photo! The raster setting seems to make the lower-res images in comparison. In my first edition of my application, I thought that raster would be the best setting when the photo was the subject dominating the page. But now, after seeing how strong he looks like vector, (but with almost a refresh of the unacceptable time. Perhaps better on the latest iPad. Most of my readers/students in class will use iPad 2 s, which has a slower processor). I wonder if I should go through the trouble of changing States of photo objects that have the type as well to the vector. It doesn't seem to be as sensitive to a re - draw on the iPad 2 (non-retine)

    Is Filesize hit if I make about 1200 on these objects range from Raster to vector? (It is a huge, highly interactive history book, so I'm curious if acutally go to vector on these photos would reduce the size of the file) What is the best setting for the overall performance?

    I see the freeks screen outside for a bit if you try to pinch and zoom in a vector object (photo) vs raster. Which is disappointing. Does slow down load time/refreshment in frame, which is a little less. I also found that the drop shadows really bad that redraws effect in vector, almost vibrating in a slide show, for example. Thus, in cases where I need shadows, I'm sticking with Raster.

    All tips go ahead?

    Brian

    Does that help? http://boblevine.us/Digital-Publishing-Suite-101-keep-text-sharp-in-raster-slideshows/

  • Change the default setting for files...

    Is it possible to change the default setting for effects of pixelization at 300ppi instead of 72 dpi? And is it also possible to have "Align new objects of pixel grid" unchecked by default? I realize I can change all of these settings when I create a file or after, but I would like them to be my default settings. I'm under Illustrator CC on Windows 7. Thank you!

    Create your own profile document containing these settings

    http://blogs.Adobe.com/adobeillustrator/2009/05/startup_profiles_a_great_tool.html

  • What is the best setting for a better quality of shades?

    Hello!

    I would like to know what are the best codec and the best setting for a video with 1920 x 1080 resolution.

    I tried everything but nothing because the shadows... are not the nuances.

    I want a video which is like a video not compressed, but lighter. Same quality, same shades.

    I tried with Canopus Lossless but the video is dark and huge (7 min to > 17 GB),

    then with Canopus HQ, even of quality but a little more light (6 GB),

    I tried with all settings and codecs, but I have not found what I want.

    Who can help me for the best settings for the best colors?

    Thank you very much.

    PS: Sorry for my English!

    If you want to download the video on YouTube, use the YouTube encoding presets into Adobe Media Encoder.

Maybe you are looking for

  • Cannot communitcate with Canon MP530 after upgrade to El Capitan

    iMac (27 inch, mid 2011) 10.11.5 Canon MP530 I just upgraded to El Capitan yesterday, the printer was fine yesterday morning. New drivers not available from Canon. When you try to add the MP530, I get a dialog box saying "an error occurred while tryi

  • DeskJet 2549: try to install Deskjet 2549

    Hello tried to install our Deskjet 2549 today. The latest driver downloaded from the HP website (v12.34.0.dmg). When you try to add the printer, I get notification: "software is not manufacturer of printers available, contact for the most recent vers

  • Properties prode

    Has anyone experience by accessing a generic Windows DLLS in LabView? I want to use properties Prode (see 'prode.com') for the calculation of the thermodynamic properties required by a control system based on LabView, I am able to access the C dll, C

  • Camara photos do not show when plug into the computer's time a 2nd

    If I plug my camara to the computer and show the image files and now when I plug it for the second time that the file showed that copy and the custom of photos to display at all in my computer or any other computer. who is wrong?

  • 3 breakpoints - desk and telephone

    I need to know how to get around this problem. I designed the site using 3 320,600,1440 breakpoints.children are intended for tablets and phones.And the biggest for desktop computers and more.but the problem is when I am posting on my ipad pro compre