B4J Question Button Position Irregularity

Kevin Hartin

Active Member
Licensed User
I am building a simple POS system to accompany a SAAS accounting system I have built a few years back. It will be Cross Platform (Android Tablet, iPad and Java Desktop app)

I want to dynamically add buttons from a database based on an individual clients setup preferences. (my app that runs on Android does this already).

I have a test app that I am playing with to work out the cross platform layouts (attached) and it seems to work fine on B4a, but it has a strange irregularity with positioning and formatting the last button on B4J.

As can be seen, button 49 is correctly placed in the bottom right on B4A
1630197197602.png

but on B4J it puts the last button at the top left and at the size it is actually set to in the Designer, despite logging the correct co-ordinates and size.
1630197499399.png

the B4J project is attached.

Any help is much appreciated...
 

Attachments

  • TestPOS.zip
    4.3 KB · Views: 104

Andrew (Digitwell)

Well-Known Member
Licensed User
Longtime User
One solution is to wait until after the first resize event before drawing the layout.

You can do this by adding

B4X:
#if b4j
Wait For b4xPage_resize (Width As Int, Height As Int)
#end if

right after Root = Root1

There are probably other ways to solve this.
 
Upvote 0

Kevin Hartin

Active Member
Licensed User
One solution is to wait until after the first resize event before drawing the layout.

You can do this by adding

B4X:
#if b4j
Wait For b4xPage_resize (Width As Int, Height As Int)
#end if

right after Root = Root1

There are probably other ways to solve this.
That works, but I have no idea why....šŸ˜¬

Thanks!
 
Upvote 0

Kevin Hartin

Active Member
Licensed User
Yes. Worth watching the B4J / B4i resize event video tutorial.
Erel,

some of these resources are quite difficult to find. for instance when I search for "resize event" there are no references to this tutorial.

Is there any reference document with such links available?

Thanks,
Kev
 
Upvote 0
Top