Programming Techniques

Bill Norris

Active Member
Licensed User
Longtime User
This is not a request for help with an issue, just a solicitation for thoughts. I've been a VB for a long time, and I've pretty much always designed forms with hard-coded controls. All of the B4A programming I've done to date, I've done the same way with the designer and abstract designer. So many of the code samples I see here, particularly from the high-level people, most views are added dynamically at run-time. Why is that approach so commonplace, and am I missing out on something by not following (learning) to write programs in a similar manner.
 

ssg

Well-Known Member
Licensed User
Longtime User
One reason is that you can make your controls / views dynamic is size, making it fit any screen size (using %x and %y). Designing by hardcode as you mentioned would require you to create many layout files, and yet you could miss some new layout format that show up.

Just my $0.02...
 
Upvote 0

nfordbscndrd

Well-Known Member
Licensed User
Longtime User
I've been a VB for a long time, and I've pretty much always designed forms with hard-coded controls. All of the B4A programming I've done to date, I've done the same way with the designer and abstract designer. So many of the code samples I see here, particularly from the high-level people, most views are added dynamically at run-time. Why is that approach so commonplace...

It depends on the app. One with relatively views (or at least few different types of views, such as a few arrays) can create them on the fly in code, but for those with many dozens of different views in complex layouts, it would be almost impossible to create them on the fly.

In such complex apps, I create the layouts in Designer and then fine-tune the layouts in code to make them fit any screen size, as explained on this Wiki page.
 
Upvote 0
Top