How to Insert (not set) a value into a text box/label using blocks
Im creating an app that has a number of buttons, and when these buttons are clicked I want the value to be added to a text box/label (That can then be sent as a text) - Basically instead of typing a text you click the pre-written words as a button to put them into a text.
However In the blocks editor I can only set the value of the button, to the text box. So It only contains one value, and if another is clicked it simply replaces it.
How do I go about inserting a value 开发者_运维技巧into a text box/label using the blocks editor?
Thanks.
[EDIT] I've figured out a way to do it if anyone else had similar problems, you use the blocks:
when button click > set MYtextbox.text to > (Join block from text menu) > MYtextbox.text (Join) MYbutton.text
-Please changed this to solved.
I'm not familiar with blocks editor, but in java I would write the following, maybe it will help you:
yourTextView.setText(yourTextView.getText() + " " + newText);
It is easy. There is the "join" block in the basic text blocks drawer. When you are adding text to a text box that already has text, for example Textbox1 then you should assemble the blocks as Textbox1 join Label1. It is very similar to what we say in visual basic, for example Textbox1 = Textbox1 & Label1 or whatever.
You can also use maketext block. When you use this block set Textbox1 to maketext block. First insert Textbox1 block in the first socket and add new text with basic text block to the ensuing sockets.
精彩评论