EditText (how to use)

wheretheidivides

Active Member
Licensed User
Longtime User
Ok, I can not seem to get edittext to work.

=============================================
sub globals
Dim Button1500a As Button
Dim EditText1502a As EditText

sub activty create
EditText1502a.Initialize("test")

Sub Button1500a_Click
EditText1502a.text = ""

=============================================
So I created a layout with 1 panel full of edittexts. One of them is 'EditText1502a". I dim it, then initilize it. On the page is a button "1500a_click" so when you click on the button it is supposed to clear "edittext1502a". So what am I doing wrong?
1) i thought by initializing it with "test" that it woul dhave that text in there. It does not
2) I though EditText1502a.text = "" or EditText1502a.text = " " would clear out the edittxt box. It does not. So what am I missing?

=====================================
BTW: after 2 years ago of buying this program, the instructions still suck. When are you all going to get a company to write a book on how to program with it? The forems and PDF are too advanced for the rest of us. Remember that the B in BASIC stands for Beginners.

Thanks
 
Last edited:

Roger Garstang

Well-Known Member
Licensed User
Longtime User
Code doesn't look complete. Missing End Subs, and the panel you mention isn't defined there, so I'm guessing you made it in the designer in which case the Initialize isn't needed. Only dim the view names you need to access the text attributes, etc then set the text like you are doing. Control/view names are confusing, but other than the stuff above you are close...assuming you have a layout in the designer that is loaded. Initialize sets the Event Prefix, not the text.
 
Upvote 0

wheretheidivides

Active Member
Licensed User
Longtime User
roger, I didn't want to send out 5000 lines of code. What my questions is 'is this how you clear out a edittext box?". I did use the designer but whenever I ran the program it would give and error that it needed to be initialized (on my cell phone) whenever I pressed the button to clear out the box. So if someone could lok at the code and just tell me how to clear a textedit box or even put info in one. thanks
 
Upvote 0

NJDude

Expert
Licensed User
Longtime User
Ok, this is your problem:

First:

You have:
B4X:
EditText1502a.Initialize("test")

It should be:
B4X:
EditText1502a.Initialize("EditText1502a")

Second:

If you create layouts using the designer you DO NOT have to initialize the views, just CREATE MEMBERS (to do that, in the designer click on Tools -> Create Members)

Third:
BTW: after 2 years ago of buying this program, the instructions still suck. When are you all going to get a company to write a book on how to program with it? The forems and PDF are too advanced for the rest of us. Remember that the B in BASIC stands for Beginners.

There are plenty of examples and plenty of documentation, so, if you have any problems instead of just saying "this sucks" you should nicely ask a question and I assure you that more that one member of the forums will be more than happy to answer your questions.
 
Upvote 0

Roger Garstang

Well-Known Member
Licensed User
Longtime User
I know what the question is, and your way of using EditView.Text = "" is correct. If the Edit Box is defined in the Designer though it isn't needed to be Initialized in code. I think you may have View Names and Event Prefix Names Mixed up.

In your question you have a Sub Button1500a_Click, but below that you say you have a button called "1500a_click". The names are not very descriptive, but if they are exactly how you put it they look incorrect. With 5000 lines of code and being here longer than me I'd assume you know the basics, but:

Lets say your button is called 1500a in the designer and your Edit Box is called 1502a. B4a usually defaults to Event Prefixes with the same names as the views, so unless you changed them the click event for your button would be 1500a_click. For example's sake we will assume those are the only two controls. To access the edit box you need to dim it in Sub Globals as- Dim 1502a As EditText. Then in the 1500a_click Sub you 1502a.Text = "". I don't know the limits on variables starting with a number or if they need a char first like some languages, but this should get you going.
 
Upvote 0

wheretheidivides

Active Member
Licensed User
Longtime User
Sorry about the sucks comment, but still.......The documentation is too advanced. What needs to be done is someone needs to goto amazon.com and look up visual basic. Look to see who publishes the books. Call them up and see if the author would do a version for basic4android. They will.
 
Upvote 0

Roger Garstang

Well-Known Member
Licensed User
Longtime User
It is confusing, and while I wouldn't go as far as saying the docs suck, they do need some tweaking. I bought the software a few months ago and never even used it until this last week. I read every page of both documents and multiple threads here and finally understand most of it. The documents do have a lot of spelling issues and sometimes say one thing when the code mentions another (ex. Paragraph will say a value is set to 10 and the code has it set to 20, or the code may use a wrong command or describe a behavior incorrectly).

One thing that could improve things is a Word Document we can edit and possibly send back or a more Wiki-Like documentation we can correct and add to. I know in reading all the pages I would have been fine correcting things as I went. I do have a basic understanding now although there is still a lot missing or online only. I also couldn't get what I wanted out of the designer variants, so code my views by hand.
 
Upvote 0

evilpaw

Member
Licensed User
Longtime User
just be glad there is doco

Ok, I can not seem to get edittext to work.

BTW: after 2 years ago of buying this program, the instructions still suck. When are you all going to get a company to write a book on how to program with it? The forems and PDF are too advanced for the rest of us. Remember that the B in BASIC stands for Beginners.

Thanks

1. Use the search function on this forum and read
2. as mentioned above, ask a question nicely and help will be on your way.
3. Learn the theory of programming. Understanding the basic concepts, it will help you understand the documentation provided.

Please dont say doco sucks. Just be glad there is doco. U just need to read it, understand it, and apply it.
 
Upvote 0

klaus

Expert
Licensed User
Longtime User
@wheretheidivides
The forums and PDF are too advanced for the rest of us. Remember that the B in BASIC stands for Beginners.
What are you missing in the Beginner's Guide and the Documentation Wiki?
In the first post in the thread of the Beginner's Guide you are invited to improve the document:
All suggestions, remarks and typo reports are welcome.
So, please make your suggestions on what you are missing, what you didn't understand etc.

@Roger Garstang
The documents do have a lot of spelling issues and sometimes say one thing when the code mentions another (ex. Paragraph will say a value is set to 10 and the code has it set to 20, or the code may use a wrong command or describe a behavior incorrectly).
It would be nice if you reported errors, typos and suggestions.

We need also your help to improve the documentation.

Best regards.
 
Upvote 0
Top