B4J Question How do I control resize action?

William Lancee

Well-Known Member
Licensed User
Longtime User
The attached zip shows what I mean.
With the designer I have a panel. It is anchored left-top.
In code I want to move it to the center of the form. No problem.
When the user (me) resizes the form, the panel jumps back to top left.
This is probably as designed.

I can prevent resizing, and that works. But for this application I want to resize.

I can add the centering code in the _Resize event. But there will be a flicker as the panel jumps back and forth to the top- left and then to the center.

Using centering anchors in the designer changes the panels size, which is not what I want.

Any suggestions?
 

Attachments

  • WiLProb.zip
    8.8 KB · Views: 137
Solution
The attached zip shows what I mean.
With the designer I have a panel. It is anchored left-top.
In code I want to move it to the center of the form. No problem.
When the user (me) resizes the form, the panel jumps back to top left.
This is probably as designed.

I can prevent resizing, and that works. But for this application I want to resize.

I can add the centering code in the _Resize event. But there will be a flicker as the panel jumps back and forth to the top- left and then to the center.

Using centering anchors in the designer changes the panels size, which is not what I want.

Any suggestions?
A simple solution.

teddybear

Well-Known Member
Licensed User
The attached zip shows what I mean.
With the designer I have a panel. It is anchored left-top.
In code I want to move it to the center of the form. No problem.
When the user (me) resizes the form, the panel jumps back to top left.
This is probably as designed.

I can prevent resizing, and that works. But for this application I want to resize.

I can add the centering code in the _Resize event. But there will be a flicker as the panel jumps back and forth to the top- left and then to the center.

Using centering anchors in the designer changes the panels size, which is not what I want.

Any suggestions?
A simple solution.
 

Attachments

  • Project.zip
    8.9 KB · Views: 133
Upvote 0
Solution

Harris

Expert
Licensed User
Longtime User
You don't have to write any code,just write script on Designer.
I had used this extensively early on with some good success.
It does require however, a knowledge of exactly what you are trying to modify (script) based on the view size - port or land - device and density.
A real time sucker when u dive deep.

Sometimes one has to settle for "good enough". U can't please everyone - or every device.
This is generally targeted towards "Android" devices. PC's should not have such an issue... Yet I was wrong once... Once.
 
Upvote 0
Top