Vcl.Themes.TStyleManager.SystemHooks

From RAD Studio API Documentation
Jump to: navigation, search

Delphi

class property SystemHooks: TSystemHooks read FSystemHooks write SetSystemHooks default [shMenus, shDialogs, shToolTips];

C++

/* static */ __property TSystemHooks SystemHooks = {read=FSystemHooks, write=SetSystemHooks, default=7};

Properties

Type Visibility Source Unit Parent
property public
Vcl.Themes.pas
Vcl.Themes.hpp
Vcl.Themes TStyleManager

Description

The SystemHooks property allows displaying styled menus, common dialogs and tooltips.

When a style is applied to the VCL application using the TStyleManager, the following values show styled menus, common dialogs and tooltips, according to the set style.

The property includes these values by default:

  • shMenus shows styled menus.
  • shDialogs shows styled common dialogs. (Only for Seattle version and superior).
  • shToolTips shows tool tips. (Only for Seattle version and superior).

To enable / disable a system hook, just add or remove the value from the enumerated property.

For example:

  1. Use a TCheckBox to show a styled dialog.
  2. Use the OnClick event from a Button to execute a TOpenDialog component.
Note: Find the Common Dialog components under the Dialogs category of the Tool Palette.

For Delphi:

procedure TForm1.CheckBox1Click(Sender: TObject);
begin
 if CheckBox1.Checked then
   //When checking the checkbox, the value is added to the property and common dialog ares styled.
   TStyleManager.SystemHooks := TStyleManager.SystemHooks + [shDialogs] 
 else
   //When unchecking the checkbox, the value is removed from the property and the style does not apply to common dialogs.
   TStyleManager.SystemHooks := TStyleManager.SystemHooks - [shDialogs] 
end;
procedure TForm2.Button2Click(Sender: TObject);
begin
  OpenDialog1.Execute; //Opens the dialog.
end;

For C++:

void __fastcall TForm1::CheckBox1Click(TObject *Sender)
{
if (CheckBox1->Checked) {
  //One possible way to add the value.
  TStyleManager::SystemHooks = TStyleManager::SystemHooks + (TStyleManager::TSystemHooks() << TStyleManager::TSystemHook::shDialogs); 
  //Another possible way to add the value.
  StyleManager::SystemHooks = TStyleManager::SystemHooks << TStyleManager::TSystemHook::shDialogs; } 
else {
  //One possible way to remove the value.
  TStyleManager::SystemHooks = TStyleManager::SystemHooks - (TStyleManager::TSystemHooks() << TStyleManager::TSystemHook::shDialogs);
  //Another possible way to add the value.
  TStyleManager::SystemHooks = TStyleManager::SystemHooks >> TStyleManager::TSystemHook::shDialogs; }
}
void __fastcall TForm1::Button1Click(TObject *Sender)
{
  OpenDialog1->Execute(); //Opens the dialog.
}

See Also