Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Non-Client Area - overlap form icon #193

Closed
djjd47130 opened this issue Sep 3, 2016 · 1 comment
Closed

Non-Client Area - overlap form icon #193

djjd47130 opened this issue Sep 3, 2016 · 1 comment
Assignees
Labels

Comments

@djjd47130
Copy link

djjd47130 commented Sep 3, 2016

I'm trying to use the TNCControls to place a button in the far upper-left corner of the form, in place of the form's icon, just like almost all new Windows 10 apps do. However, when I do so, clicking in the area still clicks the form icon, instead of the button. I've tried numerous things, but to no avail...

  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 File not found: 'StyleUtils.inc' #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.

Currently, I'm forced to place this button just to the right of the form icon. But how can I properly completely overlap this icon to remove its default functionality?

@RRUZ RRUZ self-assigned this Sep 5, 2016
@RRUZ RRUZ added the question label Sep 5, 2016
@RRUZ
Copy link
Owner

RRUZ commented Sep 5, 2016

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;

@RRUZ RRUZ closed this as completed Sep 5, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants