维基副本镜像

这是 pascal.chat 维基的镜像。编辑、历史记录和登录都在那里。

TPopupNotifier/zh CN

English · Français · 中文(中国)

TPopupNotifier 是一个独立于系统的“气球帮助”,可以在屏幕的任何位置弹出来. 改组件基于 TForm,内置了 图标、标题、消息、自定义颜色。

TPopupNotifier 在 Common Controls tab 的 Component Palette.

作者大佬

授权

修改的 LGPL ,和Lazarus的组件库一样

下载

可以直接在Lazarus的0.9.17以上版本的控件中使用,直接在控件中搜索即可

系统需求

支持的系统: win32, gtk (obsolete), gtk2 and Qt

仅取决于LCL控件库 Lazarus Component Library.

用法

  1. 添加 TPopupNotifier 到窗体. 设置 icon Color Text Title 等属性。
  2. 调用 TPopupNotifier.Show 显示信息, 或者 TPopupNotifer.Hide 隐藏信息。

实施说明

TPopupNotifier 使用了 wrapper 控件, 因此TForm不在程序的Form中. 实际的数据类型是:

  1. Icon: TPicture, mapped to a TImage
  2. Header: TLabel ( sets +FsBold automatically)
  3. Message: TLabel sized to show multiline messages

关闭按钮是自绘的控件 (这里大佬自有大佬的原因,不用去深究).

高级功能

  1. 除了这些基础使用方法, 你还可以使用上述类型中的任何方法来处理消息. 例如:可以这样调用 TPopupNotifier.Icon.LoadFromFile;
  2. TPopupNotifier 包含 visible 属性, 可以用来检测窗体时候显示, 设置此属性可以显示/隐藏本窗体.
  3. TPopupNotifier 生成 OnClose 时间, 当窗体关闭时, 无论程序还是用户关闭, 如果关闭后需要执行什么任务就放在这里. 点击窗口任何位置都可以激活关闭事件。

显示多行信息

此处演示如何显示多行信息 (使用 TStringList).

pascal
var 
  I : Integer;
  Lines : TStringList;
...
for I := 0 to Lines.Count - 1 do
  PopupNotifier1.Text := PopupNotifier1.Text + LineEnding + Lines[I];

演示程序

演示程序位置 examples/popupnotifier/demo, 虽然简单,但是展示了控件的所有功能。

参考资料


From the Free Pascal wiki, page "TPopupNotifier/zh CN", as it stood on 2020-04-27 after a change by TyphonFinger, out of the wiki's dump of 2024-05-26. Copyright stays with the author who wrote it, according to the old wiki's Licensing page. If you have concerns about this material, message the admin.

版本1,最后由WikiArchive于修改。