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.
Hello!Welcome to the forum! I hope you're not a spammer or even worse a lurker. :D
... 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!
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.OK then, I owe you an apology. Unfortunately there are a lot of annoying spammers lately(the lurker part was a joke).
Your handler works perfectly. Very clever and elegant solution. Thank you!I'm glad it's working, you're more then welcome!
You can turn on the hints/informations inside the IDE to see what I copy/paste for you.My mistake. I haven't read them carefully when I first consulted the object inspector's property tips. They usually point out relevant information.
OK then, I owe you an apology. Unfortunately there are a lot of annoying spammers lately(the lurker part was a joke).You were correct: I lurked your code :) and I played with it:
On Window OS machines you can EnumWindow the PID to compare found HWNDs Text property for "AaBbCc", exemplary as shown with a spy app.You can easily replace the preview text, but then when the font type, size, etc changes, the font dialog redraws the original text, so you have to change it again.
... or even worse a lurker. :D