B4J Question XUI Menu techniques

stevewidget

Member
Licensed User
Hello
Im a newbie at B4X, and am trying to write a cross platform application B4J,A & I that reads data from an Arduino from BT, USB, and then display data modified with alarm levels etc, So I need a simple menuing technique to control a setup page, then 1 or more display pages and save setup data in an .ini type file, with ability to export data, pretty much a regular Windows menu based program. Nut how to do for A and I? Ive seen that there is a library for B4A to handle menu's, but is there a XUI solution. Apologies if a tutorial exists , but couldnt find anything applicable. Something along lines of the Games tutorial with a few examples would be greatly appreciated.
Stevewidg
 

stevewidget

Member
Licensed User

Hi Erel,
thanks for that. I had seen those posts, but only applies to B4A,and I. I would really like a generic approach to use across all platforms. I'm not looking for a complicated menuing structure. Maybe the answer is so obvious (when you know how) but I assume I can use a select button on screen1 to select screen2 ie my setup screen or display screen, or possibly tabs. I couldnt find an example of this, and was unsure if there were any XUI perils to this approach. I currently only have B4J and B4A so cant play with I version yet till I'm clear on approach I can take.
Thanks
Stevewidg
 
Upvote 0

rossati

Active Member
Licensed User
Longtime User
Hello
maybe what I developed to capture data from Arduino can be useful. It is a B4J program that use my library for (de)generate forms and menu.
This library is also available for B4a on my site www.condorinformatique.com along with other software including a dispatcher for Arduino.
Form Generator for B4J is yet in test but for the for the aforementioned program it works.
Best regards.
 

Attachments

  • Seriale.zip
    335.3 KB · Views: 177
Upvote 0

stevewidget

Member
Licensed User
Thanks a lot for that Rosati,
I'm sure there is a lot of good stuff in it I can use. However I do like the idea of using designer, rather than coding menus. I have (had) a fair amount of experience in 'Clunky Basic' (i.e MSbasic on CPM) but havent written anything with a user interface since then , other than on a micro with LCD or small TFT using Proton Basic (for PIC) or Arduino. Always had a programmer to write the UI stuff, so I guess its made me lazy, and approaches have certainly changed since my day. I am struggling to find information, despite the fact there is tons of it, in fact that is the problem, wading through forum posts trying to find something relevant, though I dont know what can be done to improve it.
I am sure (know) that Erel is right about using CustomlistView, but I'm struggling to get my head round it.
My current plan is to use the Login demo in samples folder for B4J as a template. I didnt understand how to change forms till I saw that. The login form becoming select BT/Serial with a selection for setup or display replacing font picker. I hope this approach will be cross platform compatible without too much trouble. Perhaps when Ive got that working and loose my Newbie status I can do it properly as Erel suggests with lots more options.
Until then suggestions gratefully received.
Stevewidg
 
Upvote 0

Harris

Expert
Licensed User
Longtime User
I am sure (know) that Erel is right about using CustomlistView, but I'm struggling to get my head round it.
I know what you mean... I was first intimidated with xCustomListView - mainly due to not understanding how do deal with the (improved) designer.
However, I stuck with it and have found (in very short order) that - xCLV is the best component to ever bless my tool chest - especially for mobile dev (ABM for web).
Like I have said in other posts, I will use xCLV going forward for 95 percent of new design.
I see it on the same level as "Wait For". Game changing - produced from the exceptional genius mind of this product suite.

This makes me ponder... How can a modern office building full of MS designers (software eng.) not hold a candle to one man and his creations?

It is possible that he is drawing on (mind melding) from all of us (very many) in his community?
Stranger things are known to be unknown... like what happened to the advanced civilization before ours - 12,900 years ago?
 
Last edited:
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
It is possible that he is drawing on (mind melding) from all of us (very many) in his community?
Yes, but don't tell anyone.

However, I stuck with it and have found (in very short order)
This is a very important point that happens to all of us. There is always a learning curve involved in learning new stuff. We need to be "brave" and keep on going. Very soon things will look much simpler.

There is a video tutorial about xCustomListView:

 
Upvote 0

stevewidget

Member
Licensed User
Hi Erel,
Yes there is quite a learning curve, I think Ive now reached base camp on my Everest climb!! I have watched ALL of your videos at least once , and they are very helpful. My problem in learning is ................... (ie 'dot') It does so many things and appreciating them all can only be learnt by practice. However I do find samples very helpful ( very minor criticism if I dare , comments are a bit thin, I have to use them to remember why I did something, and thats the way I was taught) and I can see that I can do what I want (almost) with your expanded list view example,
https://www.b4x.com/android/forum/t...t-based-on-xcustomlistview.86449/#post-547401
a modified work in progress version attached (ADD= Arduino Data Display).
There are currently 4 things I dont understand how to do.
1 In expanded panel trying to alter new value collapses view
2. The Load button is supposed to load text in New Val in Expanded view to displaylbl in collapsed view. How do I expose these items to modify?
3 Perhaps partly covered by 2. I need to save all this data in a file for reload.
4 Ideally would like to start with 1 item and add another item with an add and delete button in Expanded view.

Any help on these greatly appreciated

SteveWidg

Its only obvious when you know how!!
 

Attachments

  • ADD.zip
    9.2 KB · Views: 178
  • ADD1.png
    ADD1.png
    43.2 KB · Views: 216
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
This code cannot work:
B4X:
Sub loadbtn_Click
   Displaylbl.Text= Valuelbl.Text
   Log(Valuelbl.Text)
       
End Sub
Displaylbl and Valuelbl global variables point to the last views added with these names.

One way to get a reference to the correct view:
B4X:
Sub loadbtn_Click
   Dim pnl As B4XView = clv1.GetPanel(clv1.GetItemFromView(Sender))
   'DisplayLbl is the third child of the first panel:
   Dim dlbl As B4XView = pnl.GetView(0).GetView(2)
   dlbl.Text = "ttttt"
End Sub
 
Upvote 0

stevewidget

Member
Licensed User
Hi Erel, another step up the mountain. I 'assumed' that the objects in the pane would be exposed as it was called by a particular pane, certainly the valuelbl appeared to be ( as it logged OK,) but I sorta get that now.
Putting your code in worked (obviously!) but only gave me "ttt" so I used same logic to read my Valuelbl
Dim vlbl As B4XView = pnl.GetView(1).GetView(1)
dlbl.Text =vlbl.Text
or even
dlbl.Text = Valuelbl.text
(Sorry not sure how to post code = 1 step back)
This also worked fine, in that the default text (NewVal) put in in designer BUT in Question 1 on my previous post I said that trying to modify this label caused the pane to collapse. So I deleted the label and replaced with a text area, which I can then edit. However this now only displays the default text set in designer, and never actually updates. If I try to use Pnl.Getviewetc it crashes with an out of bounds error size = 0.
Thanks
Stevewidg

Theres no such thing as a simple question if you dont know the answer
 
Upvote 0
Top