My three wishes

clinst

Member
Licensed User
Longtime User
Just bought Basic4Android and I am very impressed. After using the demo and now the full version for a short while I have a few suggestions/enquires but before I get to that, a little background.

I have a lot of experience of VBA and VBScript, a reasonable experience in .Net and a few courses in C type languages. First of I have to say, I hate C syntax in all its many forms. I just can't get my head to understand it the way I can VB. Don't get me wrong, I've tried to learn Java and Eclipse but no matter how long or hard I've tried my brain just keeps complaining. So finding B4A was a blessing since app development was one of the reason I went for an Android device.

All that said I do have some ideas for additions to B4A.
1) More logical / easier addressing of views in layouts.
Say I have a layout "main" with some buttons, labels, edittexts and panels. Currently if thats all I have I can addess these views either by name or by iterating. Now say I load a layout into one of the panels in the layout. Now I have to iterate through the views to get the panel and then iterate through its views to get the view I want.
Instead, would it be possible to do something like:

Activity.Layout("main").Views(Panel,"pnlTest").Views(Label,"lblHello").text = "Hello"

More generically
Activity.Layout(<name>).Views(<type>,<name>).....

I admit this might just be my brain wanting things to be more logical but even so I think it would make things a lot easier for people, especially newcomers.

2) The ability to save layouts so they can be added as views to another layout.
The best example of this is the up down numeric add on. It consists of two buttons one for increase and the other decrease with a textbox to show the number. Currently its all done in code to add the threee views with no option to see it in the designer. If you could save a layout as, to borrow from VB, a 'control' and then add this in like adding a library it would be great for the people who make these libraries and add ins as well and anyone whating to create special views for their own programs.

3) Access to more properties of views.
Currently there is no way of finding the name of a view in code or its parent, which would be useful if iterating through views

Look forward to hearing what people think and many productive years with B4A. I've already starting trying to convince a friend to have a look, since his company moved away from app developement due to the lack of quality tools. Fingers crossed :)
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
Welcome to B4A.

Now I have to iterate through the views to get the panel and then iterate through its views to get the view I want.
Why? You can reference it directly. Right click on the view in the abstract designer and choose Generate -> Dim ...

2) You can use classes for that. There are several examples in the forum (though currently you cannot do it with the designer).

3) Views do not really have names. You can use a single variable to create many views.
 

clinst

Member
Licensed User
Longtime User
Re

Sorry, I didn't explain myself very well for 1)

I am currently adding a number of layouts to a panel based on a dynamic counter. So I might add 2 one time and then add 4 another. With the addressing structure I suggested it would be simple to address the view; on the layout; on the panel I'm interested in.

Where as now, since I can't change the name of a view in code, I can only iterate to find the view I want. And even then I can't look for a name I have to look for type and then text or if it doesn't have text possible its tag to identify the view.

Or maybe I'm missing something obvious :)
 

clinst

Member
Licensed User
Longtime User
Re

For 2)
Being able to do it in the designer is kind of the point I was trying to make. Being able to add in 'controls' in the same way as libraries, just ticking a file as being included, would make life a lot easier.

The ability to copy a arrangement of views from one layout to another would save a lot of time and giving the people who create libraries to provide a visual placeholder which could be resized like the core views in the designer would enhance the ease of use of B4A a lot.
 

clinst

Member
Licensed User
Longtime User
I'm assuming from your answer to the addressing views suggestion (number 1) that it wouldn't be possible to introduce this.

I assumed that since the info is all held in the designer it would be possible to hold a collection in memory to allow the addressing structure to work.

So if I have the following structure:-
Layout("main")
---Label1
---Label2
---EditText1
---EditText2
---Panel1
------Label1
------Label2
------Button1
------Panel1
---------Label1 <------ This one

Using my suggestion Label1 would be addressed via
Layout("main").views(panel,"Panel1").views(panel," Panel1").views(label,"Label1").text = "Hello"

Where as currently I'm not even sure how to address Label1 directly, especially if I had added it at runtime rather than via the designer.
 

Roger Garstang

Well-Known Member
Licensed User
Longtime User
By the looks of it you seem to prefer make views in code, or at the very least what you want to do would be easier by code. Some of the same things you want I also wanted. I originally made a Class to do it I called View Manager with full source posted in here. It uses a Map of Names to store views and keeps track of a sort of Tab Order. I even made a custom Spinner control to store values different/better than Android's default does and have some State Management to restore view data on rotate, etc.

Now that I'm better at Java I've also made a Library called Relative Layout. It is in early stages but is doing things the same way as the class and also stores views by Name for easy access. Once I finish some state management for it then it will be the same as the class plus some since it can position/size controls relative to each other in an auto-expanding scroll view.
 

clinst

Member
Licensed User
Longtime User
Erel
The no name thing lead me to 3) above, but I'm starting to understand how B4A 'thinks' about these things so I'll work away and see how I do. :sign0089:

Roger
Thanks for the heads up. I'll take a look at the class and keep an look out for the library. Its not so much I like to do things in code but I'm so used to the hierarchical way VB .net deals with controls I was hoping something like that could be done in B4A.
It just easier not to have to handle list/maps/collections of references to views myself and leave that to the compiler/IDE like visual studio.
Since I know very little about how Java handles these things I'm not totally sure my suggestion even makes sense in Java's terms :)
 
Top