[SailfishDevel] TextArea | Using EnterKey.onClicked

Nicolas Cisco ncis20 at gmail.com
Sat Feb 7 18:37:30 UTC 2015


Yes, i tried the text.substr(0, text.length-1). In my first mail, i wrote
why doesn't wok:
"I though of striping the enterkey by hand in the callback like
`textArea.text = textArea.text.slice(0, -1)`, but, the problem is that if
you are not in the end of the input this doesn't work." (text.substr(0,
text.lenght-1) does bassically the same as text.slice(0, -1) ).

I don't think that multiline support is critical. The problem of changing
TextArea to a TextField, is that when writing long texts, altought you are
writing only one line, TextArea expands in a multilineal way, which is
easier to edit, while TextField mantains the widget size and the text moves.

I remember that Mitakuuluu2 [1] [2] app had a nice conversation input. A
widget that expands in a multilineal way with a custom enter action. I had
a glance at the code, and i find it very hard to understand (i'm a
begginner at qml). I'll try to reuse that code, any help on understand it
will be appreciated =).

Thanks!

[1]
https://github.com/CODeRUS/mitakuuluu2/blob/master/client/qml/EmojiTextArea.qml
[2]
https://github.com/CODeRUS/mitakuuluu2/blob/master/client/qml/EmojiTextBase.qml

2015-02-07 4:19 GMT-03:00 Asser Lähdemäki <sailfishmail at denden.pw>:

> Hello,
>
> Did you try text.substr(0, text.lenght-1) to remove the last char?
>
> Also, if the multiline support is important for your UX, perhaps you could
> open a Dialog when the text is clicked, where you could accept the edits
> without EnterKey.
>
> Cheers,
> Asser
>
> ncis20 kirjoitti la helmikuuta 7 08:32:12 2015 GMT+0200:
> > Uhh, that's bad news =(, i'll have to use TextField instead and forget
> of having multineal support.
> > When i said shift+enter, i wasn't refering to actually touching both
> keys at the same time, i was thinking in something like caps lock (like
> entering upper cased letters in the virtual keyboard).  When you hit the
> shift in the virtual keyboard, it sticks and you can input uppercased
> letters without multitouch support. I was wondering if with the enter key
> could be done something similar, i.e. normal enter would trigger the action
> shift+enter (not actually pressing both keys at the same time, but like
> uppercased letters) would input a newline.
> >
> > Thanks for the fast answer, any further infornation about the topic will
> also be thanked =).
> >
> > El vie feb 6 09:13:35 2015 GMT-0300, Pekka Vuorela escribió:
> > > to, 2015-02-05 kello 20:11 -0300, Nicolas Cisco kirjoitti:
> > >
> > >
> > > > I try using the qml Keys api:
> > > >
> > > >
> > > >     TextArea {
> > > >        id: textArea
> > > >        EnterKey.onClicked: console.log("EnterKey.onClicked")
> > > >        Key.onEnterPressed: console.log("Key.onEnterPressed")
> > > >
> > > >        Key.onPressed: console.log("Key.onPressed")
> > > >
> > > >     }
> > >
> > > > But doesn't work, the only signal fired is EnterKey.onClicked.
> > > >
> > > > In addition, my idea is to allow the user to input enters by using
> > > > shift and then the enter key, is there a way in order to achieve
> > > > this?.
> > >
> > > At the moment EnterKey doesn't allow to filter out the click event and
> > > indeed Keys attached property doesn't work on Silica editors. Could
> look
> > > into both, but not sure if that would be too high priority.
> > >
> > > First, the virtual keyboard sends key events only on few cases: enter
> > > and backspace when no word is active (i.e. underlined). Second, shift
> > > modifier is not supported on either. And even if shift would be passed,
> > > that as user interface would require multitouch, which doesn't sound
> > > like a good idea.
> > >
> > >
> > >
> > > _______________________________________________
> > > SailfishOS.org Devel mailing list
> > > To unsubscribe, please send a mail to
> devel-unsubscribe at lists.sailfishos.org
> > >
> >
> > --
> > Enviado desde mi Jolla
> > _______________________________________________
> > SailfishOS.org Devel mailing list
> > To unsubscribe, please send a mail to
> devel-unsubscribe at lists.sailfishos.or
> _______________________________________________
> SailfishOS.org Devel mailing list
> To unsubscribe, please send a mail to
> devel-unsubscribe at lists.sailfishos.org
>



-- 
Nicolas Cisco
www.nckweb.com.ar
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.sailfishos.org/pipermail/devel/attachments/20150207/489b0100/attachment.html>


More information about the Devel mailing list