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: 692
Registered: ‎08-09-2010
My Device: Not Specified
Accepted Solution

How to set background image into TextField in Cascade (Custom Field) ?

Hello,

 

   Any one know how to setBackGround image in TextField?

 

 

Developer
Posts: 16,986
Registered: ‎07-29-2008
My Device: Z10 LE, Z30, Passport
My Carrier: O2 Germany

Re: How to set background image into TextField in Cascade (Custom Field) ?

there is no option for that, but you can work with other components.

for example a container with a docklayout can display several items on the same position. if you put an ImageView and a TextField on the same position they will overlap.
The rest is fine tuning.
----------------------------------------------------------
feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.
@SimonHain on twitter
Retired
Posts: 571
Registered: ‎06-25-2010
My Device: Z10
My Carrier: Vodafone

Re: How to set background image into TextField in Cascade (Custom Field) ?

You can't in the way I think you mean. But what you should be able to do is place a TextField on top of an ImageView using DockLayout. Hopefully that will give you the effect you're looking for. You could even turn this into your own custom control.

--------------------------------------------------------------------------------------------
Feel free to press the like button on the right side if you liked my attempts to help :-)
And please mark posts as solved if you think I found the solution or set you on its path. Thanks!
Follow me on Twitter: @mdwrim
Developer
Posts: 828
Registered: ‎10-16-2012
My Device: Red Z10
My Carrier: Rogers

Re: How to set background image into TextField in Cascade (Custom Field) ?

Then if you set the background of the textArea to transparent

background: Color.Transparent

 it will show through to the image behind

Highlighted
Retired
Posts: 571
Registered: ‎06-25-2010
My Device: Z10
My Carrier: Vodafone

Re: How to set background image into TextField in Cascade (Custom Field) ?

[ Edited ]

Like this in fact:

 

import bb.cascades 1.2
NavigationPane {
    id: nav

    Page {

        Container {

            Container {
                layout: DockLayout {

                }
                ImageView {
                    imageSource: "asset:///images/chicken.png"
                }
                TextField {
                    id: txt
                    text: "Hello"
                    backgroundVisible: false
                    verticalAlignment: VerticalAlignment.Center
                    textStyle.fontSize: FontSize.Large
                }
            }
        }
    }
}

 

IMG_00000030.png

 

--------------------------------------------------------------------------------------------
Feel free to press the like button on the right side if you liked my attempts to help :-)
And please mark posts as solved if you think I found the solution or set you on its path. Thanks!
Follow me on Twitter: @mdwrim
Developer
Posts: 692
Registered: ‎08-09-2010
My Device: Not Specified

Re: How to set background image into TextField in Cascade (Custom Field) ?

How to set hint text color??

Developer
Posts: 828
Registered: ‎10-16-2012
My Device: Red Z10
My Carrier: Rogers

Re: How to set background image into TextField in Cascade (Custom Field) ?

create you're own label that stays in line with the text area... also do this to change the hint text size

Developer
Posts: 692
Registered: ‎08-09-2010
My Device: Not Specified

Re: How to set background image into TextField in Cascade (Custom Field) ?

Hi,

I already create custom text field as per above example but i not change hint text color.

Any one know how to change hint text color??
Developer
Posts: 828
Registered: ‎10-16-2012
My Device: Red Z10
My Carrier: Rogers

Re: How to set background image into TextField in Cascade (Custom Field) ?

[ Edited ]

You cannot change hint text color or size

 

to do this you must create another label and position it above your current label adjusting the opacity will give it a "hintText" appearance