SetFocus, TextInput method?

I really need focus setting to TextInput box. How can I do?

package
{
    import flash.display.Sprite;
    import flash.display.Stage;
    import qnx.ui.text.TextInput;

    public class PlayBookTest extends Sprite
    {
        public function PlayBookTest()
        {
            var input:TextInput = new TextInput();

            addChild(input);

            stage.focus = input;
        }
    }
}

However, it seems not automatically bring up the virtual keyboard - at least not in the Simulator.  If this is what you want, there is no doubt, I believe that you will have to wait until RIM is updating the SDK with more support for the keyboard.

Tags: BlackBerry Developers

Similar Questions

  • TextInput.setFocus () does not work

    TextInput.setFocus () doesn't seem to work if the TextInput is in a TabNavigator/ViewStack. Is this a known bug?

    I have a TabNavigator in a TitleWindow. There are several VBoxes for each "tab" in the TabNavigator. Each VBox has a form with a TextInput. When the user clicks a tab to display a different VBox in TabNavigator/ViewStack, I want the TextInput that VBox to get the developed and have the cursor placed in it. Using the TabNavigator valueCommit event sets the focus of the TextInput, but does not place the cursor. I tried 'Application.application.systemManager.stage.focus is TextInput', "focusManager.setFocus (TextInput)" and "TextInput.setFocus ()", nothing helps.

    No work around or help is greatly appreciated.

    Sorry, but I put aside the issue of deep links.
    Change this line: valueCommit = "changeTabs (event); »
    For this: mouseUp = "changeTabs (event); »

    The problem here is that the valueCommit Flex causes to move focus back to the tab. The mouseUp event works because the valueCommit already was triggered BEFORE the event mouseUp, and now you can move it to the textInput. At least that's what it looks like to me when I draw it.
    The focus in your application was just bounce the textInput and back to the new tab.

  • Why the setFocus() and setText() methods does not work for BasicEditField

    Hello

    I tried to apply the methods of setFocus() and setText() on a BasicEditField, but he always up "illegal state exception.   However, the getText() method can work.

    Can someone explain this please? Thank you!

    Another thing would be - if you use filters on your EditField and allows you to define something that is not allowed by the filter, it will throw an exception setText()...

  • How to read the value of an independent textInput element inside the method?

    Hello

    I had a group of detail based on a readonly viewobject. I added an independent element textInput, you say, EndDate to this group that the user can enter a value inside. Now, when I run the app I select a row in the table and press a button that triggers a method inside a bean. My question is how I read the value in independent textInput (EndDate) within the method element?

    getTable () .getRowData () does not print the unbound attribute. It seems that it only contains attributes underlying viewobject

    I use JDev 11.1.1.4

    Kind regards
    Will do

    Will do,

    You can better create a transitional attribute for that in your view object, so you can use a regular expression #{row.bindings...} to get the value.

    Steven Davelaar,
    JHeadstart team.

  • method not found 'setfocus '.

    I get the error message: hostPsuedoModel is not a 'setfocus' method we have installed something wrong.  Designer 8.2.1 version...

    Check the spelling in your code, setfocus must be setFocus.

  • How the setFocus() method in AS3?

    Hello world. I'll try to keep it as simple as possible.

    I try to use the setFocus method to highlight the default text in a text input field.

    So bascially when the user clicks on the text field - the text is highlighted, and they can hit. Currently have about 16 text fields with something similar to "insert text here" as a guest for our lower ICT demographic of users and it is a bit tedious to expect the user to highlight text in each field, then tap it.

    Can be done awesomly if you tab through the fields of text, but I expect not many users use this method.

    I looked around on the net solutions to it using as3, but I have not found something that worked for me. I would be very grateful for a suggestion or a point in the right direction...

    Thank you

    If you want to by clicking on a textfield end with the text inside it, try the following...

    TF1.addEventListener (MouseEvent.MOUSE_UP, selectText);

    TF2.addEventListener (MouseEvent.MOUSE_UP, selectText);

    TF3.addEventListener (MouseEvent.MOUSE_UP, selectText);

    etc...

    function selectText(evt:MouseEvent):void {}
    evt.currentTarget.setSelection(0,evt.currentTarget.length-1);
    }

  • SetFocus to textInput while loading application itself?

    Help me someone setfocus to textInput while loading application itself?

    Hello

    you request completehandler has just set the focus is myinput.setfocus ();

    David.

    http://ns.Adobe.com/MXML/2009.

    xmlns:s = "library://ns.adobe.com/flex/spark".

    xmlns:MX = "library://ns.adobe.com/flex/mx" minWidth = "955" = "600" minHeight

    creationComplete = "application1_creationCompleteHandler (event)" > "

    Import mx.events.FlexEvent;

    protected function application1_creationCompleteHandler(event:FlexEvent):void

    {

    in3. SetFocus();

    }

    ]]>

  • Definition of focus on TextInput in Mobile app raises StyleableTextField exception

    I have a mobile small (4.5 flex) application in which I want to put a TextInput field to have focus when the view is finished being created. So in the creationComplete handler I just call setFocus on the TextInput field. However, it throws an exception of the null object in the setFocus method of StyleableTextField . It seems that the stage of field is null. Everyone fell on this? Or, there are some special conditions that must be fulfilled before it can occur without an error?

    Try waiting for the addedToStage event.

  • Property or method of a null object reference. "OK, go crazy. account of $ 50 for a paypal account, if someone explains why & solution - "cannot access a pro."

    I guess that's cheezy to offer money to help (and I guess this a little tied to a post being discussed yesterday), but I'm so tired of searching - been trying things ALL day and its value at a minimum of $ 50 if someone takes a while to help with an explanation of what is happening and how to fix it (hopefully it's just a matter of newbie that I) be cursing myself for lack.)

    I have things to a restricted version of the app to demonstrate the problem. You can download (link at the bottom of page) and just run the html/SWF in bin-debug and you will see the problem (or perhaps understand the linke also supplied code). Click Connect and then ' Add used ' and it just put the cursor in the firstname field and click. You'll find yourself with the following error:

    TypeError: Error #1009: cannot access a property or method of a null object reference.
    at mx.managers::FocusManager/focusInHandler() [C:\autobuild\galaga\frameworks\projects\framew ork\src\mx\managers\FocusManager.as:601]
    to flash. display::Stage / set focus()
    at mx.core::UITextField/setFocus() [C:\autobuild\galaga\frameworks\projects\framework\src\mx\ core\UITextField.as:1525]
    at mx.controls::TextInput/setFocus() [C:\autobuild\galaga\frameworks\projects\framework\src\m x\controls\TextInput.as:1832]
    at mx.managers::FocusManager/setFocus() [C:\autobuild\galaga\frameworks\projects\framework\sr c\mx\managers\FocusManager.as:553]
    at mx.managers::FocusManager/mouseDownHandler() [C:\autobuild\galaga\frameworks\projects\fram ework\src\mx\managers\FocusManager.as:1896]

    I know that the problem is related to _defaultButton null in FocusManager focusInHandler (at least the debugger shows the problem here), but do not know why this is * there. You will see in two simple display batteries, I've set creationPolicy = "all" (I even tried to set createionPolicy = 'all' on almost all the components.)

    View the main relevant files:

    http://Pastie.org/610389

    Download the sample application demonstrating the issue

    http://DL.getdropbox.com/u/86998/EmployeeMaintenanceTest.zip

    If you file a bug with your testcase, this will help to make sure we don't break it in Flex 4.  I don't know if there will be a new version 3.x.

    I got around the problem by adding to the level superior canvas in Main.mxml:

    defaultButton = "{mainNavigation.addEmployeeButton}" "

    In my view, that principle is once you assign a default button in a container, to keep something like the default button after that.  If the focus moves to a container without a default button, then I think he's in trouble.

    Alex Harui

    Flex SDK Developer

    Adobe Systems Inc..

    Blog: http://blogs.adobe.com/aharui

  • Bug when you set the text of a TextInput in MXML

    Hello

    I upgraded my Playbook Tablet OS version 2.0.0.6149 previous beta (I think it was 2.0.0.4xxx). Since then, my application written in Flash Builder 4.6 target AIR 3 fails when I put the text into a TextInput in MXML.

    The MXML code is:

    <>

    ID = "frequencyText" text = "440,000" / >

    When I run it, I get the following error:

    TypeError: Error #1009: cannot access a property or method of a null object reference.

    at qnx.stagetext.ui.text::EditableText/setAreaOfInterest() [/ home/builder/hudson/workspace/GR2_0_0_CE2-SWF_StageText/src/stagetext/src/qnx/stagetext/ui/text/EditableText.as:792]

    at qnx.stagetext.ui.text::EditableText/insertText() [/ home/builder/hudson/workspace/GR2_0_0_CE2-SWF_StageText/src/stagetext/src/qnx/stagetext/ui/text/EditableText.as:1015]

    to qnx.stagetext.ui.text::EditableText/set text() [/ home/builder/hudson/workspace/GR2_0_0_CE2-SWF_StageText/src/stagetext/src/qnx/stagetext/ui/text/EditableText.as:303]

    to flash.text:tageText/set text()

    to spark.components.supportClasses:tyleableStageText/set text() [E:\dev\4.y\frameworks\projects\mobilecomponents\src\spark\components\supportClasses\StyleableStageText.as:1143]

    to spark.components.supportClasses:kinnableTextBase / textDisplayAdded () [E:\dev\4.y\frameworks\projects\spark\src\spark\components\supportClasses\SkinnableTextBase.as:2315]

    to spark.components.supportClasses:kinnableTextBase / partAdded () [E:\dev\4.y\frameworks\projects\spark\src\spark\components\supportClasses\SkinnableTextBase.as:1751]

    at::TextInput/partAdded() [E:\dev\4.y\frameworks\projects\spark\src\spark\components\TextInput.as:354] spark.components

    to spark.components.supportClasses:kinnableComponent / findSkinParts () [E:\dev\4.y\frameworks\projects\spark\src\spark\components\supportClasses\SkinnableComponent.as:736]

    to spark.components.supportClasses:kinnableComponent / attachSkin () [E:\dev\4.y\frameworks\projects\spark\src\spark\components\supportClasses\SkinnableComponent.as:701]

    to spark.components.supportClasses:kinnableComponent / validateSkinChange () [E:\dev\4.y\frameworks\projects\spark\src\spark\components\supportClasses\SkinnableComponent.as:443]

    to spark.components.supportClasses:kinnableComponent / createChildren() () [E:\dev\4.y\frameworks\projects\spark\src\spark\components\supportClasses\SkinnableComponent.as:406]

    at mx.core::UIComponent/initialize() [E:\dev\4.y\frameworks\projects\framework\src\mx\core\UIComponent.as:7634]

    to mx.core::UIComponent /() http://www.adobe.com/2006/flex/mx/internal:childAdded [E:\dev\4.y\frameworks\projects\framework\src\mx\core\UIComponent.as:7495]

    at mx.core::UIComponent/addChildAt() [E:\dev\4.y\frameworks\projects\framework\src\mx\core\UIComponent.as:7199]

    at::Group/addDisplayObjectToDisplayList() [E:\dev\4.y\frameworks\projects\spark\src\spark\components\Group.as:2037] spark.components

    to spark.components::Group /() http://www.adobe.com/2006/flex/mx/internal:elementAdded [E:\dev\4.y\frameworks\projects\spark\src\spark\components\Group.as:1628]

    at::Group/setMXMLContent() [E:\dev\4.y\frameworks\projects\spark\src\spark\components\Group.as:633] spark.components

    at::Group/createChildren() [E:\dev\4.y\frameworks\projects\spark\src\spark\components\Group.as:855] spark.components

    at mx.core::UIComponent/initialize() [E:\dev\4.y\frameworks\projects\framework\src\mx\core\UIComponent.as:7634]

    to mx.core::UIComponent /() http://www.adobe.com/2006/flex/mx/internal:childAdded [E:\dev\4.y\frameworks\projects\framework\src\mx\core\UIComponent.as:7495]

    at mx.core::UIComponent/addChildAt() [E:\dev\4.y\frameworks\projects\framework\src\mx\core\UIComponent.as:7199]

    at::Group/addDisplayObjectToDisplayList() [E:\dev\4.y\frameworks\projects\spark\src\spark\components\Group.as:2037] spark.components

    to spark.components::Group /() http://www.adobe.com/2006/flex/mx/internal:elementAdded [E:\dev\4.y\frameworks\projects\spark\src\spark\components\Group.as:1628]

    at::Group/setMXMLContent() [E:\dev\4.y\frameworks\projects\spark\src\spark\components\Group.as:633] spark.components

    at::Group/createChildren() [E:\dev\4.y\frameworks\projects\spark\src\spark\components\Group.as:855] spark.components

    at mx.core::UIComponent/initialize() [E:\dev\4.y\frameworks\projects\framework\src\mx\core\UIComponent.as:7634]

    to mx.core::UIComponent /() http://www.adobe.com/2006/flex/mx/internal:childAdded [E:\dev\4.y\frameworks\projects\framework\src\mx\core\UIComponent.as:7495]

    at mx.core::UIComponent/addChildAt() [E:\dev\4.y\frameworks\projects\framework\src\mx\core\UIComponent.as:7199]

    at::Group/addDisplayObjectToDisplayList() [E:\dev\4.y\frameworks\projects\spark\src\spark\components\Group.as:2037] spark.components

    to spark.components::Group /() http://www.adobe.com/2006/flex/mx/internal:elementAdded [E:\dev\4.y\frameworks\projects\spark\src\spark\components\Group.as:1624]

    at::Group/setMXMLContent() [E:\dev\4.y\frameworks\projects\spark\src\spark\components\Group.as:633] spark.components

    at::Group/createChildren() [E:\dev\4.y\frameworks\projects\spark\src\spark\components\Group.as:855] spark.components

    at mx.core::UIComponent/initialize() [E:\dev\4.y\frameworks\projects\framework\src\mx\core\UIComponent.as:7634]

    to mx.core::UIComponent /() http://www.adobe.com/2006/flex/mx/internal:childAdded [E:\dev\4.y\frameworks\projects\framework\src\mx\core\UIComponent.as:7495]

    at mx.core::UIComponent/addChildAt() [E:\dev\4.y\frameworks\projects\framework\src\mx\core\UIComponent.as:7199]

    at::Group/addDisplayObjectToDisplayList() [E:\dev\4.y\frameworks\projects\spark\src\spark\components\Group.as:2037] spark.components

    to spark.components::Group /() http://www.adobe.com/2006/flex/mx/internal:elementAdded [E:\dev\4.y\frameworks\projects\spark\src\spark\components\Group.as:1624]

    at::Group/setMXMLContent() [E:\dev\4.y\frameworks\projects\spark\src\spark\components\Group.as:633] spark.components

    at::Group/createChildren() [E:\dev\4.y\frameworks\projects\spark\src\spark\components\Group.as:855] spark.components

    at mx.core::UIComponent/initialize() [E:\dev\4.y\frameworks\projects\framework\src\mx\core\UIComponent.as:7634]

    to mx.core::UIComponent /() http://www.adobe.com/2006/flex/mx/internal:childAdded [E:\dev\4.y\frameworks\projects\framework\src\mx\core\UIComponent.as:7495]

    at mx.core::UIComponent/addChildAt() [E:\dev\4.y\frameworks\projects\framework\src\mx\core\UIComponent.as:7199]

    at::Group/addDisplayObjectToDisplayList() [E:\dev\4.y\frameworks\projects\spark\src\spark\components\Group.as:2037] spark.components

    to spark.components::Group /() http://www.adobe.com/2006/flex/mx/internal:elementAdded [E:\dev\4.y\frameworks\projects\spark\src\spark\components\Group.as:1628]

    at::Group/setMXMLContent() [E:\dev\4.y\frameworks\projects\spark\src\spark\components\Group.as:633] spark.components

    to spark.components::Group / set mxmlContent() [E:\dev\4.y\frameworks\projects\spark\src\spark\components\Group.as:573]

    to spark.components:kinnableContainer/set mxmlContent() [E:\dev\4.y\frameworks\projects\spark\src\spark\components\SkinnableContainer.as:657]

    to spark.components:kinnableContainer / createDeferredContent () [E:\dev\4.y\frameworks\projects\spark\src\spark\components\SkinnableContainer.as:1050]

    to spark.components:kinnableContainer / createContentIfNeeded () [E:\dev\4.y\frameworks\projects\spark\src\spark\components\SkinnableContainer.as:1078]

    to spark.components:kinnableContainer / createChildren() () [E:\dev\4.y\frameworks\projects\spark\src\spark\components\SkinnableContainer.as:885]

    at mx.core::UIComponent/initialize() [E:\dev\4.y\frameworks\projects\framework\src\mx\core\UIComponent.as:7634]

    at::View/initialize() [E:\dev\4.y\frameworks\projects\mobilecomponents\src\spark\components\View.as:999] spark.components

    views: InstrumentTunerHome / initialize)

    to mx.core::UIComponent /() http://www.adobe.com/2006/flex/mx/internal:childAdded [E:\dev\4.y\frameworks\projects\framework\src\mx\core\UIComponent.as:7495]

    at mx.core::UIComponent/addChildAt() [E:\dev\4.y\frameworks\projects\framework\src\mx\core\UIComponent.as:7199]

    at::Group/addDisplayObjectToDisplayList() [E:\dev\4.y\frameworks\projects\spark\src\spark\components\Group.as:2037] spark.components

    to spark.components::Group /() http://www.adobe.com/2006/flex/mx/internal:elementAdded [E:\dev\4.y\frameworks\projects\spark\src\spark\components\Group.as:1628]

    at::Group/addElementAt() [E:\dev\4.y\frameworks\projects\spark\src\spark\components\Group.as:1387] spark.components

    at::Group/addElement() [E:\dev\4.y\frameworks\projects\spark\src\spark\components\Group.as:1345] spark.components

    to spark.components:kinnableContainer / addElement () [E:\dev\4.y\frameworks\projects\spark\src\spark\components\SkinnableContainer.as:761]

    at::ViewNavigator/createViewInstance() [E:\dev\4.y\frameworks\projects\mobilecomponents\src\spark\components\ViewNavigator.as:2018] spark.components

    at::ViewNavigator/commitNavigatorAction() [E:\dev\4.y\frameworks\projects\mobilecomponents\src\spark\components\ViewNavigator.as:1932] spark.components

    at::ViewNavigator/commitProperties() [E:\dev\4.y\frameworks\projects\mobilecomponents\src\spark\components\ViewNavigator.as:1301] spark.components

    Best regards

    Ben

    In Flex 4.6 Adobe had changed the TextInput control to use StageText instead of TextField. The native implementation of StageText PlayBook is basically a version not stripped of the qnx.fuse.ui.TextInput. There are some use cases that throws an error our implementation of StageText.

    The solution for now is to put a skin.

    http://supportforums.BlackBerry.com/T5/Tablet-OS-SDK-for-Adobe-Air/Tablet-SDK-2-0-for-FB-4-6-TextInp...

    We are working on a fix for version 2.0 of the final tablet. It is also worth noting that this error comes from a code that is on the device and not in the SDK.

  • How to manage the event of "alt + trackpaddown" button event method char

    Hello

    I want to do a few ob task by clicking on 'alt + down trackpad'.is it possible?

    If yes how can I handle this task. ?

    Thank you

    Naveen

    "" Hello Sir thanks to enable playback... in fact, I have two listfield in my screen .i want to alternate between two listfield using "alt + trackup and trackdown. My it does not work... I am using this code...

    package com.black.applicationloader;
    
    import java.util.Vector;
    
    import net.rim.device.api.system.Display;
    import net.rim.device.api.system.KeypadListener;
    import net.rim.device.api.ui.Color;
    import net.rim.device.api.ui.Font;
    import net.rim.device.api.ui.Graphics;
    import net.rim.device.api.ui.Keypad;
    import net.rim.device.api.ui.Manager;
    import net.rim.device.api.ui.UiApplication;
    import net.rim.device.api.ui.XYRect;
    import net.rim.device.api.ui.component.Dialog;
    import net.rim.device.api.ui.component.ListField;
    import net.rim.device.api.ui.component.ListFieldCallback;
    import net.rim.device.api.ui.container.VerticalFieldManager;
    
    import com.black.blackinterface.BlackInterface;
    import com.black.common.BaseScreen;
    import com.black.components.CustomEditField;
    import com.black.utility.Utilities;
    
    public class BlackSecondScreen extends BaseScreen implements BlackInterface,ListFieldCallback {
         private VerticalFieldManager listFieldManager;
         private VerticalFieldManager listFieldManager_2;
         private static final String[] _elements = {"First element", "Second element", "Third element", "Fourth element", "Fifth element"};
         private Vector _listElements = new Vector(_elements.length, 1);
         int columnWidth  = Display.getWidth()/4;
         private boolean hasFocus; // =false
        private CustomEditField userEditField;
        ListField colourList_1;
        ListField colourList_2;
    
        BlackSecondScreen(){
    
            colourList_1 = new ListField(){
    
                protected boolean keyChar(char key, int status, int time) {
                    if(colourList_1 == getLeafFieldWithFocus()){
                    if(key=='t'||key=='T'){
    
                        colourList_2.setFocus();
    
                    }
                    return true;
                    }
                    else{
                        return super.keyChar(key,status,time);
    
                    }
                };
    
                protected void drawFocus(Graphics graphics, boolean on) {
    
                    hasFocus = on;
                    super.drawFocus(graphics, on);
                    hasFocus = false;
    //              XYRect rect = new XYRect();
    //               graphics.setGlobalAlpha(200);
    //              getFocusRect(rect);
    //              drawHighlightRegion(graphics,HIGHLIGHT_FOCUS,true,rect.x,rect.y,rect.width,rect.height);
                }
    
                protected boolean navigationMovement(int dx, int dy, int status, int time) {
    
                    if(dy > 0 && (status & KeypadListener.STATUS_FOUR_WAY) == KeypadListener.STATUS_FOUR_WAY && (status & KeypadListener.STATUS_ALT) == KeypadListener.STATUS_ALT)
                    {
                        // do stuff
                        colourList_2.setFocus();
                        return true; // if you want the field to consume this event
                    }
                    return super.navigationMovement(dx, dy, status, time);
    
                };
    
            };
    
            colourList_1.setCallback(this);
              int elementLength = _elements.length;
             for(int count = 0; count < elementLength; ++count)
                {
                 colourList_1.insert(count);
                    this.insert(_elements[count], count);
                }
    
             colourList_2 = new ListField(){
    
                    protected void drawFocus(Graphics graphics, boolean on) {
                        hasFocus = on;
                        super.drawFocus(graphics, on);
                        hasFocus = false;
    
                    }
    
                    protected boolean keyChar(char key, int status, int time) {
                        if(colourList_2 == getLeafFieldWithFocus()){
                        //if(key=='t'||key=='T'){
                            if(key=='t'){
                            colourList_1.setFocus();
                            colourList_1.setSelectedIndex(0);
    
                        }
                        return true;
                        }
                        else{
                            return super.keyChar(key,status,time);
    
                        }
                    }
    
                };
    
                colourList_2.setCallback(this);
    
                 for(int count = 0; count < elementLength; ++count)
                    {
                     colourList_2.insert(count);
                        this.insert(_elements[count], count);
                    }
    
             //add(colourList);
             createComponents();
             layoutComponents();
    
        }
    
        public void createComponents() {
    
            listFieldManager= new VerticalFieldManager(Manager.VERTICAL_SCROLL|Manager.HORIZONTAL_SCROLL){
                protected void sublayout(int maxWidth, int maxHeight) {
                     super.sublayout( maxWidth, 2*colourList_1.getRowHeight());
                        setExtent(maxWidth,2*colourList_1.getRowHeight()); 
    
                };
    
            };
    
            listFieldManager_2= new VerticalFieldManager(Manager.VERTICAL_SCROLL|Manager.HORIZONTAL_SCROLL){
                protected void sublayout(int maxWidth, int maxHeight) {
                     super.sublayout( maxWidth, 2*colourList_2.getRowHeight());
                        setExtent(maxWidth,2*colourList_2.getRowHeight()); 
    
                };
    
            };
    
    //      userEditField=new CustomEditField(Utilities.getAdjustedWidth(150),
    //              Utilities.getAdjustWidth(2), Manager.NO_HORIZONTAL_SCROLL
    //              | Manager.VERTICAL_SCROLL, true);
    
        }
    
        public void layoutComponents() {
            // TODO Auto-generated method stub
            listFieldManager.add(colourList_1);
    
            listFieldManager_2.add(colourList_2);
    
            listFieldManager.setMargin(0,0,40,0);
            add(listFieldManager);
            add(listFieldManager_2);
    
        }
    
        public void initializeListeners() {
            // TODO Auto-generated method stub
    
        }
    
        public void setComponentsXYMargins() {
            // TODO Auto-generated method stub
    
        }
    
        public void drawListRow(ListField listField, Graphics graphics, int index,
                int y, int width) {
            int curSelected;
                if(!hasFocus){
                if(index%2  == 0){
    
                graphics.setColor(Color.RED);
                graphics.fillRect(0, y, width, listField.getRowHeight());
                graphics.setColor(Color.WHITE); 
    
                }else{
                graphics.setColor(Color.BLACK);
                graphics.fillRect(0, y, width, listField.getRowHeight());
                }
                }
                //graphics.fillRect(0,0,width,y);
    
                int xpos = 0;int ypos = 0;
                graphics.setFont(Font.getDefault());// please set a font value
                // this is first column text
                graphics.setColor(Color.PINK);
                graphics.drawText("column1"+index,xpos,y);
                xpos +=  columnWidth;
    
                //graphics.setColor(Color.RED);
                graphics.drawText("column2",xpos,y);
    
                xpos +=  columnWidth;
                graphics.drawText("column3",xpos,y);
    
                xpos +=  columnWidth;
    
                graphics.drawText("column4",xpos,y);
    
        }
    
        public Object get(ListField listField, int index) {
            // TODO Auto-generated method stub
             return _listElements.elementAt(index);
        }
    
        public int getPreferredWidth(ListField listField) {
            // TODO Auto-generated method stub
            return Graphics.getScreenWidth();
        }
    
        public int indexOfList(ListField listField, String prefix, int start) {
            // TODO Auto-generated method stub
            return _listElements.indexOf(prefix, start);
        }
    
        public void insert(String toInsert, int index)
        {
            _listElements.insertElementAt(toInsert, index);
        }
    
         public void erase()
            {
                _listElements.removeAllElements();
            }
    
    }
    
  • Exception - called setFocus on a field that is not attached to a screen.

    I'll have a lot of areas in my screen. I'm trying to set the focus on the particular area. To do this, I use field.setFocus (). But it gives this exception

    setFocus call on a field that is not attached to a screen. But the field is added to the screen. I don't know what the problem is with me.

    How can I do this?

    Thanks for any help.

    Oh. I'm sorry. I resolve myself. I called this method until I added this field to display.

  • 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!

  • How can disable the scrolling animation when setFocus

    I'm working now on a screen of IM conversation. When the user send a message, the list of instant messaging on the screen will be updated the I setFocus on the message input field: this occors a problem after OS 6.0 because the list will always be scrolling up and down...

    If I need to replace any method as moveFocus to achieve?

    Try setScrollingInertial (false) on your Manager. If you are using screen, you can try yourScreen.setScrollingInertial (false), but if this does not help, oneOfYourFields.getManager () .setScrollingInertial (false) should (use after having added your fields on the screen).

  • How to select all the text with QNX TextInput

    With QNX TextInput, is there a way to select all the text? Spark TextInput a selectAll() method to select all text, but I do not see a similar method in QNX TextInput. No idea how you can choose all the texts with QNX TextInput. Thank you.

    Hey French,.

    Thanks for the clarification! I think I can help you. Here is a code example to show my explanation. In the code below when a user clicks the LabelButton object it will assign the focus to your TextInput object and then select all the text in this object. The only downside is that it will not bring the keyboard. so far, we are not successfully by invoking the keyboard without the user clicking on the TextInput. in any case in the code below, we use TextInput property the textField object as a reference to the TextField object internal. from there, we use the setSelection() method to select the text inside the object from the start to the end position pos. Here's the same code:

    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);
            }
        }
    }
    

    hope it's what you want. Good luck!

Maybe you are looking for