Recent

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

CM630

  • Hero Member
  • *****
  • Posts: 1082
  • Не съм сигурен, че те разбирам.
    • 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 »
Лазар 3,2 32 bit (sometimes 64 bit); FPC3,2,2; rev: Lazarus_3_0 on Win10 64bit.

CM630

  • Hero Member
  • *****
  • Posts: 1082
  • Не съм сигурен, че те разбирам.
    • http://sourceforge.net/u/cm630/profile/
Anybody out there?
Лазар 3,2 32 bit (sometimes 64 bit); FPC3,2,2; rev: Lazarus_3_0 on Win10 64bit.

Thaddy

  • Hero Member
  • *****
  • Posts: 14215
  • Probably until I exterminate Putin.
You can't demote any published properties. That is:unless you write a proxy for it.
Specialize a type, not a var.

balazsszekely

  • Guest
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: 14215
  • Probably until I exterminate Putin.
@GetMem: are you seriously suggesting to use a timer to hide properties from the object inspector? I mean, really?  :D
Specialize a type, not a var.

balazsszekely

  • Guest
@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.

CM630

  • Hero Member
  • *****
  • Posts: 1082
  • Не съм сигурен, че те разбирам.
    • http://sourceforge.net/u/cm630/profile/
Thanks,
It seems I will have to make my own selection dialog.
But meanwhile, I could use @GetMem's solution. As he mentioned that it is a bug, I assume it will be fixed one day. And I guess it won't work on anything but Windows.
Лазар 3,2 32 bit (sometimes 64 bit); FPC3,2,2; rev: Lazarus_3_0 on Win10 64bit.

 

TinyPortal © 2005-2018