Android Question Newbie Designer question

tseyfarth

Member
Licensed User
Longtime User
Hello all,

I am brand new to this environment, please forgive the simplicity of this question. Within the Designer, I added several buttons. For some reason, I cannot get the Text to change. I have set several as 1, then 2, then 3, but the text never changes from the default button name to the text selected. Can anyone tell me what am I missing and/or point me to a tutorial on the subject? I have viewed several tutorials and docs already, and searched this forum without finding a clear answer.

Thank you in advance,
Tim
 

udg

Expert
Licensed User
Longtime User
Hi,

each object you add has a Name (e.g. Button1, Button2..) and several properties (e.g. Text, Tag, Visible,..).
You use the Name to refer the object in your code and the properties to "configure" it.
So Button1.Text="SAVE" has the effect of showing the string "SAVE" on a button whose Name is Button1.

Another important point for your first steps with this fantastic development tool is EventName. That one is the name prefix for any event related to the object at hand (it defaults to same value as Name, but you can change it).

That said, I urge you to carefully read Klaus' "Beginner's Guide". It is a must read for any newcomer to B4A, believe me.

udg
 
Upvote 0

tseyfarth

Member
Licensed User
Longtime User
Hi,

each object you add has a Name (e.g. Button1, Button2..) and several properties (e.g. Text, Tag, Visible,..).
You use the Name to refer the object in your code and the properties to "configure" it.
So Button1.Text="SAVE" has the effect of showing the string "SAVE" on a button whose Name is Button1.

Another important point for your first steps with this fantastic development tool is EventName. That one is the name prefix for any event related to the object at hand (it defaults to same value as Name, but you can change it).

That said, I urge you to carefully read Klaus' "Beginner's Guide". It is a must read for any newcomer to B4A, believe me.

udg

Thank you for you response.

I will read the guide - thank you.
I also noticed you used quotes. Are they necessary even in the designer? That would be a bit unique.
Thank you again!
Tim
 
Upvote 0

KMatle

Expert
Licensed User
Longtime User
Additional:

Button1.text="First Button"
Button2.text="Second Button"

Quotes are for literals like "my text", "your text".

You could post your project (or code) here. We will have a look. Use code tags in the editor then.
 
Upvote 0

tseyfarth

Member
Licensed User
Longtime User
Hi,

I had not even gotten to code yet. Just purely in the designer. See the picture attached. I had expected that a change in the "Text" property of the designer, would change the button text. It does not.

Tim



b4a designer.jpg
 
Upvote 0

CidTek

Active Member
Licensed User
Longtime User
The designer shows the name of the control which makes more sense when you are going back and forth with the designer scripts since you refer to a control (view) by its name not its text or caption.
 
Upvote 0

tseyfarth

Member
Licensed User
Longtime User
Does the text that is provided, get transferred to the code? If so where, and if not where do I add it.
One more, is this kind of stuff all covered in the users guid/beginners guide? I briefed them but have not really delved into them as will likely be necessary.
Tim
 
Upvote 0

KMatle

Expert
Licensed User
Longtime User
In the designer you DRAW your buttons, etc. (all items are called "views").

Take a look in the code b4a shows at the start. Loadlayout will LOAD the layout you have drawn with the designer (you have named it "12key").

By loading it (program) b4a loads that layout and everything is displayed like you show it in the pic (inclusive texts).

If you want to read the text:

a=btn1.text or log(btn1.text)

If you want to change it @runtime:

btn1.text="the new texts"

Hint: You will have to understand how b4a works and how objects (views) are used.

Here is a nice video:

 
Upvote 0

klaus

Expert
Licensed User
Longtime User
If you want to see the texts.
Connect your device with USB or B4ABridge.
In the Designer menu Tools / Connect To Device / Emulator connect the device to the Designer and you will see your layout on the device with the text, images etc.
You can move the view like in the Abstract Designer.
 
Upvote 0

tseyfarth

Member
Licensed User
Longtime User
That tutorial told the whole story. Lots to learn yet. Many similarities with other IDE's/languages but some nuances just the same. Overall first impression -NICE! VERY NICE!

Thank you all again!
Tim
 
Upvote 0
Top