#2 Center controls(widgets)

closed
nobody
None
5
2011-03-08
2011-01-21
Anonymous
No

I wonder how to center all the controls in a fullscreen window. I have a main form and TPanel.
I need that TPanel always be in a form center when I resize it.

Discussion

  • Sorry for the delay, I don't check the SourceForge website much for support questions. Please try and use the fpGUI newsgroups instead - if you can. Details are on the fpGUI website.

    Anyway, there are a few ways to do what you want:

    1) Create a OnResize event handler for that form. Inside that, calculate the new Panel position, and call
    Panel.UpdateWindowPosition.

    2) or position the Panel in the center of the form, set all four Anchors on the Panel. When the form
    resizes, the Panel will resize accordingly, but still stay center

    3) or position the Panel in the center of the form, then unset all Anchors of the Panel. When the form
    resizes, the Panel will stay centered, but *not* resize like it did in (2).

    Hope that helps.

     
    • status: open --> pending
     
  • This Tracker item was closed automatically by the system. It was
    previously set to a Pending status, and the original submitter
    did not respond within 14 days (the time period specified by
    the administrator of this Tracker).

     
    • status: pending --> closed