Android Question GUI creation without using layout designer

The aim of this thread is to allow visually impaired B4A developers to code without depending on visual layout designer. In other words, how to create GUi elements and how to react on some events related to them without adding GUi elements by using layout visual designer. Visual designer would be only used minimally to allow compiled app to function.
 
Solution
To upload your project, you should use the link in the B4XNainPage to zip the whole project
I AM very sorry. I will never upload only some files of A whole project.

Here is whole .zip project tree generated by The IDE function which you have recommeded to use.
I have wanted to save server storage space of yours forum. So I have only uploaded some files. It is good, that it is possible to upload whole projects, because core developers can easily assist with The problems.
To upload your project, you should use the link in the B4XNainPage to zip the whole project
I AM very sorry. I will never upload only some files of A whole project.

Here is whole .zip project tree generated by The IDE function which you have recommeded to use.
I have wanted to save server storage space of yours forum. So I have only uploaded some files. It is good, that it is possible to upload whole projects, because core developers can easily assist with The problems.
 

Attachments

  • Example.zip
    10.6 KB · Views: 122
Upvote 0
Solution

cup319

Member
I AM very sorry. I will never upload only some files of A whole project.

Here is whole .zip project tree generated by The IDE function which you have recommeded to use.
I have wanted to save server storage space of yours forum. So I have only uploaded some files. It is good, that it is possible to upload whole projects, because core developers can easily assist with The problems.


Private Sub B4XPage_Created (Root1 As B4XView)
Log("MainPage Create")

Root = Root1
Root.LoadLayout("MainPage")

Page1.Initialize 'initializes Page1
B4XPages.AddPage("Page 1", Page1) 'adds Page1 to the B4XPages list


For l = 0 To 9
Dim buttons(10) As Button
buttons(l).Initialize("Buttons")
Root.Addview(buttons(l),0, l*0.1*Root.Width, l*0.1*Root.Width, 0.1*Root.Height)

buttons(l).Text =l
Log(buttons)
Next


End Sub
 
Upvote 0
Dear cup319,
It is more than a wonderful example. Very well done. I will try it with a screen reader by adding bigger cycle values for example 50 what Android accessibility Suite Talkback will report when swiping. But I Am wondering about your approach because of a very important fact. That it is clear, that It is really not necessary to specify object position values by using DIP numbers. I will test it and I have a last plea to you, dear MR cup319.
Could you also add little code which would react on some button click so show message could for example display "you have clicked on button number", variable name
After that, I will be finally able to build my loving preverb test. I have 45 Czech preverbs and it is necessary to complete The end of every incomplete preverb. I will be very happy because B4A generates a very¨memory efficient app which can run even on my old Samsung GT-B5330 with 160 MB free RAM because the Talkback screen reader and Espeak speech engine allocate for example 50 or more MB of RAM. So thank you again and I Am telling you. Very well done and thank you. I have given it up working with B4A because I have thought, that without position values of objects I will be lost forever. But thanks to your useful programmers' tip, I will return to B4A back.
 
Upvote 0

AnandGupta

Expert
Licensed User
Longtime User
Hi Janusz Chmiel

See the line
B4X:
buttons(l).Initialize("Buttons")

This means you can use a sub like below for buttons click. You may also need to set the tag property after adding the view
B4X:
sub Buttons_Click(object..
msgbox..
end sub
 
Upvote 0
I know, that I Am not very smart. But I Am still new to B4A. Could you send The whole functioning zipped project please? So I could import it and compile it? I AM only hoping, that yours approach will work with B4A. I Am also fightighting with new B4A feature, that debugger of B4A is enabled. I have liked older B4A installation package, where B4A projects could be installed to The device and app did not anticipate, that B4A debugger will be used. Sure, I know, that todays default choice is good for developers who would like to debug and monitor variables. Thank you very much. I want to code preverbs and if you will send A functioning project, I will be finally able to move on. Because I have spent many time when I have tried to solve editbox issue. Thank you very much for yours patience and time.
 
Upvote 0
I AM sending my attempt. Unfortunately, I have constructed The code by The wrong way. Because code automatically pause on line 21 according to Debug feature. And I Am publicly congratulating B4A core programmers for this feature, because it is available even for visually impaired developers thanks to The fact, that debug info is accessible with screen readers.
 

Attachments

  • Example.zip
    9.9 KB · Views: 96
Upvote 0
OK, so I will go by using other way. I will abandon my Autohotkey for Windows approach consisted of creating 45 editable fields. I would had to create tags and monitor event for every of those editable fields. And I do not see so many GUi elements will always create chaos with Android core. So I will use better way of coding. What do I need? Simple text message fill out The rests of The following preverbs.
Second GUi element.
Listwiev with 45 items. So one Listview with 45 items.
Thirt GUi element.
Editbox with hint text enter The right answer.
Last GUI element, button with text evaluate.
To make app more universal.
Some command to open The ASCII text file located in Assets folder. Ideal command would be command, which can read files sequentially similar like Line Input command or Readln () procedure of Pascal.
So what I can do? I must really avoid to use build in GUI designer. I will try to code from scratch.
 
Upvote 0

cup319

Member
Dear cup319,
It is more than a wonderful example. Very well done. I will try it with a screen reader by adding bigger cycle values for example 50 what Android accessibility Suite Talkback will report when swiping. But I Am wondering about your approach because of a very important fact. That it is clear, that It is really not necessary to specify object position values by using DIP numbers. I will test it and I have a last plea to you, dear MR cup319.
Could you also add little code which would react on some button click so show message could for example display "you have clicked on button number", variable name
After that, I will be finally able to build my loving preverb test. I have 45 Czech preverbs and it is necessary to complete The end of every incomplete preverb. I will be very happy because B4A generates a very¨memory efficient app which can run even on my old Samsung GT-B5330 with 160 MB free RAM because the Talkback screen reader and Espeak speech engine allocate for example 50 or more MB of RAM. So thank you again and I Am telling you. Very well done and thank you. I have given it up working with B4A because I have thought, that without position values of objects I will be lost forever. But thanks to your useful programmers' tip, I will return to B4A back.



Private Sub buttons_click
Private btn As Button
btn = Sender
Log( btn.text &"|"&btn.Tag)
Main.xxxx=btn.Tag 'from the mainpage sub process_Globals
B4XPages.ShowPage("PlayerPage")

End Sub
 
Upvote 0
OK, I will try to add my wanted GUI elements by using GUI designer. Then I will have to declare The GUI elements. If I will use three or four GUI elements it will never cause issues. And GUI element name is spoken by NVDA screen reader.
 
Upvote 0
I have found very useful information in The following thread.
There was even example on A page 2 which did not used GUI designer. There is even click procedure to detect which list item have been clicked. I have also finally found The add by layout code in The users guide. It is even possible to code with no .bal file at all. So sighted majority can code with GUI designer and I can finally focus on my algorithm.
 
Upvote 0
Top