2006. március 22., szerda

How to use the Win95 Help (What's this?) button


Problem/Question/Abstract:

How to use the Win95 Help (What's this?) button

Answer:

The help button is supposed to be used only with dialogs, Borderstyle := bsDialog. This is a Microsoft thingy, for a main window you are supposed to provide either a menu item or a speedbutton that does a SendMessage(windowhandle, WM_SYSCOMMAND, SC_CONTEXTHELP, 0) to get the window into the context help mode.

The help button is only available if biMinimize and biMaximize is not set. Furthermore, sometimes you have to override the CreateParams method and set the style accordingly.


interface

type
  TfrmMain = class(TForm)
  public
    procedure CreateParams(var Params: TCreateParams); override;
  end;

implementation

procedure TfrmMain.CreateParams(var Params: TCreateParams);
begin
  inherited;
  Params.Style := Params.Style or DS_CONTEXTHELP;
  Params.ExStyle := Params.ExStyle or WS_EX_CONTEXTHELP;
end;

Nincsenek megjegyzések:

Megjegyzés küldése