B4J Question B4XPages Windows Sizes

Marcos Alves

Well-Known Member
Licensed User
Longtime User
Hello all,

much more than mobile phones, desktop computers have a lot of screen configurations. A problem that I'm having with this is to define the correct size of a form: the size that is good in a device doesn't even fits on the screen in another.
Then, the question for the community: is there any way to get the screen size (like activity.width and activity.height ) in order to define the best form size in a B4J app using B4XPages?

Thanks!
 

klaus

Expert
Licensed User
Longtime User
Sorry, but I don't really understand your problem.
In B4J you define what you want or need.
As the layout files are platform specific, you can set any size for a form an set it fixed, or you can use the Resize event and adapt the layout dynamically and also set min and max sizes.
Of course, trying to display the same information on a 'small' phone screen and a 'big' PC screen is not realistic.
Therefore you have to manage these differences, it is similar to B4A and B4i for phones or tablets.
How do you currently manage these differences? You could define B4J layouts similar to the Tables layouts.
In B4A and B4i, the screen sizes are limited to the different devices, in B4J you have more possibilities, but you can limit the size, it is up to you.
 
Upvote 0

Marcos Alves

Well-Known Member
Licensed User
Longtime User
Sorry, but I don't really understand your problem.
In B4J you define what you want or need.
As the layout files are platform specific, you can set any size for a form an set it fixed, or you can use the Resize event and adapt the layout dynamically and also set min and max sizes.
Of course, trying to display the same information on a 'small' phone screen and a 'big' PC screen is not realistic.
Therefore you have to manage these differences, it is similar to B4A and B4i for phones or tablets.
How do you currently manage these differences? You could define B4J layouts similar to the Tables layouts.
In B4A and B4i, the screen sizes are limited to the different devices, in B4J you have more possibilities, but you can limit the size, it is up to you.
Hello @klaus ,

let me try to clarify:
- Suppose that I want a form that has 50% of screen width and 70% of screen height in any desktop.
- if I set:
B4X:
    B4XPages.GetNativeParent(Me).WindowHeight = 600
    B4XPages.GetNativeParent(Me).WindowWidth = 600

On some desktops screens this will be very small, in others very big... for example, I developed an app for desktop with a form with 758 height. On my screen this was good, but on the customer the form was exceeding the screen and some important features were hidden.
Then, again: is there any command which I could use to get the height and the width of the screen of current computer where the application is running in B4J?

Thanks
 
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
On some desktops screens this will be very small, in others very big..
600 x 600 will not be very big on any screen.

Are you disabling the windows resizing feature? Just let the user resize the window as needed.

s there any command which I could use to get the height and the width of the screen of current computer where the application is running in B4J?
See fx.Screens and fx.PrimaryScreen.
 
Upvote 0

Marcos Alves

Well-Known Member
Licensed User
Longtime User
Are you disabling the windows resizing feature? Just let the user resize the window as needed.
Hello @Erel . No, I didn't disabled resize feature but remember that the user isn't usually very smart :rolleyes:. For example, in this app that I'm talking about there was a BIG button "ACTION" on the bottom of the form but, to mirror the mobile aspect, I created the screen in a portrait view (means abou 480w x 750h). The button was out of the screen at the bottom and the user called us and said: "I don't know what to do now!!!" :mad: - of course that his screen was very small but remember - the user is THE USER!

See fx.Screens and fx.PrimaryScreen.
Thanks!!! This will help A LOT!

Great!

Regards!
 
Upvote 0
Top