Re: How to make TCheckBox autosize work correctly on Linux?
Bo Berglund via fpc-pascal <[email protected]> Thu, 08 Jan 2026 11:42:04 +0100
| Newsgroups | gmane.comp.compilers.free-pascal.general |
|---|---|
| Message-ID | <[email protected]> |
On Wed, 7 Jan 2026 13:59:13 +0100, Mattias Gaertner via fpc-pascal <[email protected]> wrote: > > >On 1/6/26 21:52, Bo Berglund via fpc-pascal wrote: >>[...] >> On Windows the control expands in size to show the paramater added after the >> function text (which is always shown). >> But on Linux it does not expand enough to show the complete text, only the first >> digit of the number is visible. >> So it does try but fails to get it right (too small)... > >TCheckBox is used all over the the IDE and autosize works on all platforms. >Do you have an example? > >Mattias This is the actual event handler that activates the value and shows it on screen: procedure TfrmMain.ckbShiftAudioChange(Sender: TObject); var bShowLipsync: boolean; begin //Alternate function for audio delay handling with indication //of actual state on the control caption itself AudioShiftVal := 0; //Default value in global variable bShowLipsync := ckbShiftAudio.Checked; if bShowLipsync then AudioShiftVal := speAudio.Value; //Alternate placement of value in separate TStaticText container: //stxShiftAudio.Caption := IntToStr(AudioShiftVal); TCheckBox(Sender).Caption := 'Shift Audio: ' + IntToStr(AudioShiftVal); vlcPlayer.SetAudioDelay(AudioShiftVal *1000); end; The ckbShiftAudio checkbox is set to Autosize and it works fine on Windows but not on Linux... The altaernate way where the checkbox properties are not touched in this OnChange event is to add a TStaticText item to the right of the checkbox and write the value into that, but that has other problems: - Where to place it so it sits adjacent to the checkbox in both environments - How to get the same font size on the controls When I have adjusted this on Windows it works fine too, but again fails on Linux in a different way sice there are then control overlaps and also font size differences.... As you can see the actual working function is just to read another control having the value to use and set the system up to use it. This works on both Windows and Linux functionally. But the display to the user is different on the platforms and essentially unusable on Linux. This is so strange, I have made several applications which use the same code via SVN on both platforms and "just works" in both places. But not so for this seemingly simple task... Note: When I say autosize does not work I mean that the size changes but it does not include the value part, which is what extends the text size... So typically I can see the first char of the value (often the sign) but then the checkbox caption ends and no more is visible. -- Bo Berglund Developer in Sweden _______________________________________________ fpc-pascal maillist - [email protected] https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal