Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Native Development

Reply
Developer
Posts: 134
Registered: ‎04-12-2013
My Device: BB Z10
My Carrier: Telenor
Accepted Solution

custom dialog visibility issue

Hi,

 

I used a custom dialog in my project for a pop up. I used the custom dialog tutorial. As per that, when the dialog box comes up, the back groundpage will be inactive and when the dialog box is closed, that becomes active. My issue is, when I click on "OK"button on the dialog box, the back ground page is not getting enabled in the first press itself. Looks like, after some time, the background inactive color becomes more dark or black color, and I need to keep pressing the ok button on the dialog box several times to close the box.  

 

Any idea how to get rid of this?

Please like this if you are answered.
Developer
Posts: 109
Registered: ‎08-23-2012
My Device: Blackberry Z10
My Carrier: TATA DOCOMO

Re: custom dialog visibility issue

can you please share your custom dialog code bcz it will help to understand your problem.
Dharmender Singh
Developer
Posts: 134
Registered: ‎04-12-2013
My Device: BB Z10
My Carrier: Telenor

Re: custom dialog visibility issue

Hi 

Thanks..

 

This is my custom dialog file:

 

import bb.cascades 1.0

Dialog {
    
    Container {
        
        preferredHeight: 1280
        preferredWidth: 768
        
        background: Color.create(0.0, 0.0, 0.0, 0.5)
        layout: DockLayout {
        }
        
        Container {
            maxHeight: 397
            horizontalAlignment: HorizontalAlignment.Center
            verticalAlignment: VerticalAlignment.Center
            layout: DockLayout {
            }
            
            ImageView {
                imageSource: "asset:///images/pop_up_bg.png"
            }
            Container {
                topPadding: 5
                bottomPadding: 23
                leftPadding: 23
                preferredWidth: 580
                horizontalAlignment: HorizontalAlignment.Fill
                verticalAlignment: VerticalAlignment.Fill
                translationY: 100.0
                Label {
                    text: "<html>Thankyou for your donation <br/><br/>You will get an SMS alert <br/>confirming your donation</html>"
                    textStyle.base: SystemDefaults.TextStyles.TitleText
                   // textStyle.color: Color.create("#fafafa")
                    horizontalAlignment: HorizontalAlignment.Center
                    layoutProperties: StackLayoutProperties {
                        spaceQuota: 1
                    }
                    multiline: true
                    textStyle.fontSize: FontSize.Small
                }
            }
            ImageButton {
                id: okButton
                defaultImageSource: "asset:///images/app-reg-login-normal.png"
                pressedImageSource: "asset:///images/app-reg-login-normal.png"
                disabledImageSource: "asset:///images/app-reg-login-normal.png"
                horizontalAlignment: HorizontalAlignment.Center
                verticalAlignment: VerticalAlignment.Bottom
                translationY: -20.0
                //signal dialogClose()
                
                onClicked: {
                    customdialog.close()
//                    customdialog.deleteLater()
                 // dialogClose();
                 


                
                }

            }
            Container {
                verticalAlignment: VerticalAlignment.Bottom
                horizontalAlignment: HorizontalAlignment.Center
                translationY: -30.0
                touchPropagationMode: TouchPropagationMode.None
                Label {
                    text: "OK"
                    textStyle.color: Color.White

                }
            }
        } 
    }
}

 

Please like this if you are answered.
Developer
Posts: 109
Registered: ‎08-23-2012
My Device: Blackberry Z10
My Carrier: TATA DOCOMO

Re: custom dialog visibility issue

Problem is with your onClicked{} of ImageButton

It should be like this

onClicked: {
close();
}

 

close() is default Signal for closing the Dialog.

 

If have any problem, let me know.

Dharmender Singh
Developer
Posts: 134
Registered: ‎04-12-2013
My Device: BB Z10
My Carrier: Telenor

Re: custom dialog visibility issue

Hi,

thanks, But that doesnt solve my problem yet. I guess the issue is, since setting the background color as (0.0,0.0,0.0,0.5) in the Dialog page, each time this page gets loaded, this background color is getting accumulated. ( weired.. :-/ ) .. and when i keep doing this for some time, the background color becomes black, and on each click each layer gets disappears and in 6 or 7th time, the dialog box gets closed.  

Please like this if you are answered.
Developer
Posts: 109
Registered: ‎08-23-2012
My Device: Blackberry Z10
My Carrier: TATA DOCOMO

Re: custom dialog visibility issue

[ Edited ]

I compiled your code, its working fine according to my change. 

May be some problem how you are opening the custom dialog.
Once let me how you are opening the dialog.

Dharmender Singh
Developer
Posts: 134
Registered: ‎04-12-2013
My Device: BB Z10
My Carrier: Telenor

Re: custom dialog visibility issue

Basically, I have 3 screens for my app. In third page there is a button, which does something. When this button is pressed, I call a function in c++ which in turn calls a function in QML back where I open the custom dialog. 

 

My code is below,

function showPrompt(){
customDialog.open()
}
onCreationCompleted:{
myApp.mySignal.connect(showPrompt)
}

 

This is called from the C++ by emitting the signal mySignal. 

 

Each time I go back to my second screen and come back to third page, and click on the button, this issue comes up. 

 

 

Please like this if you are answered.
Developer
Posts: 109
Registered: ‎08-23-2012
My Device: Blackberry Z10
My Carrier: TATA DOCOMO

Re: custom dialog visibility issue

This is happening bcz everytime when you move to third page , the signal is connecting again and again. So you need to disconnect the signal while going back from the third page. This is how you can manage this

paneProperties: NavigationPaneProperties {
backButton: ActionItem {
onTriggered: {
myApp.mySignal.disconnect(showPrompt)
yourNavPaneId.pop();
}
}
}

Put that code in your third page, and I hope it will solve your problem.


Please like this if you are answered.
Dharmender Singh
Developer
Posts: 134
Registered: ‎04-12-2013
My Device: BB Z10
My Carrier: Telenor

Re: custom dialog visibility issue

Thank You so much. That did the trick Smiley Happy 

Please like this if you are answered.
Highlighted
Developer
Posts: 109
Registered: ‎08-23-2012
My Device: Blackberry Z10
My Carrier: TATA DOCOMO

Re: custom dialog visibility issue

[ Edited ]

Nice to hear from you.

Dharmender Singh