How to accept only 4 or less hex characters in string control

Hi,
I want to accept only up to 4 hex characters in a string control. I dont want to use "hex display" property.
How is it possible? I have String control key down? event in event case, I tried it with regular expressions [0-9a-fA-F]{4} but then I have to accept left, right, delete, backspace, home keys as well.
Solved!
Go to Solution.

I agree with Dennis that you seem to be making life difficult for yourself.  However, you did ask the equivalent (as I understand it) "How can I allow the user to type "1", "2", "Ctrl-A", "B", "Ctrl-C", "D" and get this recognized as the string "12BD".  If you really want to do this, here is one way (I was lazy and left the answer as an array of 4 1-character strings).  I use PlatMods to exclude having any "modification" key other than Shift down, convert the numeric Char into a string, then count acceptable Hex letters and conditionally add them to the output array, stopping when I have 4 characters. 
Bob Schor

Similar Messages

  • How to replace only the first specified character in a string and leave other occurrence of the character alone.

    Hello my Friends:
    I have a string that looks like this in a column:
    Hello, World, Hello, Planet
    I want to replace only the first occurrence so that the result looks like this:
    Hello World, Hello, Planet
    Working on some bad data source.
    I need to replace the character regardless of it's location as long as it is the first.
    I tried something like this, but I soon discovered that if the comma or character is missing the the string may get truncated or altered. If there are no characters in the string, then I want to simply leave it alone.
    Here is where I am at:
    DECLARE @MyValue NVARCHAR(MAX) = 'Hello, World, Hello, Planet';
    SELECT MyString = STUFF('Hello, World', CHARINDEX(',', @MyValue, 0), 1, ' ');
    Thanks my friends.

    I have a string that looks like this in a column:
    Hello, World, Hello, Planet
    Why doesn't it say Hello Kitty?
    Oh, sorry about that. Anyway:
    SELECT MyString = CASE WHEN CHARINDEX(',', @MyValue, 0) >= 1
                           THEN STUFF(MyString, CHARINDEX(',', @MyValue, 0), 1, ' ')
                           ELSE MyString
                     END;
    Erland Sommarskog, SQL Server MVP, [email protected]
    Erland, love you sense of humor!! :)
    Thanks for the solution.

  • How can I keep a listbox on top of a string control?

    I would like to keep the listbox "on top" or "in front" of the string control.  Whenever I click in the string control, though, the listbox moves behind it.  I have set the order from the menu, but that seems to get overridden.
    Attachments:
    String-Listbox.vi ‏13 KB

    LOL
    That was just to pull the wool over somebody's eyes...
    Check the control editor of the string you will know the truth
    (Anyway thanks for the stars )
    Message Edited by Vsh on 04-08-2008 07:54 AM

  • How much is the maximum number of byte that a string control can hold?

    And also if the the number of byte sent to a string control is beyond that limit, will the string control discard that data?

    From App Note 154:
    "LabVIEW stores strings as a pointer to a structure containing a 4-byte length value followed by a 1D arrays of byte integers (8-bit characters)."
    The 4-byte value is the same size as a U32, which has a range of 0 to 4,294,967,295. So, your string can have up to 4,294,967,295 characters. If you have the memory
    What does a control do if you exceed that? I don't know. I don't have enough RAM to try it and see.

  • Textbox accept only numbers

    hi all,
    i want textbox accepts only numbers not( @#$%^&*() ) this special characters code for c#.net

    Check this post:
    http://forums.silverlight.net/forums/p/122127/275363.aspx#275363
    HTH

  • How can labview update the string control (text-edit box) after we have pressed the carriage return key on the keyboard during text-editing within that box?

    Dear readers,
    I have been trying to work out how to get labview to detect the event when a 'string' control has been modified, where the user has finished editing the string either by 1) pressing the enter key on the keyboard, or by 2) taking the focus away from the string control again. For example.. if I use the mouse to click on the string control and then I type 1234 into the box, I would like to have a routine that does something once the user hits the Enter key of the keyboard, or when the user takes the focus away from the string control again by clicking on something else. I would like the routine to respond even when the user didn't change anything in the text box (such as when we mouse-click on the edit box to go into edit mode, and then mouse-click on something else to remove the focus with no changes to the contents in edit-box).
    The purpose of my routine is to have a edit-box for a user to change for example the centre-frequency of a vector network analyser, so that the centre-frequency of the network analyser can change once the user finishes entering a new value in the text-edit box by hitting Enter key after the number is keyed in. Even if the user has clicked on the edit box, but changes their mind by mouse-clicking on something else to remove focus from the edit box, I would still like labview to detect the event when the control loses focus, so that the centre frequency can be updated anyway (to the same value that was already in the edit box).
    So far, I've tried set the string control option to 'limit to single line', so that I can try to scan for a carriage return .. '\n' ... pattern in the string. Unfortunately this doesn't work because labview doesn't seem to attach the '\n' to the end of that single line.
    Could someone please suggest ways to set a flag when a user hits Enter during text-edit mode of a string control, or when focus has been removed from the string control?
    While I've only described my problem for controlling a single control parameter on the gpib device, I'd like to make this feature work so that I can do the same kind of thing with other control parameters as well.
    Thanks so much in advance.
    Kenny

    Hi Kenny,
    instead of using the event structure, you can directly achieve to what you want by the KeyFocus property of the string control.
    - Enable Limit to single line option
    - Create the property KeyFocus in read mode and connect an indicator
    Each time you click on the string to modify it KeyFocus is True; when you click away or hit Enter KeyFocus is False.
    You can toggle your settings when KeyFocus changes from True to False.
    Alberto

  • How to Make JTextField Accept Only Specific Numbers?

    Hello There
    I've made 3 JTexfields That accepts only Numbers
    But I Want To Make Them Accpets Numbers only from 1 to 12
    and if the number is greater than 12 they don't accept it?
    another Thing That I've Set Their Columns To 2 meaning that i want the user to enter only two numbers
    but yet the user can enter many numbers how would i restrict entering numbers to only two numbers?
    here's my code:
      import java.awt.*;
      import javax.swing.*;
      import javax.swing.text.*;
      public class ManyText extends JFrame{
           public static void main(String[]args){
           JTextField[ ] text = new JTextField[3];
           JButton button=new JButton("Press");
        for(int i = 0; i < text.length; i++)
         text[i] = new JTextField(3);
         for(int i = 0; i < text.length; i++){
         text.setColumns(2);     
    text[i].setDocument(new PlainDocument(){
    public void insertString(int offs, String str,
    AttributeSet a) throws BadLocationException{
    if("0123456789".indexOf(str) < 0)
    java.awt.Toolkit.getDefaultToolkit().beep();
    return;
    super.insertString(offs, str, a);
         JFrame f=new JFrame();
         f.setSize(200,200);
         f.setLayout(new FlowLayout());
         f.add(text[0]);
    f.add(text[1]);
    f.add(text[2]);     
         f.setVisible(true);     

    ejp wrote:
    Actually I would suggest you're using the wrong control. I would use a JComboBox or a JSpinner for this.I suggested he use a JSpinner 1-2 threads ago. Maybe if he hears it enough, he'll believe it.

  • How to create rewrite rule to accept only mail pass from antivirus server

    I want to set JES messaging 6.0 to accept only mail that scaned from antivirus server. If clients send direct to messaging server it will forward that mail to antivirus server. After mail was scaned it is sent to messaging server and messaging server accept it.
    How to create rewrite rule for this case?

    Please read this technical note, for setting up such a configuration:
    http://ims.balius.com/downloads/AlternateConversion.pdf
    Please note, this site contains some other very useful information for Messaging Server, but IE browsers are NOT supported. You must use some other browser.

  • How to set a string input to accept only 1 and 0 (binary data)

    Hi
    I want to write a program that is supposed to take only binary data from the user. So I put a string control onto the front panel, wanting the user to be able to only type 1 or 0 in it. Is there a way to do that?
    Thanks

    Jean-Pierre Drolet wrote:
    Another slight flaw is that the string accepts Enter for a new line. It is easily fixed by setting it to "Limit to single line".
    True, it allows any non-ASCII through. Another solution would be to use some logical combination of VKey and Char, but it could get complicated. One of the simpler ways is the use of scancode and shift, as in the attached modification. Now ENTER, etc. is also discarded.
    I also agree that none of this seems appropriate to enter 4000 "0/1" characters on a fromt panel.
    LabVIEW Champion . Do more with less code and in less time .
    Attachments:
    BinaryStringControl_III.vi ‏24 KB

  • How long does it take for the IOS 7.1 to finish updating? My phone has been plugged in to my computer for more than one hour and the status bar only shows about less than 1/4 completed. I have an iphone 5s btw.

    My phone has been plugged in to my computer for more than one hour and the status bar only shows about less than 1/4 completed. I have an iphone 5s btw.

    Depends on how strong your wifi connection is.
    you can try a reset hold down the home/sleep button together until you see the apple logo and then release.

  • How to report only quantities less than zero on a calculated field

    I do not understand why my text will not work when it comes to reporting only 'Missing POs' less than zero, I assume it is because I am using 'int' on some fields?
    Any advice?
    SELECT
    t0.father as 'Parent Code',
    t2.itemname as 'Parent Description',
    t2.frgnname as 'Parent Status',
    t0.code as 'Child Code',
    t1.itemname as 'Child Description',
    t1.frgnname as 'Child Status',
    t0.comment as 'Master',
    cast(t3.onhand as int) as 'Child Uncommitted Stock',
    cast(t3.iscommited as int) as 'Child Committed Stock',
    (cast(t3.onhand as int) - cast(t3.iscommited as int)) as 'Child Free Stock',
    cast(t3.onorder as int) as 'Purchase Orders',
    (cast(t3.onhand as int) - cast(t3.iscommited as int)) + cast(t3.onorder as int) as 'Missing POs'
    FROM
    itt1 t0
    inner join oitm t1 on t0.code = t1.itemcode
    inner join oitm t2 on t0.father = t2.itemcode
    LEFT JOIN OITW T3 ON T3.WHSCODE = T0.Warehouse AND T3.ItemCode = T0.Code
    Where T3.WHSCODE Like '[%0]%' and 'Missing POs' < 0
    ORDER BY
    'Missing POs' asc, t0.father, t0.code
    Many thanks,
    Robin (I will be awarding points on all my outstanding questions shorlty - management time pressure at mo!)

    Try this:
    SELECT
    t0.father as 'Parent Code',
    t2.itemname as 'Parent Description',
    t2.frgnname as 'Parent Status',
    t0.code as 'Child Code',
    t1.itemname as 'Child Description',
    t1.frgnname as 'Child Status',
    t0.comment as 'Master',
    cast(t3.onhand as int) as 'Child Uncommitted Stock',
    cast(t3.iscommited as int) as 'Child Committed Stock',
    (cast(t3.onhand as int) - cast(t3.iscommited as int)) as 'Child Free Stock',
    cast(t3.onorder as int) as 'Purchase Orders',
    (cast(t3.onhand as int) - cast(t3.iscommited as int))
      + cast(t3.onorder as int) as 'Missing POs'
    FROM
    itt1 t0
    inner join oitm t1 on t0.code = t1.itemcode
    inner join oitm t2 on t0.father = t2.itemcode
    LEFT JOIN OITW T3 ON T3.WHSCODE = T0.Warehouse AND T3.ItemCode = T0.Code
    Where T3.WHSCODE Like '%0%' and (cast(t3.onhand as int) - cast(t3.iscommited as int))
      + cast(t3.onorder as int) < 0
    ORDER BY
    (cast(t3.onhand as int) - cast(t3.iscommited as int))
      + cast(t3.onorder as int),t0.father, t0.code

  • How can i validate a Field so that it can accept only Numbers

    can any one help me to validate a filed so that it accepts only numbers if not alert user (client side JavaScript alert message)
    Iam using JSF and ADF BC as the Technologies in my application ..
    my requirement is to validate a filed so that i can accept only numbers in my jspx page..
    I had used ADF regularExpression Validator do so... but it results in exception
    java.lang.IllegalArgumentException: 'value' is not of type java.lang.String.
         at oracle.adf.view.faces.validator.ValidatorUtils.assertIsString(ValidatorUtils.java:36)
         at oracle.adf.view.faces.validator.RegExpValidator.validate(RegExpValidator.java:103)
         at oracle.adf.view.faces.component.UIXEditableValue.validateValue(UIXEditableValue.java:378)
    <af:validateRegExp pattern="[0-9]*"
    noMatchMessageDetail="Please enter Numbers only"/>
    Using validateRegExp i can only validate a field that accept String type data ..

    Hello experts,
    Am seeing the same problem while trying to validate an inputtext field that can only accept numbers. This input filed is part of a table ..Data expected here is an integer
    since that is what is gotten from my ejb/sent for update to the db.
    <af:inputText value="#{row.daysToReview}"
    required="#{bindings.AdminResultBeanresultBeanArray.attrDefs.days.mandatory}"
    columns="#{bindingsAdminResultBeanresultBeanArray.attrHints.days.displayWidth}"
    binding="#{backing_Admin.inputText2}"
    id="inputText2"
    label="#{res['admin.daysheader']}"
    autoSubmit="true">
    <af:validateRegExp pattern="[0-9]+"
    noMatchMessageDetail="Please enter a number"/>
    <f:convertNumber groupingUsed="false"
    pattern="#{bindings.AdminResultBeanresultBeanArray.formats.days}"/>
    </af:inputText>
    java.lang.IllegalArgumentException: 'value' is not of type java.lang.String.
    at oracle.adf.view.faces.validator.ValidatorUtils.assertIsString(ValidatorUtils.java:36)
    at oracle.adf.view.faces.validator.RegExpValidator.validate(RegExpValidator.java:103)
    at oracle.adf.view.faces.component.UIXEditableValue.validateValue(UIXEditableValue.java:378)
    <af:validateRegExp pattern="[0-9]*"
    noMatchMessageDetail="Please enter Numbers only"/>
    Using validateRegExp i can only validate a field that accept String type data ..
    Thanks in advance.

  • Group video call: Accept only certain member's vid...

    I'd like to do Group video call with 5 friends but my wi-fi is very weak.
    So I'd like to accept only 1 person's video and reject others (call only).
    Could you tell me how to do it?
    I tried but there is all accept or all reject.

    Hi,
    This Log does not contain a reference to a Ping.
    I would check your device is allowing response to Internet Pings
    It is odd though that you ad your Buddy can chat to other people.
    This may mean that you do not actually get to the Ping stage.
    This seems likely as the attempts that are listed never get past the INVITE stage.
    This would point to a Certain Buddy issue
    http://www.ralphjohns.co.uk/page15.html#CertainBuddy
    Essentially this is a NAT issue.
    NAT (Network Address Translation) is what makes a router get the incoming data stream to your computer.
    Unfortunately the way it is done is different on nearly every device.
    It is more of a global term rather than a set protocol )See item 5 in that Link)
    As the first links shows UPnP can help get around this as it seems to be less reliant on NAT to get through the routing device.
    The rip (remote IP) seems to be trying random ports to get success.
    10:48 PM Thursday; August 21, 2008

  • MIGO/MIRO - possible? posting date accept only workdays

    Is possible to accept only workday dates in MIRO and MIGO for posting date?
    if any one knows please let me know how.
    thanks.

    Angelita,
    If that is the case, then the only way to achieve this would to be use an exit/BADI and do a validation on the posting date in the MIGO/MIRO header and display a warning/error message to the user as required.
    I think BADI MRM_HEADER_CHECK should work for the MIRO header validation. I am not too sure about MIGO - have an ABAPer check out BADI MB_MIGO_BADI.
    Hope this helps.
    H Narayan

  • IW32 - restriction or validation to accept only internal order from a plant

    HI team!!
    I´m needing your help
    Im working with Tcode IW32 when creating a maintenance order and we got through Goto / Settlement rule we can assign any internal order number.
    there is no restriction or validation to accept only internal order numbers from the corresponding plant, this condition may affect other entities
    How can I limit it?
    Thks & regards "

    In configuration, in settlement rule, restrict receiver other than internal order. In case if you want to have internal order as a receiver but restrict only some orders, you can do that using a user exit/badi at save.
    example user exit -IWO10009

Maybe you are looking for

  • Withholding taxes not updated when program run in background

    Hi, in a z1 report i do:   SUBMIT z2   VIA JOB lc_jobname    NUMBER v_jobcount      WITH p_fecha  = p_fecha                                     WITH p_file   = v_file_in      WITH p_e_file = p_efile       WITH p_client = p_client      WITH p_test   =

  • Error in SOAP Adapter because XML is big

    <b>Hi guys! I have a SOAP Adapter (Sender) that works fine when the XML it receives is small. If the XML is big, this error happens:</b><br><br><br> java.lang.NullPointerException; nested exception caused by: java.lang.NullPointerException; nested ex

  • IPhone 6 plus screen crack cost me SGD550?

    My 6 plus less than one month, accidentally the screen was cracked. Apple authorized service provider A.LAB charge us SGD550.00 for replace a new phone Which only charge USD129.00 in USA. The A.LAB staff told me the charges was set by Apple. anything

  • Connecting Apple TV (2) to a Sonos System

    Is it possible to use my Sonos Play:3 speakers with my Apple TV?  I have a pair of speaker connected thru a Sonos Bridge to my home wifi network. The Sonos are great and now (with Sonos Desktop 3.5.2) work very well with my iTunes library, but I'd li

  • ITunes will not connect to the iTunes store once again

    Okay so last year when I updated my iTunes I could not connect to the store. I eventually got it to work. Well I went to update my itunes again to update my iphone and once again after itunes installed it will not connect to the store so I cannot upd