postEvent to ImageButton does not

(continued from http://supportforums.blackberry.com/t5/Cascades-Development/Automated-Integration-Testing/m-p/232630...)

I managed to save TouchEvents (their screen x / y, x window /, local x / y) and their receiver and the target objects. However, when I try and create a new TouchEvent and post it to the receiver, I get a warning message handler to:

Trying to send event unknown receiver: "Event[Touch] Time[08:53:30:841] Phase[142743258] Type[0] Screen[149,176] Window[149,176] Local[149,176]"

by using the code:

...
TouchEvent * te = new TouchEvent(TouchType::Type(touchType), sx, sy, wx, wy, lx, ly, visualObject);
QCoreApplication::postEvent(receiverObject, te);
...

I tried all combinations of display - display of the Application (bb::cascades), display the scene, showing the receiver and the target itself, but I still get the same error.

What Miss me to inject tactile events?

QMetaObject::invokeMethod(visualObject, "touch", Q_ARG(bb::cascades::TouchEvent*,te));

This essentially raises the event of button directly to the object (ignoring the receiver at the moment - I could try and plug that) but right now the spread of the use of postEvent (i.e. the right way that seems to work on QT4 with Hooq, etc.) doesn't seem to work with Cascades.

Tags: BlackBerry Developers

Similar Questions

  • ImageButton does not appear in C++ instead of QML mode?

    Goal: Show the image on the screen buttons.

    ERRO: ImageButton does not appear in C++ instead of QML mode.

    Question: something wrong in my code?, or the imagebutton control develops now?

    Mini code:

    imageButton = ImageButton:: create()
    .defaultImage (QUrl ("myDefaultImage.png"))
    .pressedImage (QUrl ("myPressedImage.png"))
    .disabledImage (QUrl ("myDisabledImage.png"));

    imageButton-> setVisible (true);

    Container container = Container::create () .add (mStartStopButton);

    Thank you for your attention,

    Thank jalue reminding me to use the image as mini code to find my problem.

    The problem is not in my code.

    The key is to add a comment in the bar - descriptor.xml.

    assets

  • overlapTouchPolicy does not work by label overlaps ImageButton

    Hi all

    I want to make a button with a custom image and text, what I did was use an ImageButton control to show the background, on which I put a label to display text. Documentation, I learned that I should put it overlapTouchPolicy: OverlapTouchPolicy.Allow on the label for the button receive the click event.  How ever, don't worry: when I click on the label, it does not raise the button click event. Here is the code:

             Container {
                 layout: AbsoluteLayout {
                 }
                 preferredWidth: 768
                 preferredHeight: 126
    
                 ImageButton {
                     id: sendButton
                     preferredWidth: 186
                     preferredHeight: 82
                     layoutProperties: AbsoluteLayoutProperties {
                         positionX: 560
                         positionY: 22
                     }
                     defaultImageSource: "images/title_btn_normal.png"
                     pressedImageSource: "images/title_btn_press.png"
                     onClicked: {
                         //do something                 }
                 }
    
                 Label {
                     text: qsTr("A button")
                     layoutProperties: AbsoluteLayoutProperties {
                         positionX: 600
                         positionY: 40
                     }
                     overlapTouchPolicy: OverlapTouchPolicy.Allow
                 }
             }
    

    Someone has an ideaon how do I fix this?

    Thank you

    Dong

    Hello

    You manage the label click event. If you click on the image (not the label), the click event works in your code.

    Try the code to handle the click event of the label below:

    Container {
            layout: AbsoluteLayout {
            }
            preferredWidth: 768
            preferredHeight: 126
            ImageButton {
                id: sendButton
                preferredWidth: 186
                preferredHeight: 82
                layoutProperties: AbsoluteLayoutProperties {
                    positionX: 560
                    positionY: 22
                }
                overlapTouchPolicy: OverlapTouchPolicy.Allow
                defaultImageSource: "direction_normal.png"
                pressedImageSource: "direction_over.png"
    //            onClicked: {
    //            }
            }
            Label {
                id: lbl1
                text: qsTr("A button")
                layoutProperties: AbsoluteLayoutProperties {
                    positionX: 600
                    positionY: 40
                }
    //            overlapTouchPolicy: OverlapTouchPolicy.Allow    // Comment this line
                gestureHandlers: [
                    TapHandler {
                        onTapped: {
                            // Handle the label click event
                            //lbl1.text = "label clicked worked..."
                        }
                    }
                ]
            }
        }
    

    Thank you

  • 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...

  • iPhone 7 more buttons outside does not

    I've had my iPhone 7 + for about 2 weeks now. Every once in awhile all buttons outside to stop, volume up/down, power, home. The home button will still record and push and give the sensation of taptic and touchID works. The phone itself still works and I can answer texts and which do not use notifications.

    The couple spent time he did, he came upon her in about 4-5 minutes, however it was about half an hour and still nothing. I want to restart my phone, but the switch does not work.

    Has anyone seen this issue or know how to fix?

    Thanks in advance.

    I just experienced the same problem on my iPhone 7, I think it's a bug in iOS, but I am using iOS 10.0.2. Power + button low Volume allowed me to turn it off then turn it back on... Apple please fix this bug!

  • App store, Safari and iTunes does not connect to the Internet after installing macOS Sierra

    App store, Safari and iTunes does not connect to the Internet after installing macOS Sierra

    After upgrade 'OS X El Capitan' to "macOS Sierra" window only empty "App store" and page "Safari" made its appearance, no error message shows. store "iTunes" and "Dictionary" does not connect too.

    But Google chrome works well.

    So have you tried the next steps in your original post that Safari does not work after installing macOS Sierra:

    (1) x OS: "Unable to connect" or "unable to connect to the App Store. An internet connection is required"- Apple Support

    2) Advanced the steps to correct the problems with the iTunes Store - Apple Support connection

  • Safari does not work after installing macOS Sierra

    Safari and apple store does not work after installing macOS Sierra

    Alas, my crystal ball is in the shop for cleaning, so you will need to provide more details on what "doesn't work" and above all error messages. First of all, let's start the App Store. Provide as much information as possible for those of us who do not sit on your shoulder.

  • My iPad Apple 3rd generation wifi + his cell phone does not work

    MY 3rd generation Apple iPad, wifi + cell

    model number MD408LL/a

    Serial number DM * VGL

    THE SOUND DOES NOT WORK

    < personal information under the direction of the host >

    All sounds, or simply notification and sounds apps (for example do music and videos app still have sound)? If notifications and apps you have notifications on mute: on the iPad side switch - Apple Support ? If the sounds in all applications which have tried for example soft-reset/reboot of the iPad, insert/remove the headphones?

  • After recent, iPhone, 6, update, Windows, Explorer, does not work, see, iPhone

    I installed the latest update required for my iphone ios 6 a few days ago, and now when I try to download pictures from my iphone to my PC (via USB connection), the PC does not see the iphone.   iTunes sees it yet, but windows Explorer does not work.  It seems that some setting has been broken through the update of ios.  A way to solve this problem?

    Restart the computer and the iPhone. Unlock the iPhone before connecting it to the computer. Any change?

    TT2

  • iPhone 7 more telephoto camera does not

    Is anyone having problems with iPhone 7 more telephoto does not activate. I'll go to the camera application and press the 2 x zoom feature, but it appears to be not to activate the camera of 56mm at the front. I cover the lens with my finger, the camera on the right side and the iPhone always displays an image despite me concealing one of the cameras teo. I can't activate the second camera. It seems to only be zooming digitally. I'll do this outside and he'll only digitally zoom when I hide the second lens.

    Im having this same problem. I heard from someone that he could not work until the next software update... but I have no idea and have not found anything in the online help. If someone else gets to know how.

  • Contact ID battery fast draining iPhone 5s does not

    5s fast drainage and Touch ID sinice 10.0.2 iOS iPhone battery update does not

    Restarted the iPhone since the update yet?

    1. Press and hold the sleep/wake button until the Red slider appears.
    2. Drag the slider to turn off your device completely off.
    3. Once the device turns off, press and hold the sleep/wake button again until you see the Apple logo.
  • Open the link behind Mail does not work

    Sierra using my link opened behind Mail does not work. The link opens on the top of the window.

    This option works for me in Sierra... is working for you with your previous version of the OS?

  • Update for Sierra and now my Apple music does not appear I have a subscription and I am unable to get my music on the cloud?

    Update for Sierra and now my Apple music does not appear I have a subscription and I am unable to get my music on the cloud?

    Hey there Scotchman2926,

    I understand that you are experiencing some problems with Apple music on Sierra. I have a few suggestions to help you solve this problem. First of all, if you are unable to access the iTunes Store as well as music from Apple, use the information in this article to help resolve this problem:

    If you cannot connect to the iTunes Store - Apple Support

    If this does not resolve the problem, you might try signing out of your Apple ID in iTunes and then connect again.

    Thanks to be come to the communities of Apple Support and let us know how it goes.

    See you soon.

  • iPhone 5 home button does not work after ios 10

    My 5 Iphone Home button does not work after update final IOS version of 10.

    The home button works on the first push to wake the phone but it will not open the phone the second button.

    I activated the assist button, which does not work either. But what I discover is if I open device for assistance then touch and lock screen click on the button home will work once to open the phone. If I open any app I can't close it unless I go through the same routine.

    You attempted to restart your phone?

    You can do so by holding the sleep/wake button and the Home button simultaneously until the Apple logo appears

  • New IMac does not, Apple does not change

    https://www.YouTube.com/watch?v=UdUY038FwCI

    I have this problem since I was the imac. I pointed out in 3 days. Apple does not change because I didn't buy that at its retailer. 3 months, still waiting.

    What should I do?

    Everyone pays even, but I get nothing (same lack offers as a freelancer). I think it's fair. What am I, I guess what to do?

    Run the Apple Hardware Test > Apple Hardware Test - Apple help

Maybe you are looking for