Firemonkey Hints 在 Delphi Seattle 中不起作用,对于从 XE7 转换的项目



我在Delphi Seattle中打开了这个演示,它的工作原理是应该的。当我打开我的程序,并包含演示表单时,它不起作用。我无法在控件中添加提示。

    procedure TMainForm.FormCreate(Sender: TObject);
      application.ShowHint:=true;
      application.OnHint :=OnApplicationHint;
    end;
    procedure TMainForm.OnApplicationHint(Sender: TObject);
    begin
      caption := (Application.Hint);
    end;
My program is converted from XE7 to Seattle. So what could be the difference?

在哪里可以找到实际显示提示的代码??

编辑:我找到了显示提示的代码。以下内容适用于新的XE-10西雅图程序,但不适用于从XE-7转换而来的程序。

var
  LToolInfo: TOOLINFO;
  FNativeControlHandle,
  FToolTipHandle: HWND;
begin
 FNativeControlHandle := WindowHandleToPlatform(form1.Handle).Wnd;
  if FNativeControlHandle <> 0 then begin
    FToolTipHandle := CreateWindowEx(0, TOOLTIPS_CLASS, nil, WS_POPUP or TTS_ALWAYSTIP, 0, 0, 300, 300,FNativeControlHandle, 0, hInstance, nil);

    SetWindowPos(FToolTipHandle, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE or SWP_NOSIZE or SWP_NOACTIVATE);
    FillChar(LToolInfo, SizeOf(TOOLINFO), 0);
    LToolInfo.cbSize := SizeOf(TOOLINFO);
    LToolInfo.uFlags := TTF_SUBCLASS or TTF_IDISHWND or TTF_PARSELINKS;
    LToolInfo.hinst := hInstance;
    LToolInfo.hwnd := FNativeControlHandle;
    LToolInfo.uId := FNativeControlHandle;
    LToolInfo.lpszText := PWideChar('Hint');

    SendMessage(FToolTipHandle, TTM_ADDTOOL, 0, LPARAM(@LToolInfo));
    SendMessage(FToolTipHandle, TTM_ACTIVATE, NativeInt(True), LPARAM(@LToolInfo));
  end;

我在从XE7转换的程序中遇到了类似的提示问题,该程序在Delphi Seattle中不起作用。

当我打开复选框"Activate runtime themes"(德语版中的"Laufzeit Themes aktivieren")(Project --> Options --> Application)时,提示出现了!

最新更新