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
EkanshSrivastava
Posts: 49
Registered: ‎08-13-2012
My Device: 9300

Background incomplete on simulator.

HI All,

 

I am setting background of a page. It shows good on Qml Preview. But when i run the app on simulator.

 

There is a thin padding of white color appears on left and top.

 

 

Please tell me whats the issue.

I've attached the screenshot. of the Qml code, Qml Preview and the Simulator Preview.

 

Regards

EkamshLogin.JPG

Developer
EkanshSrivastava
Posts: 49
Registered: ‎08-13-2012
My Device: 9300

Re: Background incomplete on simulator.

HI Guys,

 

Please help me.

Developer
oliver_kranz
Posts: 216
Registered: ‎09-18-2009
My Device: Z10

Re: Background incomplete on simulator.

Can you post your code as text, please?

Developer
EkanshSrivastava
Posts: 49
Registered: ‎08-13-2012
My Device: 9300

Re: Background incomplete on simulator.

// Default empty project template
import bb.cascades 1.0
import bb.system 1.0

// creates one page with a label

NavigationPane {
    id: navPane
    backButtonsVisible: false
    Page {
        //   property alias labelText: errorTextid.text
        Container {
            background: Color.create("#003366")
            layout: StackLayout {
            }
            verticalAlignment: VerticalAlignment.Fill
            horizontalAlignment: HorizontalAlignment.Fill
            ImageView {
                imageSource: "asset:///images/kayakoLogo.png"
                horizontalAlignment: HorizontalAlignment.Center
                bottomMargin: 100
            }
            Label {
                id: errorTextid
                objectName: "errorObject"
                text: ""
                horizontalAlignment: HorizontalAlignment.Center
                textStyle.color: Color.Red
            }
            TextField {
                id: helpdeskurlTextBox
                horizontalAlignment: HorizontalAlignment.Center
                hintText: "Helpdesk Url"
                leftMargin: 65.0
                topMargin: 50.0
                preferredWidth: 0.0
                minWidth: 500.0
                onTouch: {
                    errorTextid.text = "";
                }
                verticalAlignment: VerticalAlignment.Top
                textStyle.textAlign: TextAlign.Center
                textStyle.color: Color.DarkGray
            }
            TextField {
                id: usernameTextBox
                horizontalAlignment: HorizontalAlignment.Center
                hintText: "Username"
                leftMargin: 65.0
                topMargin: 20.0
                preferredWidth: 0.0
                minWidth: 500.0
                onTouch: {
                    errorTextid.text = "";
                }
                textStyle.textAlign: TextAlign.Center
                textStyle.color: Color.DarkGray
            }
            TextField {
                id: passwordTextBox
                horizontalAlignment: HorizontalAlignment.Center
                hintText: "Password"
                leftMargin: 65.0
                topMargin: 20.0
                bottomMargin: 150
                preferredWidth: 0.0
                minWidth: 500.0
                inputMode: TextFieldInputMode.Password
                onTouch: {
                    errorTextid.text = "";
                }
                textStyle.textAlign: TextAlign.Center
                textStyle.color: Color.DarkGray
            }
            Button {
                id: loginButton
                text: "Login"
                horizontalAlignment: HorizontalAlignment.Center
                attachedObjects: [
                    ComponentDefinition {
                        id: goToWebView
                        source: "screenHome.qml"
                    },
                    LoadingPopUp {
                        id: loading
                        onClosed: {
                            
                            loginButton.setEnabled(true);
                            if (errorTextid.text.trim() == "") {
                                var blogpage = goToWebView.createObject();
                                navPane.pop();
                                navPane.push(blogpage);
                            }
//                            var Page1 = getSecondPage();
//                            loginNavPane.pop()
//                            loginNavPane.push(Page1)
                        }
                    }
                ]
                onClicked: {
                    if (helpdeskurlTextBox.text == "") {
                        errorTextid.text = "Please enter helpdesk url";
                    } else if (usernameTextBox.text == "") {
                        errorTextid.text = "Please enter username";
                    } else if (passwordTextBox.text == "") {
                        errorTextid.text = "Please enter password";
                    } else {
                        /*loginButton.setEnabled(false);
                         * app.initiateRequest(helpdeskurlTextBox.text, usernameTextBox.text, passwordTextBox.text)*/
                        app.HandleBtnLoginClick(helpdeskurlTextBox.text, usernameTextBox.text, passwordTextBox.text);
                        loading.open();
                    }
                }
            }
            ActivityIndicator {
                id: loginIndicator
                objectName: "indicator"
                preferredWidth: 130
                preferredHeight: 130
                horizontalAlignment: HorizontalAlignment.Center
                verticalAlignment: VerticalAlignment.Center
                onStopped: {
                    loginButton.setEnabled(true);
                    if (errorTextid.text.trim() == "") {
                        var blogpage = goToWebView.createObject();
                        navPane.push(blogpage);
                    }
                }
            }
        }
    }
}

  Its my QML code.

Developer
oliver_kranz
Posts: 216
Registered: ‎09-18-2009
My Device: Z10

Re: Background incomplete on simulator.

Since you set both vertical alignment and horizontal alignment of the Container to fill it should work. We do the same and it works. Maybe, it's just a bug in the simulator and it works on the device.

 

The only difference I see is that you set NavigationPane.backButtonsVisible to false.

 

You can also try to nest two Container. But this is only speculation. Your code should work.