Forum > General

Can't set title and PreviewText in FontDialog

(1/5) > >>

HexLaden:
Hello!

--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---...dlgfont: TFontDialog;... procedure Tfrorm.btnFontClick(Sender: TObject);begin  dlgFont.Title:= 'Select font';  dlgFont.PreviewText:= 'The quick brown fox jumps';  dlgFont.Options:= dlgFont.Options + [fdEffects, fdApplyButton];  if not dlgFont.Execute then Exit;  ...end;
I'm using Lazarus 2.2.4 in Win 10.

Font dialog remains with standard title caption and standard 'Abcd' as preview text.

Tried to set them in object inspector's properties also, but had the same result.

Are these properties managed by the operating system only?

Thank you!

KodeZwerg:
For the property PreviewText

--- Quote ---Please note that use of PreviewText is dependent on platform / widgetset support. For instance, Windows does render PreviewText. It uses its own "Sample", and renders the font name in the selection list using the typeface. QT and QT5 have the same behavior as Windows. It is implemented for the GTK, GTK2 and MUI widgetsets.
--- End quote ---

KodeZwerg:
For the property Title
It is defined in commondialog.inc as

--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---constructor TCommonDialog.Create (TheOwner: TComponent);begin  inherited Create(TheOwner);  FTitle := DefaultTitle;end;

GetMem:

--- Quote from: HexLaden on February 06, 2023, 01:00:28 pm ---Hello!

--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---...dlgfont: TFontDialog;... procedure Tfrorm.btnFontClick(Sender: TObject);begin  dlgFont.Title:= 'Select font';  dlgFont.PreviewText:= 'The quick brown fox jumps';  dlgFont.Options:= dlgFont.Options + [fdEffects, fdApplyButton];  if not dlgFont.Execute then Exit;  ...end;
I'm using Lazarus 2.2.4 in Win 10.

Font dialog remains with standard title caption and standard 'Abcd' as preview text.

Tried to set them in object inspector's properties also, but had the same result.

Are these properties managed by the operating system only?

Thank you!

--- End quote ---
Welcome to the forum! I hope you're not a spammer or even worse a lurker.  :D
Almost everything is possible on windows. Please test attached project.

HexLaden:
@KodeZwerg. Thank you, I searched in the forum and over the net for the PreviewText information you provided now, but could't find it.

@GetMem: Thank you for the warm welcome. The forum community has nothing to worry about: I'm neither a spammer nor a lurker. I've been clarifying my doubts reading lots of excelent forum contributions on the past year and a half, or so. They are so good that I never needed to post any question, till now.
Your handler works perfectly. Very clever and elegant solution. Thank you!

Navigation

[0] Message Index

[#] Next page

Go to full version