PythonStudio 控件使用常用方式(十六)TButtonedEdit

PythonStudio是一个极强的开发Python的IDE工具,它使用的是Delphi的控件,常用的内容是与Delphi一致的。但是相关文档并一定完整。现在我试试能否逐步把它的控件常用用法写一点点,也作为PythonStudio的参考。

从1.2.1版开始,PythonStudio又增加了很多新的控件。

TButtonEdit是一个比较有意思的控件,它支持在编辑框左右两边各加一个图标,图标也可以设置为鼠标移上变化。一般来说,这个图标可以设置为聊天框中的发送,或是搜索图标,预览图标等。

这个控件的使用,需要结合TImageList控件。也就是说,这个控件使用的图标,可以在TimageList中选择。

组件位置

TButtionEdit位于Additional下

TimageList位于Win32下

组件使用

  1. TButtonEdit使用,需要先对TImageList控件操作,引入图标
    双击TImageList控件,可以添加多个图片文件,由于显示位置较小,建议64*64像素的就够了,多个文件会有编号,这个编号是有用的。
  2. 设置TButtonEdit的Image属性
    Images属性,选择为刚才的TImageList的名称
  3. 设置图标

    在LeftButton或RightButton属性中修改

ButtonedEdit1.LeftButton.Visible := True; {允许显示 LeftButton}

ButtonedEdit1.LeftButton.HotImageIndex := 0; {左: 鼠标悬停时的图标}

ButtonedEdit1.LeftButton.ImageIndex := 1; {左: 正常显示时的图标}

ButtonedEdit1.LeftButton.PressedImageIndex := 2; {左: 鼠标点下时的图标}

ButtonedEdit1.LeftButton.DisabledImageIndex := 6; {LeftButton 不可用时的图标}

ButtonedEdit1.RightButton.Visible := True; {允许显示 RightButton}

ButtonedEdit1.RightButton.HotImageIndex := 3; {右: 鼠标悬停时的图标}

ButtonedEdit1.RightButton.ImageIndex := 4; {右: 正常显示时的图标}

ButtonedEdit1.RightButton.PressedImageIndex := 5; {右: 鼠标点下时的图标}

ButtonedEdit1.RightButton.DisabledImageIndex := 6; {RightButton 不可用时的图标}

  1. 设置事件
    左右按钮分别是以下两个事件
    self.ButtonedEdit1.OnLeftButtonClick
    self.ButtonedEdit1.OnRightButtonClick

很简单,是不?

相关推荐
敏编程2 小时前
一天一个Python库:jsonschema - JSON 数据验证利器
python
前端付豪2 小时前
LangChain记忆:通过Memory记住上次的对话细节
人工智能·python·langchain
databook2 小时前
ManimCE v0.20.1 发布:LaTeX 渲染修复与动画稳定性提升
python·动效
花酒锄作田15 小时前
使用 pkgutil 实现动态插件系统
python
前端付豪18 小时前
LangChain链 写一篇完美推文?用SequencialChain链接不同的组件
人工智能·python·langchain
曲幽19 小时前
FastAPI实战:打造本地文生图接口,ollama+diffusers让AI绘画更听话
python·fastapi·web·cors·diffusers·lcm·ollama·dreamshaper8·txt2img
老赵全栈实战19 小时前
Pydantic配置管理最佳实践(一)
python
阿尔的代码屋1 天前
[大模型实战 07] 基于 LlamaIndex ReAct 框架手搓全自动博客监控 Agent
人工智能·python
AI探索者2 天前
LangGraph StateGraph 实战:状态机聊天机器人构建指南
python
AI探索者2 天前
LangGraph 入门:构建带记忆功能的天气查询 Agent
python