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

Tags: BlackBerry Developers

Similar Questions

  • Its Invocation Bug! Please help-. ATTACHED VIDEO

    Hi all! Just started creating my first ever app. In the video you can see the instrument I play is not working properly. The sound is playing 3 - 4 times instead of one.

    video link: http://www.youtube.com/embed/uIePavoFsMw

    Sorry I can't copy / paste code right now (not on PC) but here is the code I used:

    (img) {
            id: customSoundPlay1
            text: qsTr("Play Sound 1")
            layoutProperties: StackLayoutProperties {
                spaceQuota: 1.0
            }
            onTouch: {
    
                myPlayer.setSourceUrl("asset:///sounds/Doorbell_001.wav")
                myPlayer.play()
            }
        }
    

    Hey I have corrected the problem, change the image in the imagebutton control. Works fine now.

  • Quick way to chaning the spacing between multiple images?

    IM design of a site of the gallery which has photos and each thumbnail image has the same spacing around it, he distancing from the following image. At the time using x im and is coordinated in the property inspector to space out the images correctly.

    Assuming that I did but then wanted to change the amount of spacing, what would be the best way to do this? The result would be if I had just changed the value of the margin for images in CSS and they were all in the same division
    Thank you

    I don't know what it is you are trying to do? You want space, but you want that they touch?

    Auto spacing/digitally is available in the Aligner CS4 Panel but now in CS3.

    A few things you can do.
    -View > grid > edit grid. Display grid / magnet on the grid, and then set it to the w/h of your thumbnails.

    Then position your thumb/placeholders within the grid - they should align and 'touch' the other.

    Yes you can convert your thumb/placeholder graphic symbol, duplicate the symbol instance, double click on anyone of the sybol instance to modify, then edit > transform > digital transformation to the new size. Then done.
    The only drwaback there are, you will need to realign.

    h

  • 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

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

  • Image in the body of NotificationDialog

    Hello

    I try to include an image in the body of a triggered notificationDialog on the side without head of my application. I see several made BlackBerry applications such as calendar doing this. They have even managed to make the clickable image as ImageButton in qml.

    Anyone know how I can achieve this? (image not clickage would be great to start)

    Thank you.

    * Edit: Added the screenshot of what I mean

    I think his problem is that he use it to headless, as mentioned. Only NotificationDialog is available from headless.

  • 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

  • How to remove the image with a single click?

    Hello friends, I want a help with something simple.

    I want to open my app when displaying an image with data or information and clicking on, get out and show me the menu of the application as usual.

    My picture is this:

    seen in my application, but I can't make it go away

    Solution:

         ImageButton {
                    id: imageView02
    
                    defaultImageSource: "asset:///images/IMG_00000014.png"
                    onClicked: {
                        imageView02.visible = false
                    }
                }
    
  • 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.

  • Button image

    Hello I'm using image button focus and unfocus. My problem is that when Gets the focus on the image and get unfoucs of image, it will display blue color border. I don't want this blue border.

    I don't know how I should delete that? I enclose below class customeImageButton. I don't want on each edge of the blue side on the image button. Plese help me.

    package com.api;
    
    import net.rim.device.api.system.Bitmap;
    import net.rim.device.api.ui.Graphics;
    import net.rim.device.api.ui.component.ButtonField;
    
    /* Customized ImageButton */
    ////////////////////////////////////////////////////////////////////////////////////////////////////////////
    //Class Name      :       ColorManager
    //Created On      :       14/11/2011
    //Created By      :       Ajay Patil
    //Purpose         :       This class is for Button field with a bitmap as its label
    ////////////////////////////////////////////////////////////////////////////////////////////////////////////
    
    /**
     * Button field with a bitmap as its label.
     */
    public class CustomImgButtonField extends ButtonField
    {
            private Bitmap bitmap;
            private Bitmap bitmapHighlight;
            private boolean highlighted = false;
    
            /**
             * Instantiates a new bitmap button field.
             *
             * @param bitmap the bitmap to use as a label
             */
            public CustomImgButtonField(Bitmap bitmap, Bitmap bitmapHighlight)
            {
                this(bitmap, bitmapHighlight, ButtonField.CONSUME_CLICK|ButtonField.FIELD_HCENTER|ButtonField.FIELD_VCENTER);
            }
    
            public CustomImgButtonField(Bitmap bitmap, Bitmap bitmapHighlight, long style)
            {
                super(style);
                this.bitmap = bitmap;
                this.bitmapHighlight = bitmapHighlight;
            }
    
            /* (non-Javadoc)
             * @see net.rim.device.api.ui.component.ButtonField#layout(int, int)
             */
            protected void layout(int width, int height)
            {
                    setExtent(getPreferredWidth(), getPreferredHeight());
            }
    
            /* (non-Javadoc)
             * @see net.rim.device.api.ui.component.ButtonField#getPreferredWidth()
             */
            public int getPreferredWidth() {
                    return bitmap.getWidth();
            }
    
            /* (non-Javadoc)
             * @see net.rim.device.api.ui.component.ButtonField#getPreferredHeight()
             */
            public int getPreferredHeight() {
                    return bitmap.getHeight();
            }
            /* (non-Javadoc)
             * @see net.rim.device.api.ui.component.ButtonField#paint(net.rim.device.api.ui.Graphics)
             */
            protected void paint(Graphics graphics) {
                    super.paint(graphics);
                    int width = bitmap.getWidth();
                    int height = bitmap.getHeight();
                    Bitmap b = bitmap;
                    if (highlighted)
                        b = bitmapHighlight;
                    graphics.drawBitmap(0, 0, width, height, b, 0, 0);
            }
            protected void onFocus(int direction)
            {
                this.setHighlight(true); super.onFocus(direction);
            }
            protected void onUnfocus()
            {
                this.setHighlight(false);
                super.onUnfocus();
            }
            public void setHighlight(boolean highlight)
            {
                this.highlighted = highlight;
            }
    }
    

    I have an extended bitmapfield which reacts on the navigationclick and key, related to his fieldchangelistener. works well for years.

    If you are unable to apply it yourself, this can help you:
    http://supportforums.BlackBerry.com/T5/Java-development/implement-advanced-buttons-fields-and-manage...

  • The backround button image

    HY everybody, it is embarising to ask this, but I am a beginner deveoper Blackberry and I want to put a picture on a button (a background image of the button) and I confuse myself. What I need to create a special class to do this, or it is a simple method to do? Can you help me with some suggestions?

    How about using ImageButton?

    http://developer.BlackBerry.com/native/reference/Cascades/bb__cascades__imagebutton.html

  • Unable to set the image of the gallery as a backdrop

    Hi all

    I was able to open the Gallery to choose the picture, but was not able to set the selected as a background image.

    Whenever I pick a picture, the default image will set to white.

    Here is my code, can anyone know where goes wrong?

    Thanks in advance.

    Container {
    
                background: recipeBackground.imagePaint
    
                attachedObjects: [
                    ImagePaintDefinition {
                        id: recipeBackground
                        imageSource: "asset:///images/bg.jpg"
                        repeatPattern: RepeatPattern.XY
                    }
                ]
                Container {
                    layout: DockLayout {
    
                    }
                    opacity: 1.0
                    visible: true
                    horizontalAlignment: HorizontalAlignment.Center
                    background: Color.Transparent
                    leftPadding: 0.0
                    ImageView {
                        imageSource: "asset:///images/header.jpg"
                        preferredHeight: 150.0
                        opacity: 0.9
    
                    }
                    Container {
                        verticalAlignment: VerticalAlignment.Center
                        horizontalAlignment: HorizontalAlignment.Fill
    
                        layout: StackLayout {
                            orientation: LayoutOrientation.LeftToRight
    
                        }
                        leftPadding: 200.0
                        Label {
                            text: "Testing"
                            preferredHeight: 100.0
                            verticalAlignment: VerticalAlignment.Center
                            horizontalAlignment: HorizontalAlignment.Center
                            textStyle {
                                base: SystemDefaults.TextStyles.MediumText
                                color: Color.White
                            }
                        }
                        ImageButton {
                            verticalAlignment: VerticalAlignment.Top
                            horizontalAlignment: HorizontalAlignment.Left
                            leftMargin: 150.0
                            defaultImageSource: "asset:///images/Settings.png"
    
                            onClicked:{
                                picker.open()
    
                            }
    
                        }
    
                        attachedObjects: [
                            FilePicker {
                                id: picker
                                property string selectedFile
                                title: qsTr("File Picker")
                                mode: FilePickerMode.Picker
                                type: FileType.Picture
                                viewMode: FilePickerViewMode.GridView
                                onFileSelected: {
                                    selectedFile = selectedFiles[0]
                                    recipeBackground.imageSource = selectedFiles[0]
                                }
                            }
                        ]
    
                    }
                }
    

    Well it just add the permission to access_shared bar - descriptor.xml and it works!

Maybe you are looking for