Windows - mostrando meu próprio help no botão biHelp |
Top Previous Next |
|
show my own help dialog when user clicks the biHelp border icon?
Author: P. Below Homepage: http://www.teamb.com
Category: Forms
type TForm1 = class(TForm) private procedure wmNCLButtonDown(var Msg: TWMNCLButtonDown); message WM_NCLBUTTONDOWN; procedure wmNCLButtonUp(var Msg: TWMNCLButtonUp); message WM_NCLBUTTONUP; end;
var Form1: TForm1;
implementation
{$R *.DFM}
procedure TForm1.wmNCLButtonDown(var Msg: TWMNCLButtonDown); begin if Msg.HitTest = HTHELP then begin Msg.Result := 0; // swallow mouse down on biHelp border icon end else inherited; end;
procedure TForm1.wmNCLButtonUp(var Msg: TWMNCLButtonUp); begin if Msg.HitTest = HTHELP then begin Msg.Result := 0; ShowMessage('Hi!'); // Show your help here end else inherited; end;
---------------------------------------------------------- exemplo 2
Quero fazer meu help, mas depois que o usuário clicar no campo
1. Em todos os componente coloque um HelpKeyword <> '' ou HelpContext <> 0 Use esse for no create:
for I := 0 to ComponentCount-1 do if TComponent(Components[I]) is TWinControl then TWinControl(Components[I]).HelpKeyword := '1';
2. No evento OnHelp do Form coloque:
function TCadastroADMPadraoForm.FormHelp(Command: Word; Data: Integer; var CallHelp: Boolean): Boolean; var Pt: TPoint; H: THandle; I: Integer; begin CallHelp := False; Result := False;
GetCursorPos(Pt); H := WindowFromPoint(Pt); if H = 0 then Exit;
for I := 0 to ComponentCount-1 do if (Components[I] is TWinControl) and (TWinControl(Components[I]).Handle = H) then begin ExibeHelp(TWinControl(Components[I])); Break; end; end;
|