← Back to team overview

ubuntu-phone team mailing list archive

Re: [Bug?] Impossible to set focus to a TextField in the header

 

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hey Riccardo,

You can make it work by moving the focus to the Page:

Component.onCompleted: pageFocus.forceActiveFocus()

I think at the point you're pushing the page the header contents
aren't in place yet so focus can't apply yet.

ciao,
    Christian

On 10.05.2015 23:57, Riccardo Padovani wrote:
> Hi, I'm having troubles setting focus to a TextField in the header
> of a Page.
> 
> I produced a little example you can find attached. If you run it,
> you'll have a TextField in the page with focus set correctly, but
> if you decomment
> 
> //contents: searchInput
> 
> in the head and remove
> 
> anchors.top: searchInput.bottom
> 
> from the Rectangle (I added it only to have a better contrast and
> see where is the TextField) you'll have a TextField in the head,
> console says focus is true, but you can't type in the TextField
> without clicking on it before.
> 
> Any idea?
> 
> Regards, R.
> 
> 
> 
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1

iQIcBAEBAgAGBQJVUCZ+AAoJEM375q7xpO2DpDAP/jQOvChKzU7b71zrbcNuqN9d
DD8OlZrPqePkaK23gfMCbi0HDnRtlunhaWQHOXlYWY3fmBT3P0mrE+k5ifCoEInK
cJ+F5pof4EtAvYh0eOsPbcmKw1sxoICXu63X9SrdlfxFxqNMB2/r2hDxDsLR1U0C
Rrb5gxR9k6Gvopq5iaD4moLh8iUB2IyXT0FGfh2pH4n7LEDEVOYe/QpXxZHQkJlJ
nggWI/0JPNYsTkqe48xqHxSHpSmGeGCFCBtYu+Os2NEgDLsco14bjruCsnHvL7QL
3uxlpCSrSAWSx06KxesDxAtRxAy1HrHqwjVYGfXShT2yADa81AkwR5tWSO/5b/9O
iYwk1HwVE9WhFYYvf2dO8nOoto8PumZ+LoCXl9xGEvuUdS4gk8ev2OL4DPkYD5EJ
KPsEGa0KendwkaP2AYR5fqlvbv5r1H7uCIGjcP+MAV+EvFYluR5HdhKlOYVrBqET
Y/N+JwTJukvzx6P/z+o4CrHcEMDda5OxzgPKgnqzsb7imPjy6pAhnW+TRZ1u8jqv
g5hzNNyBldyze3DNQvMd+Nku+W2ojBUHu6E4Njg7gnQPUGWyp7KZH5gVP5IdJNRL
MgGjAaBXY3DWUFYNvaZAZH4sBeZ+P7lwYy2C0L8DHQyxPIXDdpy+zSPRQRFkj5NZ
DHyKxs5LaPlHtT0iFeiH
=OPSG
-----END PGP SIGNATURE-----


Follow ups

References