ubuntu-phone team mailing list archive
-
ubuntu-phone team
-
Mailing list archive
-
Message #12721
Re: [Bug?] Impossible to set focus to a TextField in the header
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
I merely moved the forceActiveFocus call to the Component.onCompleted
handler of the Page. But see attached the whole test with the change.
ciao,
Christian
On 11.05.2015 23:42, Riccardo Padovani wrote:
> Christian Dywan <christian.dywan@xxxxxxxxxxxxx> wrote:
>> Hey Riccardo,
>
>> You can make it work by moving the focus to the Page:
>
>> Component.onCompleted: pageFocus.forceActiveFocus()
>
>
> Hi Christian, thanks for your fast reply.
>
> Unfortunately, I'm not able to have it working. I'm currently on
> vivid.
>
> Could you please provide an example (maybe based on my code)? I'm
> sure I'm missing something very simple, but I don't understand
> what...
>
> Thanks so much! R.
>
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1
iQIcBAEBAgAGBQJVUdkxAAoJEM375q7xpO2DXTMQAJIGA2pcONBc4y91o+Ors0LN
NxYGw5DHqMdanQMSc2cG3uGOGtQahIuKZFjKX/emdZe7ymalPklaSS+G+Aq96xZe
H8o9e2O5PsSPZpNhGjhbp48+Tvxt7rt97rP2wgIPySuubodShgUYe8WVyGs2BMQs
Uh1PMmyUaD5/9uOgRC0mG/o0SRRUtsvHSdx3owxOdKHLhP0PorPgJuGutVJ/+9nQ
Ablfh1BQ43qKE40yVkjzCRYD7lxj0fZzVyD03/w+t3CzOtuVzbRHP0+aNn8wXfGA
/cg1mvzcAFLos9Tw6Z8CRPbUFPMki6zL2AWWJp5i2wZs8rBcGF+ZNGzVQM49afsX
ijdj6dOumbxcTFN+FM5N0ZWXNjhpiBDS0zIrHoO1ow8uVQxjZdi4H0nuJ+L0L60U
aDeR02lSWU97wUW4/eUAgk1u/ZT5ZutfNFLkOV6yAKgFlDlQy4ACCowOtQ+svqpc
lWrxeoqdga2Q9Mkn6ZW3SNNInGWX1Rcu65xGE06Sj07K4AZdOCmY/pTJQVWrglYz
2zNGg3XJYD1S6U9WWX8oBEI+L5nlvScSHHRR1UFQCF6kW660g1CekR0KBcV/Isnc
i8ZYaJZ4EcMIt7vIIeCS/SIglNRzJQbKAAu2pX2xD3rBb3Lm2ODUTVrWmDrEBavT
fC8Wbz+y+yrQSoxYKGkz
=qV2q
-----END PGP SIGNATURE-----
import QtQuick 2.3
import Ubuntu.Components 1.1
MainView {
applicationName: "com.rpadovani.wrongFocus"
useDeprecatedToolbar: false
width: units.gu(50); height: units.gu(75)
PageStack {
id: pagestack
Component.onCompleted:{
pagestack.push(pageFocus)
//pageFocus.forceActiveFocus();
}
}
Page {
id: pageFocus
focus: true; title: 'f'
Component.onCompleted:pageFocus.forceActiveFocus()
onVisibleChanged: searchInput.forceActiveFocus();
head {
contents: searchInput
backAction: Action {iconName: "close"; onTriggered: pagestack.pop()}
}
TextField {
id: searchInput
anchors {left: parent.left; right: parent.right}
onFocusChanged: console.log('textfield focus:' + focus)
}
Rectangle {color: "red"; height: 100; width: 100; /*anchors.top: searchInput.bottom*/}
}
}
References