Help with KeyListener, keyChar(), and keyDown()

Hi there, long time reader and displays the first time beginner BB together.

I struggled for about the last 6 hours with the simple KeyListener's next problem. Have exhausted forums BB and Google (e.g. Internet), so I feel comfortable that the answer to my problem is not out there.

I implemented a simple application with a KeyListener to listen to keyChar() and keyDown() and it tested in the Simulator for both the 8320 and "BOLD". My application exits in the keyDown() method, but not the keyChar(). I tested with virtually every key on the keyboard.

What I am doing wrong? It's maybe something basic...

Code snippet below. Notice in the example below, I get a lot of messages 'KeyDown', but not 'KeyChar. Note in the example that my main screen is separated from the class that I have pushScreen() at the end of the constructor.

Appreciate the help!

class MyApp extends UiApplication {
    ...
    private MyApp() {
        ...
        addKeyListener(new TestKeyPadListener());
    }
    ...
    private class TestKeyPadListener implements KeyListener {
        public boolean keyChar( char key, int status, int time ) {
            System.out.println("KeyChar: " + key);
            if (key == Characters.ENTER ) {
                System.out.println("Heard Enter");
            }
            return false;
        }

        public boolean keyDown(int keycode, int time) {
            System.out.println("KeyDown: " + keycode);
            return false;
        }
        public boolean keyRepeat(int keycode, int time) { return false; }
        public boolean keyStatus(int keycode, int time) { return false; }
        public boolean keyUp(int keycode, int time) { return false; }
    }
}

Find other methods of keyChar() that you have coded.  I guess that you have one in your form and who swallows the keyChar events before he gets to this KeyListener.

Tags: BlackBerry Developers

Similar Questions

  • Help with check boxes and actions

    Hello

    I just downloaded a trial version of LiveCycle Designer ES2 to see if this program works for the company that I work for. I need to create order forms for our products that our customers can fill out online and then send an e-mail to our sales department.

    I have imported our current order form to LiveCycle as a work of art and have inserted check boxes on the form. I want the form to automatically add the price of the option they checked off the retail price of total at the bottom of the form. Do you have any suggestions for me?

    Thank you!

    Stefan

    Hello Stefan,

    LC Designer is a very powerful application. While you can drag and drop objects on the form, for things really move you need to put a script in objects. This allows to control the way in which the form will be according to the users actions.

    To begin with there is help. If you have a look at the Action Builder in the Tools menu, you can select an object, then use the plain instructions accumulates the desired interaction. When you click OK, LC Designer will insert the necessary script.

    Therefore, there may be a steep learning curve, so it depends on how comfortable you are to roll up your sleeves and do some scripts.

    First, you must configure your workspace. This tends to be a personal preference, but here's a basic layout.

    It is a bit small, because of the scale, but you get the idea. At any time, you should be able to see the page, the hierarchy and the script editor. The object library and the range of the object and other palette must be close to hand as well.

    I am NOT inclined to import the form existing as work. This can limit the built-in options in LC Designer later. You can save your form existing in JPEG format and then in a new form to use the image object (value size full page) to display the image of the existing form.

    [ALTERNATIVE: you can also add fields to a PDF in Acrobat].

    Regarding scripting, the following JavaScript code should work in the click event of the checkbox (on the ground that the other field is named totalPrice).

    If (this.rawValue == 1)

    {

    totalPrice.rawValue = totalPrice.rawValue + 10;

    }

    on the other

    {

    totalPrice.rawValue = totalPrice.rawValue - 10;

    }

    This should take into account if the user changes of opinion and unticks the box.

    One thing to keep in mind about forms developed in the LC Designer, it is only the functions that will be available in the form (such as submit by e-mail in PDF format) will depend on whether the user has Acrobat or Reader, and also on whether the form has been active player (and how it has been activated). There is more information here: http://assure.ly/gYyYc2.

    I highly recommend JP Terry on LC Designer which is excellent - book "create dynamic with Adobe LiveCycle Designer Forms. It starts at the beginning and clearly sets out the key learning points. In the end, there are a few good examples that you can copy anywhere in your forms.

    We have solutions and blog posts on our website http://www.assuredynamics.com.

    There are also a range of online resources. You can find these resources useful:

    http://www.Adobe.com/go/learn_lc_scriptingBasics

    http://www.Adobe.com/go/learn_lc_scriptingReference

    http://www.Adobe.com/go/learn_lc_formCalc

    http://www.Adobe.com/devnet/LiveCycle/articles/Adobe_XML_Form_Object_M odel_Refer ence.pdf

    http://www.Adobe.com/devnet/Acrobat/PDFs/lc_migrating_acrobat_xmlform. PDF

    And a very convenient resource (and even if it's for version 6, it is still very good because of the way it is presented):http://partners.adobe.com/public/developer/en/tips/CalcScripts.pdf

    The HelpFile in the LC designer can also help with the syntax and LC designer itself comes with some great models and examples.

    Finally, discover the network of the developer on http://www.adobe.com/devnet/livecycle/

    A book that does not deal with the scripts at all, but is very good on the formatting is also ""does this work " by Caroline Jarrett and Gerry Gaffney."

    The Adobe "PDF forms Bible" is OK, but focuses mainly on AcroForms.

    WindJack Solutions have a service on subscription for the scripts and solutions tohttp://www.pdfscripting.com. There a lot of AcroForm script which can be modified according to LC designer and a growing library of LC Designer solutions.

    I hope this helps,

    Niall

  • How to get help with Add ons and extensions that stop working

    I have saved passwords and it has stopped working. It's so hard to get help with Moxilla

    rosemarybales said

    I still don't know why the extension button passwords saved with the key icon has stopped working.

    This button displays the saved passwords in Firefox's built-in password manager, is no separate passwords that record you in Dashlane. Can you save passwords in both places? (Well, I guess you do.)

    I have a guess on why it has stopped working. Firefox 40 has some changes to how extensions can work with the user interface, so quite a few extensions that have been more than one year must be updated for Firefox 40. It has been updated on January 10, 2012.

    Anyway, the way of 'long' to display the passwords saved in Firefox is through the Options page, the Security Panel, the saved passwords button.

  • Photosmart: Called tech support for help with my printer and got a sales pitch

    I called HP customer service today to get help with my wireless printer because it won't print wireless. What I got was a sales pitch to buy a value of $450 of virus protection! So very disappointed!

    Hello

    Thank you for using the HP forum.

    How can we help with your wireless?

    Have you tried the following:

    Please download and run the HP Print and Scan Doctor (PSDR) tool to diagnose and solve your problem

    http://h20180.www2.HP.com/apps/NAV?h_pagetype=s-926 & h_lang = on & h_client = s-h-E016-1 & h_keyword = DG - PDU

    Hope that helps.

  • Need help with the formatting and reinstalling windows

    Hi, I have a Compaq Presario C700 p/n GR598EA #ABU I got to work about 3 years ago.

    Recently, it does not load windows, even in safe mode and I can't get back either.

    I used a disc to boot from linux to access and backup of all my important files and now I want to reformat the hard drive, resintall windows and start over (or try something else which will fix it)

    The laptop has been pre-installed with Windows Vista and HP stuff had already installed on it.  I don't have a Windows disc or discs of driver with the laptop.

    How can I format and reinstall windows and drivers, if I don't have records?

    Help, please.

    Thank you.

    Hello:

    You can order a Vista recovery disk set for your laptop if they are still available. See the instructions below:

    http://support.HP.com/US-en/document/c00810334=

    If you live not in the US or the Canada, you can contact HP Support worldwide for the country you live and ask recovery disks command to your laptop

    The link to the assistance of HP WW is below:

    http://welcome.HP.com/country/us/en/wwcontact_us.html

    Paul

  • Helps with the rv180w and the Shrew soft vpn

    Hi, I'm trying to establish a vpn connection by using soft shrew for the cisco rv180w router.

    I watch and read everything I could find, but the connection drops during the opening of the tunnel.

    There were a few tuttorial here in the forum, but the links are down.

    I want Edifier is to establish communication and to be able to access my domain on the network.

    Any help with the settings would be greatly apeciated. I am new to vpn.

    Thanks in advance.

    Federico,

    Try to access the following link. It has good instructions for a similar model. The main difference is that the SA500 has double-WAN and the RV180W does not work.

    https://supportforums.Cisco.com/docs/doc-9378#comment-7216

    Here's another tutorial for the RVS4000 that can help:

    https://supportforums.Cisco.com/docs/doc-18443

    Check out the last post in the following thread, which received instructions for the RV220W (should be exactly the same as RV180W)

    https://supportforums.Cisco.com/message/4165652#4165652

    -Marty

  • Help with Hard Drive and registry

    Hey, it kinda turns out to be a long and difficult history, but I recently had a small problem that spread to a problem much bigger (and catastrophic).

    I had a problem with freezxing on my laptop (HP Pavilion Dv5 with the 64-bit version of Vista I think). I've tried a few things m ais it froze just in case. Finally I found someone who said they ran a registry cleaning program and that did the trick. I tried and I had no more freezing. Unfortunately, I connected an external hard drive and all hell broke loose. It froze and I turned off the laptop. I have it turned on and was greeted with this message:

    STOP: c000021a {Fatal System Error}
    The Session Manager failed to create protected prefixes system process terminate
    d unexpectedly with a status of 0x000003a (0x00000000 0x00000000).
    The system has been shut down.
    

    I tried to boot in safe mode and found:

    STOP: c0000218 {Registry File Failure}
    The registry cannot load the hive (file):\SystemRoot\system32\config\SOFTWARE or its log alternative.
    It is corrupt, absent, or not writable.
    

    Then, she went and made the collection of data, and that was all. After that, I tried the boot recovery option and that never worked. I searched internet and found a few people with similar, but never the same questions. Someone, somewhere, says something about execution of system restore after having access to the menu by pressing F8 at startup. I tried. It did not work. I pressed F8 at startup upward and chose the first option. It has established a list of things to try. System Restore (and other options such as checking memory and bring up the command prompt) did not work because the C drive has been used. Large. I tried to use the disks that came with my laptop and I never once found while they were actually useful because I could never the laptop to run.

    Now, I wanted to try to use the command prompt. Never really had a chance. Now, when I start the computer I'm greeted by the inspiring message of hard drive are not.

    Sweet. Now, I'm a little stuck on what to try. I tried to reset the BIOS defaults and nada. I have no idea what it must try now and would love to help anyone.

    I would be very happy and I thank you for your time.

    It depends on how much you have to pay to get the new hard drive installed and running. Get a quote for a computer shop trust you.  So I think that if the computer has been done what you wanted to do before he went wrong.  If it was enough for you and the price of the repair is not too high (maybe less), I would. If the price is more than $ 200, I would start thinking about applying your money towards a new laptop computer, but that cheaper isn't always the best deal.  Do some research and try some mobile friends to see if it is fast enough for you and you enjoy the feeling. Stop in some stores that display laptops and taste. Laptops with dedicated video card memory will do better with the games.  If the games are starting to become important to you, consider a desktop computer instead of a laptop where you can buy a killer video card. I like the new Ivy bridge to intel for laptops so look for it.  This is the new family of Intel processors. I7 Ivy bridge is the finest, then the i5, then the i3.  You really need to sit with someone who knows computers and discuss your needs for the future and how you want to use your computer.

  • Help with conditional display and Validation

    Version 4.1.1.00.23

    Hello

    I'm having a difficult time with a conditional display and validation, I hope someone can help with.

    Requirements:

    When (Datepicker) Start Date or the end Date (Datepicker) change can display the reason for change (select list) and change Description (Textbox)
    If the page is saved without entering a reason change display an error message of validation that the reason for the change cannot be empty (NULL)

    What I tried

    Create a dynamic Action on the Start Date

    Event: Change

    Selection type: Article (s)

    Items (s): P51_START_DATE

    Condition: no

    Real Action Section:

    Action: Show

    Fire on Page load: Checked

    Display all the elements of the page on the same line: NO.

    Section of the elements concerned:

    Selection type: Article (s)

    Product (s): P51_CHANGE_REASON, P51_CHANGE_DESC

    I also created a dynamic Action with similar settings for the P51_END_DATE.

    I created a Validation for the P51_CHANGE_REASON as a function return error text:

    DECLARE
        v_start_date    work_items.start_date%TYPE;
        v_end_date      work_items.end_date%TYPE;
    BEGIN
        SELECT start_date
              ,end_date
        INTO   v_start_date
              ,v_end_date
        FROM   work_items
        WHERE  work_items_id = :P51_WORK_ITEMS_ID;
        IF ( (v_start_date != TO_DATE(:P51_START_DATE,'DD-MON-YYYY') OR v_end_date != TO_DATE(:P51_END_DATE,'DD-MON-YYYY') ) AND
              :P51_CHANGE_REASON IS NULL ) THEN
            RETURN 'Change Reason must have a value';
        END IF;
    END;
    
    
    

    The question

    I tried to create another dynamic Action to hide the P51_CHANGE_REASON and P51_CHANGE_DESC fields during the loading of the page, but when the date fields are changed and the validation is fired the P51_CHANGE_REASON and the P51_CHANGE_DESC are hidden again.

    There are two buttons to send the page: 'SAVE' will submit the page and stay on the page and 'SAVE_CHANGES' will present the page and creates a branch to the previous page (which is a relationship with the EDIT buttons to change recording).

    I can not loading the dynamic Action page for fires DO NOT when validation is triggered.

    I hope it is clear and if not what information can I provide?

    Thank you

    Joe

    Which the condition is failing and what browser? I tested it in Firefox and it works as it should. Can you confirm that?

  • Help with sum multiline and formatting «,»

    Hey guys, I need help with a question that I am struggling to solve...

    I have a multiline field in which I paste information from an excel spreadsheet. This information is in a format 1.234,56.

    I was able to have the numbers stuck on the ground in another area, by removing the ',': something like this:

    var withcoma = this.getField("Input_1").value; This is my multi-line field used to paste data from excel

    nocoma = withcoma.replace(/\,/g, ".");

    the var values = nocoma.split("\r");

    var total = 0;

    for (var i in values) total += Number(values[i]);

    this.getField("Total").value = total;


    The point is that I have to be able to change the numbers that I have to format to the format 1,234.56 1.234,56 if I choose to use a different currency than my original and also wear numbers in the field "Total" correctly updated.

    Could someone point me in the right direction?

    Thank you very much!!!

    The solution was to add another line of code to remove the periods used so that thousands separators in numbers.

  • Need help with network inside and outside Transmittion script

    Hi, I have a problem in my script. I would get Vm net.received.average and net.transmitted.average. Somewhere, it displays the empty output for me, can I have a sample of script on obtaining transmittion of network for 7 days

    My script:

    $report = @ (get - Vm = $vms). where {$_.} PowerState - eq "Receptor"} $lastWeek = (get-date). AddDays(-7) foreach ($vm in $vms) {$vmNet = "" |} Select VmName, NetworkReceive, NetworkTransmit $statReceive is Get-Stat-entity ($vm) - start $lastWeek - finishing (Get-Date) - MaxSamples 1 - net.received.average stat. Group-object - property Instance $statTrans = Get-Stat-entity ($vm) - start $lastWeek - finishing (Get-Date) - MaxSamples 1 - net.transmitted.average stat. {Group-object - property Forum $vmNet.VmName = $vm.name $vmNet.NetworkReceive = "{0: F2}" f $statReceive.value $vmNet.NetworkTransmit = "{0: F2}" f $statTrans.value $report += $vmNet} $report | Select VmName, NetworkReceive, NetworkTransmit | Export-csv "c:\q33.csv".
    Thank you

    Both are related to the use of aggregation running on your vCenter

    Historical data interval 4 are grouped once a day, and on your vCenter this SQL task seems to be planned at 08:00.

    That is why the time stamp.

    Statistical data are aggregated to one historical interval to another.

    Since ask us the historical interval 4 (with the IntervalMins parameter), the aggregagtion to this historical interval is not yet made.

    This is why the last day 2 are not present in the report.

    You can play with the - Start and - finishing settings to have a period of 7 days which is at least two days yet at the time.

    $report = @()
    $metrics = "net.received.average","net.transmitted.average"
    $vms = Get-Vm | where {$_.PowerState -eq "PoweredOn"}
    $start = (get-date).AddDays(-7)
    $finish = $start.AddDays(7)
    
    Get-Stat -IntervalMins 1440 -Entity ($vms) -start $start -finish $finish -stat $metrics -Instance "" | `  Group-Object -Property Timestamp,EntityId | %{
        $vmNet = ""| Select VmName, Timestamp, NetworkReceive, NetworkTransmit
        $vmNet.VmName = $_.Group[0].Entity.Name
        $vmNet.Timestamp = $_.Group[0].Timestamp
        $vmNet.NetworkReceive = "{0:f2}" -f (($_.Group | where {$_.MetricId -eq "net.received.average"} | Measure-Object -Property Value -Sum).Sum)
        $vmNet.NetworkTransmit = "{0:f2}" -f (($_.Group | where {$_.MetricId -eq "net.transmitted.average"} | Measure-Object -Property Value -Sum).Sum)
        $report += $vmNet}
    $report | Export-csv "c:\q33.csv" -NoTypeInformation -UseCulture
    
  • Help with GREP search and replace

    I've never used grep before and I'm stumped.  I have a document that lists the times for different classes.  Times are variously listed as 9-10, 9-10, 9-10 or 9-10, to get examples.  The problem is that there may be no space or a space on the left or the right of the hyphen.  I want it all the time as 10:30 - 11:30, for example.  In other words, the link must have a space on each side of it.  I think that this could be accomplished with GREP search and replace, but I don't understand the syntax well enough to make it work.

    Can someone tell me how to write the search and replace expressions?  (Of course the real time could be any hours).

    Thank you!

    It is tempting to add spaces of * all numbers separated by a dash. If you don't know all time have some minutes, then it is safer to use this:

    (?<=:\d\d)>

    .. Replace with space hyphen space.

    He seeks the "settler, any digit, any digit" (which is * found * not * included *), followed by 'optional of a space, a hyphen, optional space' and must be followed by 'any number' (again, not counting this one). Since the figures before and after are * found * not * included *-which is due to the (? xxx) syntax - all that needs to be replaced is the dashboard itself. Making the space before and after the optional dashboard (using a single "?" immediately after each), no matter if it * is * a space or not, all the combinations will be found and replaced.

  • HP Pavilion Notebook - 15-p199: need help with the installation and activation of 10 Windows after completely uninstalling Windows

    Hello HP assistants.

    I need help for a specific problem. My laptop came with an installation of Windows 8.1. Then I upgraded to 10 Windows when it became available. After a while, I decided to uninstall Windows completely (to wipe the hard drive) and install a Linux operating system.

    Now, I decided that I want to use some software that is not available on Linux and if I want to reinstall Windows 10. My problem is that Windows has completely disappeared in a form any. So now, I need to download Windows 10 from an official source (which I think can be done fairly easily from the official source of Microsoft, although if there is a better, HP official medium to do this then please recommend it) and then I need to activate Windows some how.

    As has been made clear, I have the right to use Windows 8.1 and 10 but I would need to download Windows 10 and turn it on. Is there a way to do this? I'm literally stuck without solution.

    Thanks in advance.

    Hello

    As long as the previous installation of Windows 10 had activated Ok after upgrade from 8.1, you can simply perform a new installation as described in the guide on the following link.  Note: On the activation screen, select "I don't have a product key" - Windows will activate automatically once installation is complete.

    http://www.howtogeek.com/224342/how-to-clean-install-Windows-10/

    Kind regards

    DP - K

  • Satellite L955-10f - need help with uninstall Win8 and install Win7

    I'm now totally fed up with the Mickey Mouse Windows 8 OS and want to return to Windows 7. I have a new laptop Toshiba Satellite L955-10f. Should I use the recovery disk to get rid of W8?

    Is there a way I can get a recovery for W7 for this machine disk in case it is needed in the future? I'm not technical, so any help will be appreciated.

    Thanks in advance.

    Right there is big problem with this machine. I ve checked the download page of Toshiba and this model is not supported for Win7, it will be difficult to find the right drivers, tools and utilities.

    This model is designed for Win7 Toshiba doesn't offer Win7 recovery disc.
    This is a rather complicated situation. The first thing you need to do should now create Win8 recovery media using the preinstalled Toshiba Recovery Disk Creator.

    I put t know what to say. Maybe you have someone with an excellent knowledge of PC and who can help you with this. Material of your machine should be compared with other models may be supported, so you will be able to use the drivers, tools and utilities available for these models.

  • Need help with while loop and shift registers

    I have a broad set of data and required to read data at maybe 200 samples at a time to process these samples through my VI and have add and concatenate a file separate lvm.  The part where I am confused is the shift registers. How can I limit the number of samples read in an iteration? How do the while loop to stop when all data are read in?

    I have attached my diagram, there may be something wrong with my technique?

    This will give you an idea.  There are a lot of other (probably more effective) methods.  It is a basic solution, quick and dirty to help you grasp the overall concept.

  • Need help with disc error and chkdsk/f?

    Hi, my name is Jennifer.  I am running Windows XP Professional, Service Pack 3 with a 74.4 GB HDD.  I'm working on for a few months, in order to correct an error on my hard drive.  I can't defragment because it tells me that chkdsk /f should be run.  When I try to run that, since a command line, it is said that he cannot work because the files are in use.  He asks then that if I want to run the next time I start my computer.  I enter Y for Yes.  When I restart, it does not appear that the chkdsk /f that I asked to execute the command line before rebooting tried to run.  I get no messages at all.  I see no file scroll on the screen.  I used chkdsk /f until I added the Service Pack 3.  It fixed my mistakes.  Now it doesn't work at all.

    I don't think that there is a serious mistake because computer Maintenance told me I have a healthy system.  I think that Windows XP I have an error due to a large number of power outages in my area, my computer was croustilleur on and outside.  Yes, I also have a surge protector.  I'm not having any problem other than my slow computer because I can't defragment.  I can't get Windows to fix the disk error, so I can defragment.

    Is it possible to get direct access to my hard drive (a command line to start) before loading Windows so that I can access the drive without interfering the files?  I rebooted a few times, press F8 and ask the computer to start with one command line.  All I got was a list of files with no possibility to enter or move up and down; no cursor.  There was no command line prompt.

    I chatted with Russell Pope to Microsoft response Tech.  He said to run sfc/scannow.  I did that more sfc /scanonce more sfc /scanboot.  My computer asked me to put the original in system installation disc.  I did, and all the original files of the system have been checked several times after several hours.  No problem, but I still have a disk error that prevents me from defragmenting.  How can I get a disk error when all the original system files are intact?

    I searched around Microsoft, but could not find a clear answer to my problem.  I worked on this for the last three days; non-stop.

    Is there anyone out there who can help me?  I'd appreciate a lot!

    You're right (the same effect).

    You can also do it in (gpedit.msc) Group Policy Editor, but since there are no GPE with XP Home, you will not get away with this idea (engineers of Microsoft Support - be careful).

    Secpol.msc works on XP Home?  I don't think, but maybe someone will check it out and tell me if I can be sure.

    As the forums MS Answers does not prompt for any information system when a new question is asked, we often have no idea that taste of XP someone is running.

    We could lose a round of messages asking the supplementary question, or suggest Run gpedit or secpol only to come back and say it does not waste another cycle of message, or you can simply edit the registry and it will still work 100% of the time any flavour of XP is installed.

    I also like to know where things are located in the registry, because when the system boots simply cannot, they cannot cross the administrator part in the Recovery Console because they do not know the password, so I can get it to boot on a third-party tool like Hiren Boot CD that has a remote registry Edit feature, edit the registry on the afflicted system here and make the necessary adjustments so that they can find the RC - works every time!

    Here's an another small blurb on this subject:

    http://winhlp.com/node/78

    Pop in any time!

Maybe you are looking for