* * *

Author Topic: Is it possible to remove Script and FontStyle comboboxes from tFontDialog?  (Read 231 times)

CM630

  • Hero Member
  • *****
  • Posts: 710
  • Не съм сигурен, че те разбирам.
    • http://sourceforge.net/u/cm630/profile/

Is it possible to remove Script and FontStyle selection from tFontDialog in Windows (7)?
I added fdNoStyleSel to the options of tFontDialog, but the style combobox is still shown.
What is worse, it selects nothing by default and an error message is generated when OK is clicked.
« Last Edit: October 13, 2017, 08:46:42 am by CM630 »
Lazarus 1,8,0 RC3;XP 32bit or W7 64bit ;FPC3,0,2;rev 55409

CM630

  • Hero Member
  • *****
  • Posts: 710
  • Не съм сигурен, че те разбирам.
    • http://sourceforge.net/u/cm630/profile/
Anybody out there?
Lazarus 1,8,0 RC3;XP 32bit or W7 64bit ;FPC3,0,2;rev 55409

Thaddy

  • Hero Member
  • *****
  • Posts: 4525
You can't demote any published properties. That is:unless you write a proxy for it.
"Logically, no number of positive outcomes at the level of experimental testing can confirm a scientific theory, but a single counterexample is logically decisive."

GetMem

  • Hero Member
  • *****
  • Posts: 2329
Actually is quite trivial on windows. Drop a TTimer to your form, set Interval property to 100, Enabled property to false, then:
Code: Pascal  [Select]
  1. uses windows;
  2.  
  3. procedure TForm1.Button1Click(Sender: TObject);
  4. begin
  5.   FontDialog1.Execute;
  6. end;
  7.  
  8. procedure TForm1.FontDialog1Show(Sender: TObject);
  9. begin
  10.   tmWait.Enabled := True;
  11. end;
  12.  
  13. procedure TForm1.tmWaitTimer(Sender: TObject);
  14. var
  15.   wHandle: THandle;
  16. begin
  17.   tmWait.Enabled := False;
  18.   wHandle := GetActiveWindow;
  19.   EnableWindow(GetDlgItem(wHandle, $0471), False);
  20.   EnableWindow(GetDlgItem(wHandle, $0474), False);
  21. end;

Thaddy

  • Hero Member
  • *****
  • Posts: 4525
@GetMem: are you seriously suggesting to use a timer to hide properties from the object inspector? I mean, really?  :D
"Logically, no number of positive outcomes at the level of experimental testing can confirm a scientific theory, but a single counterexample is logically decisive."

GetMem

  • Hero Member
  • *****
  • Posts: 2329
@GetMem: are you seriously suggesting to use a timer to hide properties from the object inspector? I mean, really?  :D
No. I just gave him a quick solution to disable those unwanted section from the FontDialog on runtime(see attachment). The timer is only need because FontDialog.Handle is always 0. This is a bug, in delphi there is a valid window handle after you launch the dialog.

 

Recent

Get Lazarus at SourceForge.net. Fast, secure and Free Open Source software downloads Open Hub project report for Lazarus