B4J Question setsize doesn't work

Pedro Caldeira

Active Member
Licensed User
Longtime User
Hello,
I am trying to set the size of a pane, at runtime, but for some reason it doesn't work.
what am I doing wrong ?


Code: Copy
    ' ResolutionX and ResolutionY contain the screen and mainform resolution
    ' Caixa1 is a Pane created via Abstract Designer
    Dim SizeX as Double = ResolutionX / 5
    Dim SizeY as Double = ResolutionY / 5
    Caixa1.Top=0
    Caixa1.Left=0
    Caixa1.SetSize(SizeX,SizeY)
 
Try to use:
Code: Copy
Dim SizeX as Double = ResolutionX / 5
Dim SizeY as Double = ResolutionY / 5
Caixa1.Top=0
Caixa1.Left=0
Caixa1.PrefWidth = SizeX '<-----
Caixa1.PrefHeight = SizeY '<-----
 
Upvote 0
How you calculate ResolutionX and ResolutionY?

I use this code

Code: Copy
Dim joForm As JavaObject = MainForm
joForm.GetFieldJO("stage").RunMethod("setMaximized", Array(True))
ResX=MainForm.Width
ResY=MainForm.Height

But as I wrote previously, even setting the size with fixed values doesn't resize
 
Upvote 0
Back
Top