You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Setup:
Linux - Debian Pixie with KDE desktop and Wayland
FPC: 3.2.2 installed using fpcupdeluxe
FPGui: 2.1.0 - compiled with unix
also tried with FPGui Development
Using MigLayout, the checkbox does not get right-aligned in its column. Not sure if I'm doing something wrong with the layout or checkbox (or maybe its wider than I think). I cut down the code to give a basic example:
WindowTitle := 'Test UI';
Width := 800;
Height := 400;
This is what I currently see (I adapted the lm-mig example's basic form):
I've enabled Debug mode for miglayout, so you can see the mig cells. I've also changed the BackgroundColor of the checkbox to Orange, so you can see it's default size.
Can you sketch or describe what your desired layout should look like?
I expected the "p" in Allow Stop to be aligned with the right border of the Start Directory button. To me, what you've drawn looks left aligned. Of course, if the checkbox takes up the entire orange area, then I guess it is right-aligned, just the label isn't. I wasn't sure what is considered the "full checkbox"
It is simply a case of the code did not tell the mig grid to grow. Also, please see the lm-mig's "Cell Alignment" example for how you can position (align) widgets inside mig cells.
I defined the Width := 100 for the checkbox, to force it smaller (though it wasn't technically needed). I then added one extra line as shown below
mig := TfpgMigLayoutManager.Create;
mig.LC.FillX; // Cells fill available space
gives this:
And if I change the fill to Fill (both axis) like this:
mig := TfpgMigLayoutManager.Create;
mig.LC.Fill; // Cells fill available space
gives this:
HINT:
It is very useful to study the lm-mig example
It is extremely useful to enable the debug rendering of mig, so you can visualise what your code is doing and how it affects the layout.
So the above was about placement of the widget. Now about aligning the text of a checkbox widget. fpGUI's text rendering does support that, but unfortunately TfpgCheckBox hard-codes the text alignment to txtLeft. If I had to modify the code and use txtRight in the HandlePaint(), then the output would look as follows:
Is that what you were after? The checkbox text physically rendering right-aligned? If so, I can look into surfacing such control via widget properties. This has nothing to do with MiG though.
Actually, none of these are what I'm looking for. I tried the FillX. Did not do what I wanted. I don't want to right align the label of the checkbox while leaving the actual checkbox.
What I'm looking for is this:
Or better control of the size to just fit the checkbox and label so that the MigLayout Align('right') works better
To be clearer. The right align example I gave is not as important as the checkbox sizing. It seems like there is a lot of space after the label. In my mind, I would think the width of the checkbox would be the actual checkbox some spacing then the label and that is it. The extra space after the label is the real reason the checkbox does not align right.
Of course, my thinking of how the checkbox should appear when using Align('right') may be in the minority. Not sure a lot of time should be spent on it. If I have access to box width and label width, I could probably just manually set the width myself.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
Setup:
Linux - Debian Pixie with KDE desktop and Wayland
FPC: 3.2.2 installed using fpcupdeluxe
FPGui: 2.1.0 - compiled with unix
also tried with FPGui Development
Using MigLayout, the checkbox does not get right-aligned in its column. Not sure if I'm doing something wrong with the layout or checkbox (or maybe its wider than I think). I cut down the code to give a basic example:
WindowTitle := 'Test UI';
Width := 800;
Height := 400;
mig := TfpgMigLayoutManager.Create;
LayoutManager := mig;
lPath := TfpgLabel.Create(Self);
lPath.Text := '';
mig.AddLayoutComponent(lPath, TfpgMigCC.Create.SpanX(3));
bPath := TfpgButton.Create(Self);
bPath.Text := 'Start Directory';
mig.AddLayoutComponent(bPath, TfpgMigCC.Create.GrowX.AlignX('right').Wrap);
lMessage := TfpgLabel.Create(Self);
lMessage.Text := 'Not Scanned';
lMessage.TextColor := clBlue;
mig.AddLayoutComponent(lMessage, TfpgMigCC.Create.SpanX(3));
cbxStop := TfpgCheckBox.Create(Self);
cbxStop.Text := 'Allow Stop';
cbxStop.Checked := true;
mig.AddLayoutComponent(cbxStop, TfpgMigCC.Create.AlignX('right').Wrap);
All reactions