当前位置:服务支持 >  软件文章 >  HyperMesh二次开发技术之插件界面设计与实现详解

HyperMesh二次开发技术之插件界面设计与实现详解

阅读数 15
点赞 0
article_banner

1.代码实例

#新建过程subWindow

proc subWindow {} {
    toplevel .subWindow -background {black}
    wm overrideredirect .subWindow true
    wm attribute .subWindow -topmost true
    wm geometry .subWindow 296x120+300+250
    frame .subWindow.f -relief flat
    label .subWindow.f.label01 -text "" -width 1 -height 5 -background {black}
    grid .subWindow.f.label01 -column 0 -row 0 -padx 2 -sticky ew
    labelframe .subWindow.f.part01 -text "workPath" -width 25 -height 100
    label .subWindow.f.part01.label00 -text "HomeDir"  -font {arial 8 bold} -width 8
    label .subWindow.f.part01.label10 -text "" -width 20 -height 2 -relief groove -borderwidth 4
    button .subWindow.f.part01.button -text "Select" -width 5  -font {arial 8 bold}
    grid .subWindow.f.part01.label00 -column 0 -row 0 -pady 18 -padx 2 -sticky ew 
    grid .subWindow.f.part01.label10 -column 1 -row 0 -pady 18 -padx 2 -sticky ew
    grid .subWindow.f.part01.button -column 1 -row 1 -pady 5 -padx 4 -sticky e
    grid .subWindow.f.part01 -column 1 -row 0 -padx 3 -pady 1 -sticky ew
          
    labelframe .subWindow.f.part02 -text "Import/Export" -width 23 -height 100
    button .subWindow.f.part02.button00 -text "Import" -width 5 -font {arial 8 bold} 
    button .subWindow.f.part02.button01 -text "Export" -width 5 -font {arial 8 bold}
    button .subWindow.f.part02.button02 -text "-Back-" -width 5 -font {arial 8 bold} -command {destroy .subWindow}
    grid .subWindow.f.part02.button00 -column 0 -row 0 -pady 5 -padx 2 -sticky ew
    grid .subWindow.f.part02.button01 -column 0 -row 1 -pady 5 -padx 2 -sticky ew
    grid .subWindow.f.part02.button02 -column 0 -row 2 -pady 5 -padx 2 -sticky ew
    grid .subWindow.f.part02 -column 2 -row 0 -padx 3 -pady 1 -sticky ew
    pack .subWindow.f -padx 0 -pady 1
}

#调用subWindow过程
subWindow

2.代码解析

(1) toplevel .subWindow -background {black}

在HyperMesh主界面下定义目录名为".subWindow"的子窗口,背景色为 {black}。

(2) wm overrideredirect .subWindow true

其参数为"true",使窗口管理器彻底忽略一个顶层窗口:没有装饰,没有窗口管理器对窗口交互式操作,没有图标化。

(3) wm attribute .subWindow -topmost true

其"-topmost"参数为"true",设置子窗口".subWindow"总显示在最前面。

(4) wm geometry .subWindow 296x120+300+250

设置子窗口".subWindow"宽296字符,高120字符;

设置子窗口".subwindow"左上角位置为显示器坐标(300,250)像素点。

(5) frame .subWindow.f -relief flat

在子窗口下建立目录名为".subWindow.f"的框架,-relief决定框架外观,其值:raised、sunken、flat、groove、ridge。

应用"pack .subWindow.f -padx 0 -pady 1"将框架加载到子窗口上,-padx:X方向距离边界,-pady:Y方向距离边界。

(6) labelframe .subWindow.f.part01 -text "workPath" -width 25 -height 100

在框架".subWindow.f"下添加目录名为".subWindow.f.part01"的带标题框架,标题名"workPath",-width:框架宽度,-height:框架高度。

应用"grid .subWindow.f.part02 -column 2 -row 0 -padx 3 -pady 1 -sticky ew"将带标题子框架加载到框架".subWindow.f"的第2列,第0行位置。

(7) button .subWindow.f.part02.button02 -text "-Back-" -width 5 -font {arial 8 bold} -command {destroy .subWindow}

在带标题框架".subWindow.f.part02"下添加目录名为".subWindow.f.part02.button02"的button按钮,按钮标题名"-Back-",-width:按钮宽度,-font:标题字体大小,-command:点击button后执行的脚本。

应用"grid .subWindow.f.part02.button02 -column 0 -row 2 -pady 5 -padx 2 -sticky ew"将button添加到".subWindow.f.part02"框架下。

(8) subWindow

调用"subWindow"过程。

3.启动名称为"subWindow"插件

HyperMesh二次开发02.png

案例源码进群:756716776下载


免责声明:本文系网络转载或改编,未找到原创作者,版权归原作者所有。如涉及版权,请联系删
相关文章
QR Code
微信扫一扫,欢迎咨询~

联系我们
武汉格发信息技术有限公司
湖北省武汉市经开区科技园西路6号103孵化器
电话:155-2731-8020 座机:027-59821821
邮件:tanzw@gofarlic.com
Copyright © 2023 Gofarsoft Co.,Ltd. 保留所有权利
遇到许可问题?该如何解决!?
评估许可证实际采购量? 
不清楚软件许可证使用数据? 
收到软件厂商律师函!?  
想要少购买点许可证,节省费用? 
收到软件厂商侵权通告!?  
有正版license,但许可证不够用,需要新购? 
联系方式 155-2731-8020
预留信息,一起解决您的问题
* 姓名:
* 手机:

* 公司名称:

姓名不为空

手机不正确

公司不为空