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?

Tags: Flex

Similar Questions

  • How to set the index of control on a text box

    Hello

    I know that SetCtrlIndex does not work on a Textbox control.

    However, I have to use a Textbox control to display a variable number of messages, each representing a different warning, because of the horizontal scroll bar which is not available on a ListBox (and some messages may be very long).

    I want to the attention of the user on the last of these messages, so at the end of the text box, but I'm not able to do this.

    Can someone help me?

    Thank you

    Sergio

    Hi Wolfgang,.

    your suggestion was very helpful because with further investigation on the SetCtrlAttribute for the text box, I discovered an attribute that seems to work

    SetCtrlAttribute (Panel, control, ATTR_FIRST_VISIBLE_LINE, lastTexboxRow);

    Thank you

    Sergio

  • Newbe help:-application of setting shape to a dynamic text box

    Hi I have a dynamic text box (box_pname), which is filled with the name of the specific page the user is currently, but I can't seem to apply any formting to the text (see code below).

    Can anyone help?

    Code

    Create a TextFormat object.
    var txt_fmt:TextFormat = new TextFormat();

    Specify the paragraph and character formatting.
    txt_fmt. Bold = true; apply "BOLD"
    txt_fmt. Italic = true; apply the italic
    txt_fmt. Size = 14; apply size 14

    This.box_pname = "enter the user details '; set the name of the Page
    This.box_pname.setTextFormat (txt_fmt); apply formatting to the text box

    Stop();

    Found, I had also entered the same name in the var area, once I deleted this text has changed. Thanks for the help.

  • How can I compare data from a set of values in a text box?

    I want to paste a series of numbers in a text box and use it to query the active column of numbers in a report to return only the assets including the active number is in the text box to know how to do this?

    If your text box contains the values concatenated to a string (: or; or, or another) you can use it in a query by replacing ":" with your string concatenation, similar to this example:

    SELECT empno, ename, job, mgr, sal
      FROM emp
     WHERE INSTR (':' || :p138_empno_textbox || ':', ':' || empno || ':') > 0
    

    Denes Kubicek
    -------------------------------------------------------------------
    http://deneskubicek.blogspot.com/
    http://www.Opal-consulting.de/training
    http://Apex.Oracle.com/pls/OTN/f?p=31517:1
    -------------------------------------------------------------------

  • Set the value of cluster control in secondary school

    Hello

    Is there a way to set the value of control from one cluster to a high school?

    I enclose my screw in LV8.0

    Charly

    If you have a reference to the VI being put into secondary (which there or it is not in the secondary, right?) you can use it to get a reference to the façade of the VI. This in turn will allow you to read an array of references to all the controls and indicators on the front of the Secondary VI. Cross this table by looking at the text property of the label: for each reference in the table until you find the one for the control of the cluster.

    Now, use the specific function to more class to convert reference generic control of the pole to a cluster reference. You can use it to get an array of all the controls within the cluster. Now, go through this table by looking at the text property of the label: for each reference in the table until you find the one for control quevous want to set and you are there...

    Mike...

  • Setting the properties of elements of façade in XControl to a VI that uses the XControl

    Hi all

    I'm new to XControls and I try to use them to make a generic digital indicator that fit into a matrix of waveforms of a similar measure and allow the user to display the first value of a waveform, it chooses by selecting the name of the desired channel in the waveform table. I have the XControl work, with a ring filled automatically with the NI_ChannelName of the input waveform array fields and the value of the ring being used to index the waveform table to select the appropriate data.

    What I want to do next is automatically set the value of control of ring in the XControl to the value that the user has selected the last time he ran the VI that uses the indicator. However, the properties of the control ring do not seem to be accessible from the VI that uses the XControl, and none of the XControl General properties seem to be accessible from the front VI in the XControl. The value of the ring is not part of the entrance of DataIn cable waveform table, so I don't have a good method to pass data to the control of the ring outside of what is in this table of waveform. I might add the value in the waveform table, if this helps, but indicators XControl do not transmit their return DataOut appellant VI to allow me to record the user selected value.

    Is there a good way to read and write the properties of façade elements in an XControl of VI that uses the XControl?

    I apologize for not posting my code; the computer with LabVIEW license is having network problems at the present time. I'll post the code when I can.

    Thank you!

    Erik

    In your State cluster typedef container, include a reference to a control of the ring.

    In your vi of façade, in the case of change of Direction, create a reference to your ring and connect to a plan by which he sends out the view state.  Also be sure to write true to the status changed in the result of the Action.

    In your xctl, select New-> property.  Name it after the property in the ring that you want to access.  Use the view clustered State (in your new property VI) to access the reference to the ring; son of a property node.  Change the control value in the appropriate type & connect to the property you want.

    Be sure to connect the path error through everything that might cause an error.

    When you drop an instance of the xctl and create a property from this node, your new property will be available.

  • Text box border

    I often use a text box on a chart, IE. "Page 6/6".  It is no problem for me. But I can't understand just how to add a border or a framework to this text box, preferably being able to control the thickness of the border. I'm not trying to do something fancy at all, just an image on a small text box, you can help me please?

    Probably the simplest is to use the rectangle tool and create a form of the same size that the text box, move just below the text and in the layer styles, set the fill to 0, so it does not have a fill and allow the race. Then optionally group the two layers so you can move them as one.

  • How can I disable the user access control, for an update of a Web site?

    This is the site of poker for the best day of Milwaukee.

    Hello

    Access search by: click on Windows Orb/Start key > click on the text box and type "User Account Control" to get the shortcut to user accounts. You can disable UAC.

    However, the word of advice, be warned that disable UAC will allow any application and good or bad that gain access to the computer can cause damage to him.

    Don't forget that the site you access is safe and secure and if did the update, try to return to turn on UAC

  • Entry text box loses focus after setting the innerHTML

    I'm trying to change my widget so that it supports the search when you type.

    But when my javascript event fires to submit ajax request entry box retains loses focus.  I tried to reset the focus after writing the html code with blackberry.focus.setFocus (), but this function sets the cursor at the beginning of the entry rather than at the end zone, so I can continue typing.

    Is it possible to update the html code in a DIV without losing the focus on my entry box, or there at - it a way to make the blackberry.focus.setFocus () to go to the end of the string currently in the box?

    Here is an example of the code that I am trying to work in my 9700 Simulator:

    ------ JS Code---function doLiveSearch(str) {  if (str.length==0) {    document.getElementById("results").innerHTML="";    return;  }   xmlhttp=new XMLHttpRequest();  xmlhttp.onreadystatechange = function() {   if (xmlhttp.readyState==4 && xmlhttp.status==200) {    document.getElementById("results").innerHTML=xmlhttp.responseText;     blackberry.focus.setFocus("search");    }  }  xmlhttp.open("GET","livesearch.php?q="+str,true);  xmlhttp.send();}
    
    ------- HTML Code-----
    ----here's an example what my lookup code returns.----
    One
    Two

    Try with selectionStart and selectionEnd before focus:

  • How to allow the user to set the focus on each and areas of multiple text on stage?

    I have several text boxes on stage and for the purpose of their scroll by wheel, I would like the user to focus on one of its choice, either by the mouse tab.

    The best I could find is the setAttribute method, coupled with the value of the tabindex property, in which the number 1 represents the first and the highest element in the hierarchy.

    Not sure that this is the right way forward on this issue, and if this is the case, I'm probably something wrong, as usual. I tried:

    this.my_textArea.setAttribute("tabindex","1");
    

    and I get back:

    Eception TypeError: this.my_textArea.setAttribute is not a function

    This detail really should have been mentioned in your first post. So, I'm going to guess that the simple code NOT simulates a true textarea (because the textarea elements permit an entry), but rather is just a hidden textfield, set up to monitor the mousewheel events. You won't be able to give these things focus just a variable assignment, because they have no concept of development. The only way to do this is to add more code to handle.

  • set the initial input focus text of the component of motion af

    JDeveloper 12.1.3

    Is it possible to specify the original purpose, say for 1st render input text of the component query af on the rendering of page? To make things more difficult, suppose af: query is inside the jsff fragment of page top of page jsf (region)

    http://Biemond.blogspot.ca/2011/03/set-initial-focus-on-component-in-page.html

  • I just updated my indesign to CC of CS5. One thing I notice which is annoying is some text boxes and images go live. For example, if you close a text box in CS5 you close the box you see reformat the text to set the new size. In the tex CC

    I just updated my indesign to CC of CS5. One thing I notice which is annoying is some text boxes and images go live. For example, if you close a text box in CS5 you close the box you see reformat the text to set the new size. In CC, the text does not reformat until you are done change the size of the box. It's the same for the images when resizing or rotation re. You don't know what you have until its finished. If you are a little guess instead of see what you're doing while. Is there a way to change this, or does anyone else have this problem. Maybe it's just what does CC. But I'm not a fan... Can anyone help?

    When using the image processing manages, click... for a while... then drag...

  • Set the variable to the text entered in a text box

    Hello. I have 2 text boxes on a form that the user can type in numbers. I just want to add the numbers that they typeRegeditdans together and the response of output. I'm a simple and will get more complicated with my calculations later. I've done the calculations to work if they are entered in a database, but we need to work on the fly based on what the user has typed in the text boxes.

    I am only able to set the text of the box and their output values, but I can't bring it to add up. I have some javascript that displays what has been typed in areas using CFSet. Is it the way I should write this? Is it possible to condense the javascript, or I have to separate each set of code text box on? Is there another way to do this simple calculation with just Cold Fusion, or do I have the javascript to enter numbers that are entered in the text boxes? Here is the code I have below. If you delete the CFset price and output price, you will see that this code generates areas of text X and Y. thank you for your help.

    < name cfparam = "url. X"default =" ">

    < name cfparam = "url. "By default Y" = "" >

    < cfoutput >

    < script type = "text/javascript" >

    var pageSoumettre = ' #jsStringFormat (url. X)#';

    function appenX() {}

    document.getElementById('submitLink').href = '? X=' +

    encodeURIComponent)

    (pageSubmit.length? pageSubmit + ',' :'') +)

    document.getElementById('X').value);

    }

    var pageSoumettre = ' #jsStringFormat (url. Y)#';

    function appenY() {}

    document.getElementById('submitLink').href = '? Y=' +

    encodeURIComponent)

    (pageSubmit.length? pageSubmit + ',' :'') +)

    document.getElementById('Y').value);

    }

    < /script >

    < name cfform = "theForm" action = "" # "method ="get">"

    < cfinput type = "text" name = "X" id = "X" value = "" > < br / >

    < cfinput type = "text" name = 'Y' id = 'Y' value = "" >

    < input type = "submit" id = "submitLink" onclick = "appenX (); "onclick ="appenY (); "value ="Update">

    < / cfform >

    < cfset X = #url. X # >

    < cfset #url =. Y # >

    < cfset price = X + Y >

    #X # < br / >

    #Y #.

    #Price #.

    < / cfoutput >

    Andy

    Mixture of Javascript with Coldfusion is unnecessarily complex. If all you need is to add the value of two form fields, then just Google javascript add form fields and you will get a lot of suggestions.

    For example, http://stackoverflow.com/questions/5074073/how-can-i-add-form-values-using-javascript

    X:

    Y:

    Total:

  • How to set the default color in the text box

    Every so often, the default color in new text boxes is set to a color at random... then when I click and drag a new text box, the color automatically changes to white, for example and all typed text in turns white. How can I go back to the good old black (or any other color besides) for new areas of text in the future?

    Thank you!

    Jason

    Turns out I had a character style plays tricks on me.

    Problem solved.

    Thank you

  • How can I set the first row is 0, depending on the text box

    How can I set the first row is 0, according to the text box selected_text_to_inlineobj.jsx


    https://gist.github.com/milligramme/9368861@

    Try this,

    function boooxed (object_style_name) {
      if (app.selection.length !== 1) return
      var doc = app.documents[0];
      var sel = doc.selection[0];
      if ('baseline' in sel) {
        var bx = sel.insertionPoints[0].textFrames.add();
        bx.appliedObjectStyle = doc.objectStyles.item(object_style_name);
        bx.geometricBounds = [0,0,5,30];
        sel.duplicate(LocationOptions.AT_END, bx.parentStory);
        bx.insertionPoints[0].firstLineIndent=0;
        bx.fit(FitOptions.FRAME_TO_CONTENT);
        if (sel.contents.length) sel.remove();
      }
    };
    
    var object_style_name = "AAA"; //set anchored object settings, textframe preferences, and more
    boooxed(object_style_name);
    

    Vandy

Maybe you are looking for

  • Portege M400: How to disable biometric fingerprints

    Hi guys, at our office, we are setting up a Toshiba M400 that will later prove the image using ghost and deploy approximately 75 remote users. I want to disable biometric fingerprinting equipment so that users cannot use it. I removed the Protector S

  • Close file causes Labview to freeze

    Hello I have a Labview program that contains a while loop in which a file is created whenever the loop runs. The file is created at the beginning of the loop and closed at the end of the loop, after that some data is written on this subject. The crea

  • Large fonts and icons on all pages

    I don't know what happened but all my icons are great now and all of my web pages are too big for my screen. Please tell me how to solve this problem.

  • CANNOT ACTIVATE WINDOWS PRODUCT KEY 7

    I BOUGHT WINDOWS 7 HOME BASIC (OEM SYSTEM BUILDER PACK) ON JANUARY 17, 2013, INSTALLED ON A NEW PC ON 11 MARCH 2013. I INSTALLED IT BY MISTAKE TWICE ON THE SAME DAY AS THE 1ST TIME THERE WAS A MISTAKE IN THE FORMAT AND FROM THE BEGINNING I TRIED SO M

  • Turtle beaches do not work with the Windows 8 Office

    I just finished setting up my new office, which is an IBuyPower Gamer Extreme NE721i desktop PC (http://www.newegg.com/Product/Product.aspx?Item=N82E16883227443). Until now it works well, HOWEVER, the headset only captures all the sounds and I can ba