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: 385
Registered: ‎07-20-2012
My Device: Blackberry Z10 (White), BlackBerry Dev Alpha C
My Carrier: O2 UK

Implementing buttons to be used for a text area

Hello, 

 

I am currently looking into a way to have buttons displayed on the screen, that when the user presses them: the specific key of that button goes into the text area. 

 

As we have seen with both Web Design Cheat Sheet (WDCS) and QuickPost, they have buttons that - when pressed - go into the text area above them. 

 

What I would like to do is to have a button for: 

  • -
  • 1 (which then could change to 2 - after the user has selected 1)
  • (
  • )

Hopefully you can understand what I mean Smiley Happy

 

Thanks in advance 

Developer
Posts: 275
Registered: ‎02-05-2010
My Device: Blackberry Z10
My Carrier: Bouygues Telecom

Re: Implementing buttons to be used for a text area

No we don't understand !

Well, I don't

Twitter : @LaurentKP
My apps
Developer
Posts: 385
Registered: ‎07-20-2012
My Device: Blackberry Z10 (White), BlackBerry Dev Alpha C
My Carrier: O2 UK

Re: Implementing buttons to be used for a text area

[ Edited ]

Hi Laurent, 

 

Thanks for replying. 

As you can see in the image below, the two buttons - that I have put a red circle around - is what I am looking to recreate in my application. So when the button is pressed it appears in the text area above. 

 

QuickPost.png

 

For example, if you were to click on the hashtag (#) button, a hashtag would appear in the text area. 

 

Do you know how to do this?

 

Thanks Smiley Happy 

Developer
Posts: 275
Registered: ‎02-05-2010
My Device: Blackberry Z10
My Carrier: Bouygues Telecom

Re: Implementing buttons to be used for a text area

Sorry but I think you put the wrong image.

 

If you want to add text to a textarea on a button click, it's easy but I don't think it's what you want.

Maybe you want to add buttons inside a TextArea ?

Twitter : @LaurentKP
My apps
Developer
Posts: 385
Registered: ‎07-20-2012
My Device: Blackberry Z10 (White), BlackBerry Dev Alpha C
My Carrier: O2 UK

Re: Implementing buttons to be used for a text area

[ Edited ]

Hi Laurent,

That is the correct image: showing two buttons with different keys in them; one shows: # and the other shows: @

You are right, what I want to do is to create buttons - like in the image - and then when they are clicked the text goes into the textarea.

Developer
Posts: 275
Registered: ‎02-05-2010
My Device: Blackberry Z10
My Carrier: Bouygues Telecom

Re: Implementing buttons to be used for a text area

So you just have to update your textarea on the button onchange signal.
Twitter : @LaurentKP
My apps
Developer
Posts: 385
Registered: ‎07-20-2012
My Device: Blackberry Z10 (White), BlackBerry Dev Alpha C
My Carrier: O2 UK

Re: Implementing buttons to be used for a text area

Okay Smiley Happy

How would I go about doing that?
Developer
Posts: 6,152
Registered: ‎07-05-2012
My Device: Playbook, Dev Alpha C, Z10 LE, Z30
My Carrier: Orange

Re: Implementing buttons to be used for a text area

I think @laurentc meant the button's onClicked() signal, within that slot you would possibly query the cursor position of the TextArea control and then use the Editor insertPlainText() function to insert the # character...

 

http://developer.blackberry.com/native/reference/cascades/bb__cascades__texteditor.html#function-ins...


If you've been helped click on Like Button, if you've been saved buy the app. Smiley Happy

Developer of stokLocker, Sympatico and Super Sentences.
Developer
Posts: 385
Registered: ‎07-20-2012
My Device: Blackberry Z10 (White), BlackBerry Dev Alpha C
My Carrier: O2 UK

Re: Implementing buttons to be used for a text area

Hi BBSJdev,

I have read through the documentation that you linked to, but I still don't fully understand how to query the cursor position and then use the insertPlainText(); could you elaborate a little further please? Smiley Happy