ImageButton

I'm doing an Image button and when I created the imageSource, it seems in good condition in the QML preview, but then does not load in my camera.

I tried the JPG, PNG, GIF... nothing will work on the device.

Unless it's a typo, it should be ' assets: images / / / / '.

The only other thing I can think is that the images are not copied on the device/Simulator. They are in the location that you think they are?

Try using:

Window-> Show View-> target file system browser

Develop independently of the goal you are working (sim/usb) and navigate to the directory of sandboxes - you will find your app directory it. Check the app/native/Active Directory if your images have been copied on

Tags: BlackBerry Developers

Similar Questions

  • Menu full screen with imagebuttons

    Hello

    I have a menu, start with an image full screen (in the background) and add a few imagebuttons within this context.

    Is any way to do without absolute provision which I think is not recommended?

    Thank you

    You need to understand how to get rid of this translationY for square screens

    import bb.cascades 1.2
    Page {
        Container {
            layout: DockLayout {
    
            }
           ImageView {
               imageSource: "asset:///MddVm.jpg" // Background
               horizontalAlignment: HorizontalAlignment.Fill
               verticalAlignment: VerticalAlignment.Fill
           }
           Container {
               layout: DockLayout {
    
               }
               translationY: -157 // THIS NEEDS TO CHANGE FOR Q DEVICES
               preferredHeight: 400
               horizontalAlignment: HorizontalAlignment.Fill
               verticalAlignment: VerticalAlignment.Bottom
               Button {
                   text: "Take a photo"
                   horizontalAlignment: HorizontalAlignment.Center
                   verticalAlignment: VerticalAlignment.Top
               }
               Button {
                   text: "Select photo"
                   horizontalAlignment: HorizontalAlignment.Center
                   verticalAlignment: VerticalAlignment.Center
               }
               Button {
                   text: "Remove ads"
                   horizontalAlignment: HorizontalAlignment.Center
                   verticalAlignment: VerticalAlignment.Bottom
               }
           }
        }
    }
    
  • Bug? ImageButton always reduces 768 1280 x 768 x 768

    Hello

    Maybe someone can help me on the next Mystery:

    Using an image full screen (1280 x 768) as ImageButton still leads a reduction to a button with 768 x 768. Looks like a bug after having tried even a simple version:

    import bb.cascades 1.4

    {Page}

    {Of container

    ImageButton {}

    defaultImageSource:"asset:///images/test-1.png".

    pressedImageSource:"asset:///images/test-2.png".

    }

    }

    }

    The images have full screen size 768 x 1280.

    Thank you very much in advance for your kind support and best regards

    Andreas

    You can also try using minWidth and minHeight

  • 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

  • Image of Chaning ImageButton

    Hi all

    I'm changing the defaultimage on some ImageButtons to a point in my program, but it does not work for me.  I am sure its something simple that I have forgotten.

    Now I'm doing the following:

    ImageButton * myButton = ImageButton:: create()
    .defaultImage (QUrl ("asset: / / / images/oldButton.jpg"))
    .pressedImage (QUrl ("asset: / / / images/oldButtonPressed.jpg"))
    .disabledImage (QUrl("asset:///images/oldButtonDisabled.jpg"));)

    ....

    ...

    ...

    myButton.defaultImageSourceChanged (QUrl("asset:///images/newButton.jpg"));)
    myButton.pressedImageSourceChanged (QUrl("asset:///images/newButtonPressed.jpg"));)
    myButton.disabledImageSourceChanged (QUrl("asset:///images/newButtonDisabled.jpg"));)

    I do this in C++ and I'm probably doing something stupid

    I hope someone out there can point out.

    Thank you

    evsdev

    defaultImageSourceChanged etc are signals that are emitted when the property value changes.

    You must call the setters: myButton-> setDefaultImageSource (...) etc.

    When using constructors (create() method), poseurs have no prefix 'set '.

  • How to send an Email on ImageButton click?

    Hello

    I created a form where the user enters some details. I have an image button to 'submit '.

    I want all the details by e-mail this entry by the user.

    Kind regards

    Ajay Sharma

    Hey there,

    I did the following. I have the Invocation in attached objects

           Invocation {
                id: invokeEmail
                query: InvokeQuery {
                        id: qu
                        invokeTargetId: "sys.pim.uib.email.hybridcomposer"
                        invokeActionId: "bb.action.SENDEMAIL"
                        //uri: "mailto:[email protected]?subject=Mold detected&body=Name: "+ nameText.text + "\nEmal: " + emailText.text + "\nPhne: "+ phoneText.text + "\nMessage: "+ messageText
                }
                onArmed: {
                    if (qu.uri != "") {
                        trigger("bb.action.SENDEMAIL");
                    }
                }
            }
    

    and I have a button

                        ImageButton {
                            defaultImageSource: "images/ui/send_bt.png"
                            pressedImageSource: "images/ui/send_bt.png"
                            disabledImageSource: "images/ui/send_bt.png"
                            onClicked: {
                                    qu.uri = "mailto:[email protected]?subject=Mold detected&body=Name: "+ nameText.text + "\nEmal: " + emailText.text + "\nPhone: "+ phoneText.text + "\nMessage: "+ messageText.text;
                                    qu.updateQuery();
                                    invokeEmail.trigger("bb.action.SENDEMAIL")
                            }
                        }
    

    And this way it works correctly.

    Please try

  • How to set a label/text for an ImageButton control?

    Hi guys,.

    ImageButton allows you to set the background for three different States images: defaultImage, pressedImage and disabledImage. But how to define the label for her? I want an ImageButton Label with three different background images.

    Help, please

    Thank you

    Hello

    Create a custom using DockLayout button. Is there a code example in this thread:

    http://supportforums.BlackBerry.com/T5/Cascades-development/how-to-set-click-event-into-custom-Butto...

    Place it in a separate qml file, for example CustomButton.qml.

    Then, it can be used like this:

    CustomButton {... properties...}

  • Click on the ImageButton control

    ImageButton
    {
                                
    defaultImageSource: "asset:///images/ic_user.png".
    pressedImageSource: "asset:///images/ic_user.png".
    disabledImageSource: "asset:///images/ic_user.png".
    preferredHeight: 210
    preferredWidth: 210
                               
    text: 'Login '.
    }

    How can I fire option click? call myapp.vclickjbutton (); side c ++

    It works, if I change the order...
    and put my false imagebutton in the tank which imagebutton + text

    so now, I've covered the 4-way. Thank you very much. to show them to my boss to decide if

    1 have a container, inside the image... button u click imaebutton going to new page.but not click on all of the container
    2 - gesture onlongpressed for full container
    3 - no containers, just I don't design an ImageButton together
    4. false imagebutton with opacity 0.covering all container.on click on anywhere on the container, I go to the Boutonclique function.

  • 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

  • ImageButton error call .qml (beta 3 of waterfall)

    Hello friends, after beta 3 came the waterfall had several errors of new variables and some chains of command in my mobile, entiendiendo already realized a few fix a little problem I had this code works perfectly in Beta 3, I have a button called a qml

            ImageButton {
                id: donar
                defaultImageSource: "asset:///images/donacion.png"
                pressedImageSource: "asset:///images/donacion.png"
                layoutProperties: AbsoluteLayoutProperties {
                }
                onClicked: {
                navigationPane.deprecatedPushQmlByString("donaciones.qml");
                }
                preferredWidth: width
                preferredHeight: height
                translationX: 80.0
                translationY: -60.0
            }
    

    But when I run the application in the alpha dev and I click on the ImageButton control I opened the QML, I think it's due to the structuring of new programming language, could help me with this problem to invoke the QML?

    Greetings.

    I have the Alpha of Dev with Os 10.0.9.44

    Hello

    Please check below link

    https://developer.BlackBerry.com/Cascades/documentation/dev/dynamic_qml/index.html

    Use ComponentDefinition.

    Thank you.

    --------------------------------------------------------------------------------------------------------------------------------------------

    feel free to press the button like on the right side to thank the user who has helped you.

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

  • Disable fading between ImageButton control States?

    I was not able to understand this for some reason any. When you tap a button image, how to disable the fade out / fade in the image of the depressed state? I wish that she just spent the State immediately. Thank you!

    I don't think that you can override this behavior.

    You can always create your own either a CustomControl or even more simple use notecard on a label in a container of color.

  • Several Rollover ImageButton Qt

    Hello

    In Qt, I have an image I want to make it clickable, when you click on I want to know what part of the image was clicked and dependent then part that I want to define a new image, until the user releases.

    So, basically, I have need of a button with 5 possible roll on images, could someone tell me how I would do this please?

    Thank you

    I solved this by using subclass a QLabel, making it clickable and defining its pixmap depends on what area was clicked.

  • ListView cannot see C++ object passed to QML via QmlDocument-> setContextProperty()

    I can access a C++ object using the QmlDocument function-> setContextProperty() in JavaScript inside most of the QML elements (such as containers, ImageButton, control etc.) happened, but can't access it from the JavaScript inside ListView. I get "ReferenceError: can't find variable: app. Why is this?

    Why is it a "problem"? It's probably just the way things work and should work. ListItemComponents are not really part of the scene graph/context since they exist only to be used during execution. Wait so the scope of the listItemcomponent unlike the rest of the document.

    The way around it, as described in the thread linked above is to create a function inside your listview that refers to the context property that you want to use. Then, your listitemcomponent has access to this feature of the listview.

  • Change of image in 1 page

    Hello..

    is there an example of code to do this? (see image below)

    If I click on this small image, it will display the cotyledon on the left and so on.

    Thank you

    you have a list of images, or will they change? If you just need to reproduce the image above, do as pyth told. Create a container with two containers inside with an orientation sticky lefttoright: one for the large imageView and one for the three imagebuttons.

    and the onClicked for image buttons change the source of the image of the imagview to the assets of the relevant image.

    Or you could do the same thing by replacing imagebuttons by imagviews and have an order for onTouch when a user touches the images on the right.  Depends on which seems more attractive for you.

Maybe you are looking for