How to create a Choice which can be selected thru keyboard ?

Hi,
I am using java.awt.Choice to display all the states in US, Canada and Mexico in that order. I need to make this list selectable using key board. ie, if i press A, it should first go to AL , then to AK etc. I have added the following code in the class which extends from Choice so that it i type A , it will go to AL. But subsequent key types for the same letter are not recognised.Please provide some pointers on how to do this.
protected void processEvent(AWTEvent evt)
super.processEvent(evt);
if( evt instanceof KeyEvent)
char ch = ((KeyEvent)evt).getKeyChar();
Character c = new Character(ch);
if(!Character.isLetterOrDigit(ch))
return;
for(int i =0; i < getItemCount(); i++)
if( getItem(i).substring(0,1).equalsIgnoreCase(c.toString()))
select(i);
break;
Thanks in advance.

thanks, it worked.
posting the whole code.
     protected void processEvent (AWTEvent evt)
          super.processEvent(evt);
if( evt instanceof KeyEvent && evt.getID() == KeyEvent.KEY_PRESSED)
char ch = ((KeyEvent)evt).getKeyChar();
Character c = new Character(ch);
if(!Character.isLetterOrDigit(ch))
return;
               int ind = 0;
               if(getSelectedItem().toUpperCase().startsWith(c.toString().toUpperCase()))
                    ind = getSelectedIndex()+1;
               boolean matchfound = false;
               for(int i = ind; i < getItemCount(); i++)
               if( getItem(i).toUpperCase().startsWith(c.toString().toUpperCase()))
                         matchfound = true;
select(i);
break;
               if(!matchfound)
                    for(int i = 0; i < getItemCount(); i++)
                         if( getItem(i).toUpperCase().startsWith(c.toString().toUpperCase()))
                              select(i);
                              break;
     }

Similar Messages

  • Am using short keyboard.  Don't know how to create plus sign which is not on the keyboard. Advice would be much appreciated.

    Am using short keyboard.  Don't know how to create plus sign which is not on the keyboard. There is no number pad. Advice would be much appreciated.

    nicholasmitaka-shi wrote:
    This is a Japanese kana input keyboard, A1242, whioch looks quite as usual except that a few functions have no space on the board and have been ommitted. 
    Is the plus sign really not available on your keyboard at the place indicated on this graphic (to the right of the L key)? You might need to use shift or alt/option or shift+alt/option.
    http://en.wikipedia.org/wiki/File:KB_Japanese.svg

  • How to create a structure which can hold a dynamic table as a field in DDIC

    Hi ,
           I am designing a solution for a problem and have a unique requirement.  I need to create a structure which can hold a field where dynamic table data can be stored.  Let me illustrate with an example :
    My structure  ( say  Z_output_struc ) will have the fields
    Table_name  Table_Data
    My function module will have a table type of the above structure, so in effect ,my output can have multiple table names and related to each of them, there will be table data of that table name. The issue is how do I configure this in DDIC ?
    I tried creating table_data as "Type ref to Data"  but was stuck  inside the func module when I tried to transfer data to this.
    Any pointers as to how to think about this differently ? 
    Best Regards,
    Girish

    Hi Girish,
    you start directly from the ref to data. You assign it to a field symbol and cast this to the type of the destination of your select. So you can directly add the reference to the cache:
    I hope this example helps a bit (I took a form instead of a function module as it is easier to add here and used an hr table as kna1 is empty on my test system):
    REPORT  z_rwe_99_dyn_tab_cache.
    * type definition
    TYPES:
      BEGIN OF _s_cache,
        table TYPE        tabname16,
        cache TYPE REF TO data,
      END   OF _s_cache,
      _t_cache TYPE STANDARD TABLE OF _s_cache.
    * data declaration
    DATA:
      lv_table     TYPE tabname16,
      lv_condition TYPE string,
      lt_cache     TYPE _t_cache.
    * define table and condition
    lv_table     = 'HRP1000'.
    lv_condition = 'plvar = ''01'' and otype = ''S'' and objid = ''50000016'''.
    * get the result of a single table into the cache
    PERFORM get_dyn_table USING
                            lv_table
                            lv_condition
                          CHANGING
                            lt_cache.
    * form to read a single table
    FORM get_dyn_table USING
                         iv_table     TYPE tabname16
                         iv_condition TYPE string
                       CHANGING
                         ct_cache     TYPE _t_cache.
      FIELD-SYMBOLS:
        <lt_table> TYPE ANY TABLE.
      DATA:
        ls_cache TYPE        _s_cache,
        lr_data  TYPE REF TO data.
      CREATE DATA lr_data TYPE STANDARD TABLE OF (iv_table).
      ASSIGN lr_data->* TO <lt_table>.
      SELECT * FROM (iv_table) INTO TABLE <lt_table>
        WHERE
          (iv_condition).
      ls_cache-table = lv_table.
      ls_cache-cache = lr_data.
      APPEND ls_cache TO ct_cache.
    ENDFORM.                    "get_dyn_table
    If you have more questions just give another post.
    Best Regards
    Roman

  • How to create a material which can be used in T-Codes VAO1 & MB1C create

    Hello Experts,
    How can I create a material which can be used to create a sales order and can be used to create inventory using VAO1 and MB1C T-Codes respectively.
    What are the configurations that I need to take care of, while creating it?
    I need to create a material which can be used in the whole sales cycle(sales order,goods issue,billing and etc).
    Please Help,
    Thanks in Advance,
    Suma

    Hi
    Thanks for your fast replies.. I have created a new material and was able to create inventory thru MB1C. But I was not able to generate a goods delivery(VL01N) and billing document(VF01)  for the sales order.
    Error: No schedule lines due for delivery up to the selected date
    Message no. VL248
    Diagnosis
    There are no schedule lines due for the given order item up to the date chosen.
    System Response
    The system does not create a delivery item for this order item.
    Procedure
    Check whether the order item to be delivered contains confirmed schedule lines.
    If this is the case, set the selection date further into the future if you still want to create a delivery for this item.
    Please suggest,
    Tanks,
    Suma
    Edited by: Suma B on Sep 23, 2008 3:55 PM

  • How to create dummy pricture which can be used for chart in msword

    I want to create a chart in template,but have problem with creating dummy picture , is there any one could tell me how to create a dummy picture in msword. Thanks

    First create a chart.
    Now right click on chart > format picture > web
    copy the code.
    now you may delete it.
    insert a picture which you want.
    right click > format picture > web
    paste the code.
    done.

  • How to create one procedure which can drop and create materialized view

    Hi,
    I want to create one pl/sql procedure which can first drop materialized view CATEGORY_PK and after that create same materialized view CATEGORY_PK.
    programme is as follows:
    DROP MATERIALIZED VIEW CATEGORY_PK;
    CREATE MATERIALIZED VIEW CATEGORY_PK REFRESH FORCE WITH PRIMARY KEY AS
    SELECT cav1.ownerid AS categoryid, p.uuid AS productid ,p.domainID AS productdomainid,pav.stringvalue AS NAME
         ,pav2.stringvalue AS ID, pav3.stringvalue AS SHORT
    FROM product p, product_av pav, catalogcategory_av cav1, catalogcategory_av cav2,product_av pav2,product_av pav3
    WHERE
    cav1.NAME = 'PRODUCT_BINDING_ATTRIBUTE' AND
    cav2.NAME = 'PRODUCT_BINDING_VALUE' AND
    cav1.ownerid = cav2.ownerid AND
    p.uuid = pav.ownerid AND
              p.uuid = pav2.ownerid AND
              p.uuid = pav3.ownerid AND
    pav.NAME = cav1.stringvalue AND
              pav2.NAME = cav1.stringvalue AND
              pav2.NAME = cav1.stringvalue AND
    pav.stringvalue = cav2.stringvalue AND
              pav2.stringvalue = cav2.stringvalue AND
              pav3.stringvalue = cav2.stringvalue
    UNION
    SELECT catalogcategoryid AS categoryid, productid, repdomainid AS productdomainid,pav1.stringvalue AS NAME
         ,pav2.stringvalue AS ID, pav3.stringvalue AS SHORT
    FROM productcategoryassignment ,product_av pav1,product_av pav2,product_av pav3
         WHERE pav1.ownerid=productid
         AND pav2.ownerid=productid
         AND pav3.ownerid=productid
         AND pav1.NAME='name'
         AND pav2.NAME='productID'
         AND pav3.NAME='shortDescription';

    user498566 wrote:
    I want to create one pl/sql procedure which can first drop materialized view CATEGORY_PK and after that create same materialized view CATEGORY_PK.That sounds like a waste of time and resources. What do you hope to achieve by this? A refresh? If so, a simple refresh of the old materialized view will do.
    If you truly want to continue this road, you'll have to use the EXECUTE IMMEDIATE command to execute DDL commands from within PL/SQL.
    Regards,
    Rob.

  • How to create a program which can be installed as NT service?

    I wrote a server program using LW/CVI 5.5. I want to install it on NT/2000
    OS and running as NT/2000 services. I know SRVANY.EXE can do this, but I
    want to one step do this using INSTSRV.EXE or using install utility to modify
    registry keys.
    Thanks.

    Hi
    Thanks for your fast replies.. I have created a new material and was able to create inventory thru MB1C. But I was not able to generate a goods delivery(VL01N) and billing document(VF01)  for the sales order.
    Error: No schedule lines due for delivery up to the selected date
    Message no. VL248
    Diagnosis
    There are no schedule lines due for the given order item up to the date chosen.
    System Response
    The system does not create a delivery item for this order item.
    Procedure
    Check whether the order item to be delivered contains confirmed schedule lines.
    If this is the case, set the selection date further into the future if you still want to create a delivery for this item.
    Please suggest,
    Tanks,
    Suma
    Edited by: Suma B on Sep 23, 2008 3:55 PM

  • How to create a text which can support more than 500 chars ?

    Hi all:
        In my interactive form, I have one text, the value inside this text is longtext, the length will be more than 500 chars.
        My problem is now , if there is more than 100 chars, there will be duplicated chars in this text.
        Can I make this text support overlap ? when the value have too many chars, it will display in next row ? is it possible ?

    Hi,
    The 2 points are compulsory for multiline display.
    Could you please let me know the following things.
    1. Is that field is wrapped by any position content subform.If this is the case, try making flow content.
    2. Is there any field below the text field and the 2 fields are wrapped in position content, In this case also make the subform as flow content.
    Refer the example form FP_TEST_01 in SFP transaction.Check the subform and field properties.
    Make a backup before making changes.
    Thanks and Regards,
    Pavan Meda

  • How to create a region which should float in a page . (Like as windows cal)

    Hello Friends
    Using
    Apex Version 4 +.
    Oracle database 11g.
    How to create a region which should float in a page .
    ie i can move that region inside that page anywhere like as windows calculator.
    Can anyone please help me.
    Thanks in advance
    regards
    Edited by: A on Apr 13, 2011 1:48 AM
    Edited by: A on Apr 13, 2011 1:48 AM

    Hi,
    You can use a jQuery dialog.
    http://docs.jquery.com/UI/Dialog
    e.g. create html region, just say you give the region static id: floating-region, make it hidden by adding attributes: style="display: none;"then do like: $('#floating-region).dialog();
    I made another post on steps to create a dialog. See: {message:id=9506160}
    Ta,
    Trent

  • How to create accrual WT which is accrual monthly and auto generated?

    Hi Experts,
    How can I create accrual WT which can be automatically generated every month?
    E.g. A WT for Incentive Accrual = Basic Salary 1340/12)*80%
    How can I make this Incentive Accrual WT to be generated automatically base on the above formula and I dont need to input in any infotype?
    Appreciate with your help.
    Thanks!!!

    Hi All,
    If I create a WT and not assign to any infotype but just put in T54C3, and define the processing class 30 as cumulated in current year , will that WT  be cumulated automatically and store in CRT?
    Or do I have other alternatives to handle that?
    Appreciate with all your help.
    Thanks.

  • How to create a JButton that can run other Apps?

    Hi, Every1
    i want to create a JButton which can let the user click it and it runs a
    specified installed app in the system ( say, a JButton that fires up MS
    Outlook). how can i do that?
    thank you very much.
    Yu.

    hi, if i want to execute some kind of the following, how would i handle it?
    mailto:[email protected]
    i tried: Runtime.getRuntime().exec("mailto:[email protected]");
    but it gave me java.io.IOException: CreateProcess: mailto:[email protected] error=2
    i think this problem would be relatively easy but i just cant figure out.
    thanks

  • How to create a link which will redirect to a different iView?

    Hello,
    I have a certain iView, let's call it "myiView" which sits inside a certain Role, let's call it "myRole".
    At the Homepage of the users I have KM navigation iView which shows a certain folder. I would like to create inside this folder a link to "myiView", this way when users will click on this link at the Homepage they will be redirected automaticly to "myiView". I remember reading once something regarding internal links perhaps this is solution but I'm not sure. Can anyone please show me how to create such link which redirects to another iView at the portal.
    10X
    Roy

    Hey Prakash,
    I am creating a KM link to this target, where at this link I can write javascript? As far as I know it is only possible at the iView level no? And where do I take the PCD URL from?
    Hey Ashutosh,
    I think that your method will open a whole new browser since it is an external link, I woulk like to keep the current navgation at the same page, simply navigate the user to a different place at the portal...
    Roy

  • How to create a button which unloads an iFrame and puts in its position another iFrame?

    How to create a button which unloads an iFrame and puts in its position another iFrame?
    It is very important for me if anyone could answer...
    Thank you all in advance,
    Frank

    Ok I found it!!

  • How to create interface where you can view metadata of several databases

    How to create interface where we can view metadata of several databases:
    Oracle Apex should display metadata of this particular DB (later on we can include multiple DB’s)
              a. Report should first display DB name
              b. When clicked on DB name, should display 3 schemas
              c. When clicked on 1 schema, should display tables – when clicked on each table,
              should display various column names and its corresponding metadata.
              (similarly for other schema’s also)
              d. In short, it should be like a drill down report.
    Help required for craeting like above.
    Appreciate your help.

    I did something similar a while back. I had an application reading from multiple schema's for reporting purposes..IN that case atleast we just would build the selects using a function reurning SQL select, so that we could have an application item with the selected schema they wanted to use to build into the select returned...
    For forms, that would be an interesting idea, don't know how you can dynamically change the table owner name, since it is a drop down control in development..
    Thank you,
    Tony Miller
    Webster, TX
    I cried because I did not have an office with a door until I met a man who had no cubicle.
    -Dilbert
    If this question is answered, please mark the thread as closed and assign points where earned..

  • Can any body tell me how to create a layout variant in the selection

    hi friends i would like to know how to create a layout variant in the selection screen and how to select the variant to display the ouptut using the layout using disvariant.please if possible give me example. thanks in advance.

    hi,
    I shall give you the code. It will definitely work.
    <u><b>Declerations you need to make</b></u>
    data:      WK_VARIANT      LIKE DISVARIANT,
               WX_VARIANT      LIKE DISVARIANT,
               WK_REPID        LIKE SY-REPID,
               WK_VARIANT_SAVE(1) TYPE C,
               WK_EXIT(1) TYPE C.
    <b><u>Things you need to do in the initialization event:</u></b>
    INITIALIZATION.
      PERFORM F_INIT_VARIANT.
      PERFORM F_VARIANT_DEFAULT USING PR_VARI.
    *&      Form  f_init_variant
    FORM F_INIT_VARIANT .
      CLEAR WK_VARIANT.
      WK_REPID = SY-REPID.
      WK_VARIANT-REPORT = WK_REPID.
      WK_VARIANT-USERNAME = SY-UNAME.
      WK_VARIANT_SAVE = 'A'.
    ENDFORM.                    " f_init_variant
    *&      Form  f_variant_default
    FORM F_VARIANT_DEFAULT  USING    P_PR_VARI.
      WX_VARIANT = WK_VARIANT.
      IF NOT P_PR_VARI IS INITIAL.
        WX_VARIANT-VARIANT = P_PR_VARI.
      ENDIF.
      CALL FUNCTION 'LVC_VARIANT_DEFAULT_GET'
        EXPORTING
          I_SAVE        = WK_VARIANT_SAVE
        CHANGING
          CS_VARIANT    = WX_VARIANT
        EXCEPTIONS
          WRONG_INPUT   = 1
          NOT_FOUND     = 2
          PROGRAM_ERROR = 3
          OTHERS        = 4.
      IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
      CASE SY-SUBRC.
        WHEN 0.
          P_PR_VARI = WX_VARIANT-VARIANT.
        WHEN 2.
          CLEAR P_PR_VARI.
      ENDCASE.
    ENDFORM.                    " f_variant_default
    <b><u> After this Things you need to do in the At selection screen event:</u></b>
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR PR_VARI.
      PERFORM F_VARIANT_F4 USING PR_VARI.
    *&      Form  f_variant_f4
    FORM F_VARIANT_F4  USING    P_PR_VARI.
      CALL FUNCTION 'LVC_VARIANT_F4'
        EXPORTING
          IS_VARIANT    = WK_VARIANT
          I_SAVE        = WK_VARIANT_SAVE
        IMPORTING
          E_EXIT        = WK_EXIT
          ES_VARIANT    = WX_VARIANT
        EXCEPTIONS
          NOT_FOUND     = 1
          PROGRAM_ERROR = 2
          OTHERS        = 3.
      IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
      IF WK_EXIT IS INITIAL.
        WK_VARIANT-VARIANT = WX_VARIANT-VARIANT.
        P_PR_VARI = WX_VARIANT-VARIANT.
      ENDIF.
    ENDFORM.                    " f_variant_f4
    After this finally when you call the output using REUSE_ALV_GRID_DISPLAY YOU NEED TO mention this parameter in the function module
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
        EXPORTING
          <i><u><b>IS_LAYOUT          = WA_LAYOUT</b></u></i>
          <i><u><b>I_SAVE             = 'X'</b></u></i>
          <u><i>I_DEFAULT          = 'X'</i></u>
          <u><b>IS_VARIANT         = WK_VARIANT</b></u>
        TABLES
          T_OUTTAB           = ITAB1
        EXCEPTIONS
          PROGRAM_ERROR      = 1
          OTHERS             = 2.
    Once you do this,,, you can create a layout variant.
    P.S. Mark all helpful answers for points.
    JLN

Maybe you are looking for

  • Inserting Dynamic Values in Annotations

    Hello everyone, Is there a way to insert a value to an annotation field through say a properties file or a from a constants class (interface)? Basically here is what I want to do. For example I have the entity class below, @Entity @Table(name="<get v

  • Question about ipohone 4s battery please help

    hi guys well i need everyones relpy please my new iphone 4s losing battery without even using it  ! the iphone is on sleep mood and i am not doing any thing and i am losing battery about 1 % every 10 min so is this problem only in my phone or is it t

  • BCM , batch ID creation Problem,

    Hi , I have a problem in creating the batch ID for payment run for a particular company code: Scenario is as follows: 1. F110 and payment run- success 2.FBPM1, creating the merge date and merge ID but its not creating the Batch ID. 3.After FBPM1 , ba

  • Does anyone know what is Little Snitch and is it safe to use

    I had an email from a friend who mentioned about Little Snitch to prevent keyloggers, is it safe to use.  If it is not I can relay this information back to my friend who was just about to install this software.  Prevention is better than cure Thanks

  • How to install win7, how to install win7

    When I insert WIN7 CD on the computer I got the screen on for only about one minute before it went blank