B4J Question Getting width of a pane returns 0

crt

Member
Licensed User
Longtime User
Hi, I'm trying to write a calendar app with B4J and I'm trying to print labels onto a pane, to do it I need to get the width and height of the pane in the designer, I'm simply using Dim Variable as double = pnlJan.Width, etc. In the designer the width of the pane is 108 pixels but when I run the program, when I try to get the width of the pane it just returns 0.0. I have the panes Dim statement in Process_Globals "Dim pnlJan as Pane", and no errors are being thrown. It seems like a simple operation, what am I missing?
 

stevel05

Expert
Licensed User
Longtime User
You should use PrefWidth as opposed to Width, and if you are running it from appstart, to make sure that the layout is fully loaded, call a sub with callsubdelayed to do your processing.
 
Upvote 0

crt

Member
Licensed User
Longtime User
You should use PrefWidth as opposed to Width, and if you are running it from appstart, to make sure that the layout is fully loaded, call a sub with callsubdelayed to do your processing.
PrefWidth did the trick, thanks so much
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…