Recent

Author Topic: OnSelect for TFontDialog ?  (Read 2961 times)

Aidex

  • Jr. Member
  • **
  • Posts: 82
OnSelect for TFontDialog ?
« on: March 06, 2019, 09:41:27 am »
Hi there!
TFontDialog comes with a NotifyEvent for OnApplyClicked.
Unfortunately, OnApplyClicked is not triggered until the user has clicked the Apply button (which works as described).
I would like an event when the user selects an entry in the font list (without clicking Apply or Ok).
I would then like to use the temporarily selected font to apply it as an extended preview to the parent window.
Is there a trick how I could derive an OnSelect event from the existing TFontDialog component?
« Last Edit: March 06, 2019, 06:07:50 pm by Aidex »

lucamar

  • Hero Member
  • *****
  • Posts: 4219
Re: OnSelect for TFontDialog ?
« Reply #1 on: March 06, 2019, 01:28:49 pm »
To use the OnApplyClicked event you have to add fdApplyButton to the dialog's Options. It then will show an "Apply" button that triggers the event without closing the dialog.

Note: It may or may not work on all widgetsets (I haven't tested).
Turbo Pascal 3 CP/M - Amstrad PCW 8256 (512 KB !!!) :P
Lazarus/FPC 2.0.8/3.0.4 & 2.0.12/3.2.0 - 32/64 bits on:
(K|L|X)Ubuntu 12..18, Windows XP, 7, 10 and various DOSes.

Aidex

  • Jr. Member
  • **
  • Posts: 82
Re: OnSelect for TFontDialog ?
« Reply #2 on: March 06, 2019, 06:05:55 pm »
Yes, the Apply button and OnApplyClicked are quite good for my intention.
It would be nice if there would be an additional option "applyOnSelect" - this would make the preview even more responsive for the user.

lucamar

  • Hero Member
  • *****
  • Posts: 4219
Re: OnSelect for TFontDialog ?
« Reply #3 on: March 06, 2019, 06:19:00 pm »
Font lists can be quite large; having it trigger an event each time a font is selected (which happens very frequently when navigating with the keyboard) would induce quite a lot of overhead for, usually, very little gain. And the dialog itself already has a preview box which you can customize with your own message.

Using the "Apply" button also has the advantage that it allows to delay the "live preview" until all the font properties are selected.
Turbo Pascal 3 CP/M - Amstrad PCW 8256 (512 KB !!!) :P
Lazarus/FPC 2.0.8/3.0.4 & 2.0.12/3.2.0 - 32/64 bits on:
(K|L|X)Ubuntu 12..18, Windows XP, 7, 10 and various DOSes.

AlexTP

  • Hero Member
  • *****
  • Posts: 2384
    • UVviewsoft
Re: OnSelect for TFontDialog ?
« Reply #4 on: March 15, 2019, 05:33:11 pm »
You can try ATExtendedDialogs package- it is in OnlinePackageManager, and can add event there. http://wiki.freepascal.org/ATExtendedDialogs

furious programming

  • Hero Member
  • *****
  • Posts: 852
Re: OnSelect for TFontDialog ?
« Reply #5 on: March 15, 2019, 07:51:59 pm »
If you don't like the existing font fialog, there is nothing to prevent you from writing your own. It's simply.
« Last Edit: March 16, 2019, 05:16:20 pm by furious programming »
Lazarus 3.2 with FPC 3.2.2, Windows 10 — all 64-bit

Working solo on an acrade, action/adventure game in retro style (pixelart), programming the engine and shell from scratch, using Free Pascal and SDL. Release planned in 2026.

AlexTP

  • Hero Member
  • *****
  • Posts: 2384
    • UVviewsoft
Re: OnSelect for TFontDialog ?
« Reply #6 on: March 16, 2019, 07:29:11 am »
And ATExtendedDialogs is this new dialog exactly.

 

TinyPortal © 2005-2018