Vcl Style Utils - Get rid of default form icon

Jerry Dodge

I've already posted this as an issue on RRUZ's Vcl Style Utils library on GitHub. However, I thought I could get some help here too.

I'm using VCL Styles to create a Windows 10 user interface, specifically using the "Windows 10 Dark" style. I'm also using the VCL Style Utils to be able to add buttons to the non-client area in the title bar. I'm attempting to completely disregard the form icon and its default functionality in favor of a back button, just like most new Windows 10 apps do.

I'm trying to place a button in the far upper-left corner of the form, using the TNCControls component in Vcl.Styles.NC. However, when I place a button over the form's icon, the button cannot be clicked in the area of the icon. Although I'm able to overlap the icon, clicking in that particular area of the title bar always opens the form's system menu, instead of clicking the button I've placed there.

I do not wish for this menu to pop up when clicking there:

Form System Menu

How I'm currently creating this button:

procedure TfrmTestMain.SetupTitleBar;
var
  B: TNCButton;
begin
  FNCControls:= TNCControls.Create(Self);
  B:= FNCControls.ButtonsList.Add;
  B.Style := TNCButton.TNCButtonStyle.nsTranparent;
  B.BoundsRect := Rect(0, 0, 45, 32);
  B.UseFontAwesome:= True;
  B.Caption := '';
  B.ImageAlignment:= TImageAlignment.iaCenter;
  B.ImageStyle:= TNCButton.TNCImageStyle.isNormal;
  B.ImageIndex:= fa_chevron_left;
end;

What I've tried so far:

  1. Replaced the form's Icon with a completely empty .ico file.

  2. Changing form style to bsSizeToolWin, but the title bar becomes too small, and I lose the minimize / maximize buttons.

  3. Changing form style to bsDialog, but I get the same effect as #2 above, as well as not being able to resize the form.

  4. Made sure button style is nsPushButton, and although it covers up the form icon, clicking the area still clicks the icon, which in turn shows the default system menu.

  5. Following everything in this thread, but the conclusion is that Windows forces you to have this icon.

  6. Removed biSystemMenu from the form's BorderIcons property, but this also removes the default buttons in the top-right of the form, forcing me to place my own system buttons there.

How do do I completely eliminate the form icon and its default functionality in favor of my Windows 10 style back button?

RRUZ

The TNCControls component includes the ShowSystemMenu property. If you set the value to false, then the system menu will be not shown.

Try this

uses
 Vcl.Styles.Utils.Graphics;

procedure TfrmTestMain.FormCreate(Sender: TObject);
begin
 SetupTitleBar;
end;

procedure TfrmTestMain.NCClick(Sender: TObject);
begin
  ShowMessage('Hello');
end;

procedure TfrmTestMain.SetupTitleBar;
var
  B: TNCButton;
begin
  FNCControls:= TNCControls.Create(Self);
  FNCControls.ShowSystemMenu := False; //Disable the system menu.

  B := FNCControls.ButtonsList.Add;
  B.Style := TNCButton.TNCButtonStyle.nsTranparent;
  B.BoundsRect := Rect(0, 0, 45, 32);
  B.UseFontAwesome:= True;
  B.Caption := '';
  B.ImageAlignment:= TImageAlignment.iaCenter;
  B.ImageStyle:= TNCButton.TNCImageStyle.isNormal;
  B.ImageIndex:= fa_chevron_left;
  B.OnClick := NCClick;
end;

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

Program icon looks curious in the title bar when using a VCL style

flutter how to get rid of a icon padding?

Bootstrap, get rid of border of icon in input field

Error when including .hpp files for VCL Style Utils generated in Embarcadero C++ Builder

Thymeleaf + Spring: get rid of the default element id

get rid of default blue in Xamarin forms

Facebook bot get rid of default message

How to get rid of skewness in scanned form?

How to get rid of a weird form border on focus

get rid of the text area on a form once clicked

Uninstalling MATLAB from laptop, how to get rid of launcher icon?

KDE: how to get rid of IBus sys tray icon and keep Zoom

React.js I can't get rid of the loader icon

How can I get rid of a 'dead' icon in search?

rails ajax form cancel link get rid of form

jQuery form validation - phoneUS and default message style

Is there a way to get rid of the default file manager for Xubuntu without having to get rid of the desktop?

Delphi Tools VCL Style Designer

Delphi VCL style on child window

Is there anyway to use an empty icon and get rid of dafault icon from the wx.Frame?

Yosemite: can I get rid of the default finder view for the home directory?

how to get rid of default white "space" around an element?

How to get rid of the default background of the Android DatePickerDialog in Android 4.4.4?

How to get rid of the default blue color on hover over a button?

How to get rid off the "default" property when loading modules with SystemJS?

How do I get rid of a default input binding?

make wmaker default window manager - get rid of Cinnamon

How to get rid of default overhang in Scenegraph Developer extensions

How to get rid of the default window in QT5