TouchEvent & FieldChangeListener both does not work

Hello

I have 2 bitmapfields and a buttonfield. I want that all fields to intercept the click event. Initially, I had added only fieldChangeListeners to all fields, but bitmap field has not answered them (despite making them Focusable). I added touchevent to handle events click for all areas, now all fields respond only touchEvents. Same buttonfield does not meet fieldChange that he met before adding the touchEvent.

Can someone help me to know the problem and the solution for the same. I want that all fields to react to events through contact or normal by a click. Also in touchEvent as navigationClick added id, if the menu is not coming, but otherwise with the other menu click only just who should not and the fieldchangelistener should be handled.  Here's the code.

    private BitmapField  signOffBtn, profileBtn;
    private ButtonField btn;

    public LoggedUserScreen(UserBean user) {
        super();
        this.loggedUser = user;
        System.out.println("Into LoggedUserScreen : Got user");
        init();
        this.add(signOffBtn);
        this.add(profileBtn);
        this.add(btn);
    }

    private void init() {
        signOffBtn = new BitmapField (Bitmap.getBitmapResource("icon.png"),  BitmapField.FOCUSABLE ) {
            protected boolean navigationClick(int status, int time) {
                return true;    // handle click event
            }
        };
        profileBtn = new BitmapField (Bitmap.getBitmapResource("icon.png"),  BitmapField.FOCUSABLE ) {
            protected boolean navigationClick(int status, int time) {
                return true;    // handle click event
            }
        };
        btn = new ButtonField("button", BitmapField.HIGHLIGHT_SELECT |  BitmapField.FOCUSABLE);
        signOffBtn.setChangeListener(this);
        profileBtn.setChangeListener(this);
        btn.setChangeListener(this);
    }

    public void fieldChanged(Field field, int context) {
        if (field == signOffBtn) {
            System.out.println("********* SIGN OFF CLICKED");
        } else if (field == profileBtn) {
            System.out.println("********* PROFILE CLICKED");
        } else if (field == btn) {
            System.out.println("********* button CLICKED");
            System.exit(0);
        }
    }

   public int getFieldAtLocation(int x, int y)    {
         XYRect rect = new XYRect();
         int index = getFieldCount() -1;
         while (index >= 0)        {
            getField(index).getExtent(rect);
            if (rect.contains(x, y))
                break;
             --index;
         }
         return index;
  }

  protected boolean touchEvent(TouchEvent event) {

      switch(event.getEvent()) {
          case TouchEvent.DOWN:
            return true;
          case TouchEvent.MOVE:
            return true;
          case TouchEvent.UP:
            return true;
          case TouchEvent.CLICK:
            int index = getFieldAtLocation(event.getX(1), event.getY(1));
            // Ignore click events outside any fields
            if (index == -1)
                return true;

            Field field = getField(index);
            if (field == signOffBtn) {
                System.out.println("Touched SignOff");
            } else if (field == profileBtn) {
                System.out.println("Touched Profile");
            } else if (field == btn) {
                System.out.println("Touched Button");
            }
            return true;
      }
      return false;
  }

Thank you

Ago I already watched this about such removeFocus or setFocus (false) or more. But yes, your something.setFocus gave me the idea to setFocus on the screen itself for the development is removed from the key also and not on any component capable of intercepting the event.

So if I add fieldChangeNotify (0); in signOffBtn navigationclick, profileBtn & btn, then I totally don't need to implement the touchEvent?

    private void init() {
        signOffBtn = new BitmapField (Bitmap.getBitmapResource("icon.png"),  BitmapField.FOCUSABLE | ButtonField.FIELD_LEFT) {
            protected boolean navigationClick(int status, int time) {
                fieldChangeNotify(0);
                return super.navigationClick(status, time);    // handle click event
            }
        };
        profileBtn = new BitmapField (Bitmap.getBitmapResource("icon.png"),  BitmapField.FOCUSABLE | ButtonField.FIELD_RIGHT ) {
            protected boolean navigationClick(int status, int time) {
                fieldChangeNotify(0);
                return super.navigationClick(status, time);    // handle click event
            }
        };
        imageBtn = new ImageButton(Bitmap.getBitmapResource("icon.png"), Bitmap.getBitmapResource("icon.png"));
        btn = new ButtonField("button", BitmapField.HIGHLIGHT_SELECT |  BitmapField.FOCUSABLE | ButtonField.FIELD_RIGHT) {
            protected boolean navigationClick(int status, int time) {
                fieldChangeNotify(0);
                return super.navigationClick(status, time);    // handle click event
            }
        };

        signOffBtn.setChangeListener(this);
        profileBtn.setChangeListener(this);
        imageBtn.setChangeListener(this);
        btn.setChangeListener(this);
    }

touchEvent is totally deleted & navigationClick is implemented for each button.

Thank you. I just want to confirm, with this, my componetns everything will work for touch & non touch screen properly. 9530 Simulator touch screen reacts (left mouse click), but not touch that is a click (muose right clisk) does not do anything. So I was wondering...

Tags: BlackBerry Developers

Similar Questions

  • TouchEvent in Listfield does not work after scrolling in the storm.

    Hello

    My problem is that I have a 250 size listfield, which I add to a verticalfieldmanager1, this verticalfieldmanager1 is added to an another verticalfieldmanager2, then verticalfieldmanager2 is added to horizontalfieldmanager then horizontalfieldmanager is added to the screen.

    By default, I have to display index 220 (to achieve this, I'll focus on the listfield), so when I key to select other items in the list it is not selecting (Touch event does not work). It is to select only the element that has focus.

    I am owner event touch listfield. Could someone please help me in this regard.

    Hello

    I am happy to share that I found a solution for the problem I had.

    Post here as it may help someone. I used the TouchEvent.getX () & TouchEvent.getY)

    directly which solved my problem, previously I was using () TouchEvent.getGlobalX & TouchEvent.getGlobalY ().

    Once again thank you.

  • USB optical mouse is recognized but does not work.

    I use a computer portable 64-bit of windows 8 and I have tried to use all ports.

    The red light under the mouse appears upwards (the mouse is a mouse usb HP in the base address) but I'm not able to click or move.
    I read the previous posts about other people with this kind of problem and checked my device manager and uninstalled all my drivers and then re them installed for the mouse, but I noticed that when I uninstall the drivers mouse and plug it in again, it installs several things; under Human Interface drivers it installs the HID-compliant device and 3 USB input devices.
    It also installs "HID-compliant mouse" under "mice and other pointing devices".
    Every 10-20 seconds it will make noise that indicates it is be unplugged and plugged back in and all the drivers disappear and reappear.
    I tried to use another mouse that looks like this, and none of them work in my laptop. They both work in my PC and my laptop of brothers, they are both windows 7.
    Thank you

    Hello

    As you have tried 2 other mice in all ports of the computer and both does not work, but the same mouse works in any other computer shows that the problem is with the controllers USB (universal Serial Bus) of the laptop.

    I would ask you re-install Bus controllers and check if that helps.

    a: press the Windows key + R, and then click on Device Manager

    b. expand the Controllers of Bus USB section by clicking on the'+' sign.

    c. Uninstall each of the devices under the section USB Controller by right-clicking on each one, and then clicking Uninstall.

    d. close the Device Manager and restart your computer. Windows RE-automatically install the USB controllers in your computer, without you having to do anything further. Your computer is now running properly USB devices.

    Answer please if you have any questions.

  • two face automatic printing both sides of the page, does not work. Why?

    I have a printer with auto print both sides of the page. It does not work. Why?

    Some printers require a separate duplex adapter must be installed in the printer. He might be able, but the part is missing. Additionally, make sure that you use the printer drivers printer manufacturers, not those provided with Windows.

    Is what printer model?

  • Windows Media Center does not work on both my XP and Vista computer. The two events lastnight

    Windows Media Center does not work on both my XP and Vista computer. The two events lastnight

    Hello

    For someone to really help him, it is important to give as much information as possible.

    You say "my computer XP and Vista" are this one computer dual boot with XP and Vista, or is - the two computers 'single '?

    If it happened "yesterday" did you updated anything or whatever installed?

    Having only happened yesterday have you tried a "System Restore" to see if this corrects the problem?

    What TV card are you using and have you verified that this works correctly?

    If you get not a photo is the antenna in place properly?

    Do you get any error messages? More information, you can provide more someone will be able to help John Barnett MVP: Associate Expert Windows XP: Windows Desktop Experience: Web: http://www.winuser.co.uk ; Web: http://xphelpandsupport.mvps.org ; Web: http://vistasupport.mvps.org ;

  • How is it, my original keyboard does not work on my desktop, but works on my laptop? And my keyboard works for both laptop and desktop?

    Hello

    I have a desktop computer Windows 7 Home Premium 64-bit with an ASUS M4A87TD EVO motherboard. Recently, I have a problem with my Wired Saitek Eclipse PZ30AU keyboard: when I type, the typical button does not appear on the screen. In other words, the keys are unresponsive. The keyboard is turned on, if the office is enabled/disabled. Even if, at the time, while he was working, the light is always disabled whenever the office is off. I don't know why it is informed, even if the office is off.

    My wired mouse usb works fine. I even tried my USB adapter for wireless network in two USB ports, and I still have the signal, so I guess it works very well too. The on-screen keyboard works.
    However, I tried to connect the keyboard desktop on my laptop and for some reason, what works. I also tried to use a different keyboard on my desk, and it actually works.
    I downloaded the chipset, the driver M4A87TD EVO BIOS 2001 driver and a driver of NEC Electronics Corporation USB 3.0 controller. But first, I had to install the Akamai NetSession Interface. After that I downloaded all three files, I installed the chipset driver and USB driver in uncompressing them, by clicking on each file, by clicking on Setup. For some reason, the BIO 2001 pilot had only a ROM file, so I just deleted total. After installing and restarting the computer, the keyboard does not.
    I want to emphasize that, before even manually, download the drivers, I tried using WIndows Update to install all important and recommended updates. After the computer restarts, the guarded keyboard lights flashing on and outside.
    So, I ask two things:
    1.) how does my original keyboard does not work on my desktop, but works on my laptop? And my keyboard works for both laptop and desktop?
    2.) can I keep I have installed the drivers or uninstall them?
    Thank you.
     
    Original title: keyboard problem

    Hello

    This problem can occur because of incorrect keyboard layout settings.

    Please follow the instructions from the link and check that it works very well.

    Check out the link:

    Mouse, touchpad and keyboard with Windows problems

    http://Windows.Microsoft.com/en-us/Windows/help/Mouse-touchpad-keyboard-problems-in-Windows#V1H=tab05

    For all windows questions do not hesitate to contact us and we will be happy to help you.

  • SanDisk cruzer flash drive glide does not work on my rt of surface, both are new

    SanDisk cruzer flash drive glide does not work on my rt of surface, both are new. Could not format it rises

    Hi Victor,

    Welcome to the Microsoft Community and thanks for posting the question.
     

    According to the description, the Flash Player does not work.
     
    This can happen because incorrect settings in the computer.
    Click on the link below and see if it helps.
     
    Answer to us if you are having problems with the Flash Player or any Windows problem, and we would be happy to help you.
     
    Good day!
     
     
    Hope this information helps.
  • I downloaded FF6 on my desktop and my laptop, both work except that RoboForm does not work my office and my laptop will be. Cannot understand it.

    When I downloaded the new update on my laptop there is a notice that add ons would not work, RoboForm has not been included and works very well. Then I upgraded to FF6 on the desk and he was on the list and does not work.

    RoboForm Lite Password Manager 2.1.0

    Check and tell if its working.

  • AirPlay does not work on Apple TV with ios 10.  It was working before the update.  Please notify.

    AirPlay does not work on Apple TV with ios 10.  It was working before the update.  Please notify.

    Try these steps, check to see if things work after each step if necessary, before you try the next.

    1. Check AirPlay is on the Apple TV (turn market if it already is)
    2. Check that both devices are on the same network (settings > Wifi on the mobile device and the settings > general > network, on the Apple TV).
    3. Restart the Apple TV (settings > general > restart).
    4. Restart the Apple TV by removing ALL cables for 30 seconds.
    5. Restart your router. (Also try to remove the power cord for at least 30 seconds)
    6. Restart your computer or mobile device.

    If you're still having problems, try to use 802.11n for wifi if you currently use 802. 11B or 802. 11 g.

    If your problem is AirPlaying starting a computer, try turning off bluetooth

    If you're still having problems, the following article can help you.

    Troubleshooting AirPlay

    Troubleshooting connections and Wi - Fi networks

    Recommended Wi - Fi settings

    WiFi Diagnostic Software (for Mac users)

    You will also find help on this page, where I have collected some of the more unusual solutions for network problems.

  • Tap to talk time does not work on my watch

    Hey guys!

    Tap to talk time does not work on my watch.

    I know that his works only with Mickey/minnie.

    the watch is after unpari/pair, the "tap to speek" function is enabled (on the iphone and the watch)

    both are updated to the latest ios/watch OS and still...

    any ideas...?

    Thank you!

    Return on investment

    Hi King

    I suggest to wait until a few hours, leaving the face of Mickey or Minnie Mouse selected on your watch.

    My own experience (tested on two watches) is that the feature became available after waiting, without rebooting or unpairing / rematching of the watch. In one case, it took somewhere 3-5 hours, but you can see that the function starts working sooner than that.

    It can help to first turn the tap to set the time to stop, pause for a few moments and then turn it back on again.

  • Firefox installs Windows 10 but does not work

    I've updated my installation of Windows 7 Pro 64-bit for Windows 10, taking the opportunity (at the same time) to install a SSD and re - install everything from scratch. I tried (many times) to re - install Firefox, and while it seems to install OK, if I click on the Firefox icon to launch I get an error message: "Windows cannot access the specified device, path or file C:\Program Files (x 86) \Mozilla Firefox\firefox.exe.» You may not be allowed access to this file. »

    I tried to run with the Windows 10 firewall turned both works - but it made no difference. (My main firewall is Kaspersky Security Total.) Edge, Internet Explorer and Opera browsers work OK, but Google Chrome does not work either. Y at - it an idea of the problem here? I hope someone can solve it for me because I prefer to use Firefox over Opera. Thanks for your replies.

    It was very good work. Play well.
    Please report your last post as solved while others will know.

  • Sync does not work after reinstalling Windows 7

    Sync works great between my Windows 7 Desktop and 8.1 tablet. The PC got a clean installation of Windows this weekend and now Sync does not work. I do not receive my bookmarks/history/etc on the desktop.

    -Two versions of Firefox are updated (40.0.2)
    -J' read the troubleshooting and installation FAQs
    -I am able to sign in sync on both computers
    -For the signature, I get a popup saying that Sync will begin momentarily and an e-mail notification. Nothing happens tho.

    I suspect that the problem is related to this 'new' version of Sync. I tried to follow the FAQ "Updated to the new version of Sync", I took off the two devices, I checked both are on the latest version of Firefox, but the next step is to create a new account to sync and it doesn't let me do, I plug my email and get "account already exists." What Miss me?

    The new profile created from the clean windows installed a fusion with other devices? Check the device to see if it retains profile data.

    Have you changed the password? This would stop all data from previous synchronization that was not local.

    If you go down this road of troubleshooting, the account must be deleted first. However to prevent data loss, you can click on remove account from accounts.firefox.com and then re - sign up.

  • Made the switch from the Firefox chrome; now, meeting places and a few videos does not work

    Salvation; I'm wanting to get away from chrome, but in firefox, I can't get the 'hangouts' working in gmail, even if I do not have the googletalkplugin installed on my pc. Another issue I see is that, on some pages, video does not work; in the latest version of chrome, I understand that the flash thing has changed and I guess that firefox has not changed in the same way. I hesitated when downloading a plugin, as shown on the screenshot for fear that it will mess up video in chrome, I would use chrome. I would rather not switch back from firefox to chrome to phone or watch the video. Help, please.

    I asked for help on the hangouts thing before, but your suggestion 'install plugin' was not enough, so I request further assistance on this now. on the video thing, please just tell if I should download the plugin and whether or not it will affect the reading in chrome. Thank you

    Working! I had the talk plugin set to always turn on but I had disabled the video because I only use the phone, but apparently, they both need to be addressed to always activate... Please mark this as resolved and thank you!

  • I have two versions of the same book on my iphone and ipad.  I want the same book, so I can study on each device.  I tried to remove the books and start again.  It does not work.  Help.

    I have two versions of the same book on my iphone and ipad, which are not synchronized with the other.  I want the same book on each device, so I can study on one or the other.  I tried to remove the books on my phone, ipad & itunes and start again.  It does not work.  Help.

    Hello david.hogan87,

    Thanks for posting about what is happening. If I understand you correctly, you have a book you want on your iPhone and iPad, but neither is synchronizing correctly to have both.

    Have you checked every device to confirm that the same identifier Apple is signed all three?

    iPhone and iPad: head to settings > iTunes and App Store

    iTunes: on a Mac, it's under account or installed depending on the version of iTunes store.  On a PC, it is also under account, and if you don't see the menu bar, click on the triangle in the upper left corner to view the Bar Menu or CTRL + B on the keyboard.

    If all 3 have the same signed Apple ID, post the version of iOS and iTunes for all three devices here, please.

    Best regards.

  • OSX Server caching does not work after update

    It was low on my priority list, but the OSX Server that we run in the House for the caching seems to have stopped caching; from what I remember, it was related to the update software to 10.11.4 of what it was before, and server software everything that has been installed to 5.1. Updates both to the latest versions now have not helped. It of kind of frustrating, but all he puts in cache are now asking that makes for itself. No customer request is visible. It worked before.

    There seems to be no useful diagnostic that I can find to establish why the hell it suddenly does not work.

    Platform: Mac Mini, "the end of 2014", bought this year. OSX currently on 10.11.5; 5.1.5 Server

    Network configuration: IP public addresses multiple; several subnets.

    Clients do not use the same IP address as a server.

    Full assignment of the IP of the site listed in _aaplcache._tcp TXT DNS records (plural - because I did it for the DNS records for each subdomain DNS LAN client) using the type prs; DNS is on Windows Server 2012R2. Any length of characters, because they were not specified during the installation of OSX Server cached the required DNS records.

    No firewall is between the server and clients on the local network (only a L3 switch), but obviously, if the customer traffic leaves our network, it passes through a firewall. No change to the rule group since it worked finally.

    The Mac Mini has an interface (with IP address and corresponding DNS record) in each subnet of the client (using virtual LANs), but it seems to register with the Apple servers using its main wired LAN IP (which can reach customers) with the Apple servers.

    Mac Mini connects via gigabit ethernet.

    Wireless connectivity is through a mix of HP MSM and Ubiquiti access points; no system seems to result in customer traffic.

    My understanding of the protocols involved are something along these lines.

    -OSX server registers with Apple, using its normal connection; transmits the local LAN IP address for the cache clients to use; can pass TXT DNS records to help "seed" of customers, or can use the parameter entry in the cache server configuration.

    -Customers use the TXT DNS record to inform the global servers of Apple that they need the IP address of the server cache.

    -Apple returns the local LAN IP address.

    -The customer is for the server cache.

    -Profit.

    I certainly see the first happening party - the Debug.log show apparently successful registration; the cache in the applet Server service is green - but no client request seems to happen.

    Obscured address IP addresses are correct.

    Things are green and just seem to.

    Looks like he should be happy.

    IPs are correct and correspond to the DNS records.

    Help! What other steps can I take to diagnose - and trouble - this problem? The Apple Help documentation is not really very useful (I understand what he says), but he doesn't really give sysadmin level overview of what to do when he's not "just works".

    Thanks in advance for all understand how to debug properly and fix this.

    .. .clients can and collect software on the internet (that we want to avoid as much as possible).

    Amount of updated data in cache is so small that I did it (reset button) in the case which has been randomly a question. No joy. Was previously more than 300 GB in size, across many types of content.

    If it is not clear, the clients and servers using NAT, but different IP are used, depending on the subnet they come. He previously worked.

Maybe you are looking for

  • Satellite t100-10 x freeze after fashion 'sleep'

    Hello I have the following problem. My laptop is Satellite T110 - 10 X with Windows 7 64 bit.When the computer enters "sleep" mode and after that I wake him with button / stop lights, I type my password and in less than a minute, it freezes. I try to

  • How to deploy Variables shared with aliases (project Variable), when some machines are offline?

    Hi all I have a distributed application (PC + some CompactRIOs). My PC contains the variables having the aliasing enabled - they are related to the variables on the cRIOs. Of the cRIOs is currently offline. I am deploying some changes that I made on

  • Hello, I have an Aspire E1-531-2438

    Apparently this isn't on the list for compatible with the upgrade of Windows 10, plus I have Windows 8 and you must have 8.1 upgrade to 10? Is it possible, or it will never drivers where I can get 10? Said that I'm not able to move to 8.1, is not com

  • Have lost the product key for Windows Vista

    Hi, please I lost my product key for windows vista. How can I go about it?

  • driver Win 8.1 LaserJet 1102

    HP has the intention to provide a windows 8.1 for the 1102 printer driver w?  It works perfectly fine with Win 7.  I don't want to replace a printer to work because I replaced a computer