Recent

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

Aidex

  • New member
  • *
  • Posts: 16
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: 1055
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 1.8.4/FPC 3.0.4 on:
(K)Ubuntu 12..16, Windows XP SP3 (Home/Prof.) and various DOS incarnations.

Aidex

  • New member
  • *
  • Posts: 16
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: 1055
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 1.8.4/FPC 3.0.4 on:
(K)Ubuntu 12..16, Windows XP SP3 (Home/Prof.) and various DOS incarnations.

Alextp

  • Hero Member
  • *****
  • Posts: 787
    • 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

  • Full Member
  • ***
  • Posts: 168
  • I click a little.
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 2.0.0 with FPC 3.0.4, Windows XP (all 32-bit)

Alextp

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