Embarcadero / DelphiVCL4Python

Delphi's VCL library as a Python module for building Windows GUI
Other
245 stars 54 forks source link

some thoughts from qt user #66

Closed iperov closed 1 year ago

iperov commented 1 year ago

Hi. I am a qt user and trying to do something in vcl/fmx to evaluate the possibility of switching to this framework.

What confuses me is the explicit specification of coordinates and size for widgets. I very rarely use explicit coordinates in qt. Everything is done through layouts, alignment and size policy.

In VCL I didn't find layouts at all. FMX has layouts. I tried GridPanelLayout, but it doesn't work the same way as in qt. Align also works in a strange way. Here is video of comparison .

https://github.com/Embarcadero/DelphiVCL4Python/assets/8076202/5cda6f5c-b33d-426e-9970-56904db00bf4

as you can see Label text has break line, but should fill all horizontal space. Button has no minimal size and can be shrinked to zero. Label don't restrict minimal Layout's size, thus when the Grid is reduced in size, the label is hidden behind the window.

maybe I'm doing something wrong. How can I get the same result as in qt ?

FMXExpress commented 1 year ago

Use TLayout to create areas. Use Align Top, Left, Right, Bottom to place layouts where you want. Use Align Client to fill an area with a control. TGridPanelLayout is weird. I always fill each of the grid pieces with a TLayout Align Client and then put my controls inside that layout.

To address what you are showing in your video you could add an OnResize event and check the size of controls before allowing the resize.

iperov commented 1 year ago

add an OnResize event and check the size of controls before allowing the resize.

So you suggest that the user himself should invent and program modern layouts for the VCL. Interesting

FMXExpress commented 1 year ago

🤔 Python came out in 1991.

def __init__(self, owner):
    self.SetProps(OnClose=self.__form_close, OnResize=self.__form_resize)

def __form_resize(self, sender):
    if self.Width < 500:
        self.Width = 500
    if self.Height < 500:
        self.Height = 500
iperov commented 1 year ago

that's wrong behaviour

ok nevermind. Good luck with this "game changer" 😄