PureBasic 集成Form设计器的使用
The PureBasic IDE has a very powerful integrated form designer, which allows to design easily windows and arrange gadgets on them. It supports almost all native PureBasic gadgets, menu and even status bar. A form file is a regular PureBasic file, so it can be easily modified without even open the form designer. The code parser isn't the same used by the compiler and therefore doesn't support all features, so when doing manual changes to a form file, it has to remain basic.
Contents of the "Form" menu:
New Form
Create a new empty form. It will bring automatically the form panel tool on top.Switch Code/Design View
Change the form view, switch from design mode to code view. A form is built from code, so if a change is made directly in code view, it will be reflected visually.Duplicate Object
Duplicate the currently selected object.Image manager
Display all the images currently used by the form. The image and its path can be changed easily here.
Form design panel
This panel list all available gadgets. Select one, and draw directly on the form the size needed. When a gadget is selected on the form, its properties are display on this panel and can be modified here.
Using the form designer in real world projects
The form designer has been created to allow modular forms and easy maintenance. Each form has to be in its own file. It can not have two form in the file (in other words, it should never have two OpenWindow() in the same file). An event procedure can be assigned to every gadget, and will be handled automatically in the event loop. The event procedures needs to be defined somewhere in the source code. Every form file should be named with the '.pbf' extension, so it will be correctly opened by the IDE. Form files can also be added to a project.
For example, to build a program which handle two windows, we will have to create two form files and one main file. The directory structure could look like that:
Main.pb ; The main PureBasic file, which will includes the two forms file, and defines the events
MainWindow.pbf ; The main window
DateWindow.pbf ; Another windowIf we assume MainWindow.pbf has two buttons ('OK' and 'Cancel') and DateWindow.pbf has one calendar gadget, here is how the main file would look like (the main file is not handled by the form designer, it has to be written manually):
XIncludeFile "MainWindow.pbf" ; Include the first window definition
XIncludeFile "DateWindow.pbf" ; Include the second window definition OpenMainWindow() ; Open the first window. This procedure name is always 'Open' followed by the window name
OpenDateWindow() ; Open the second window ; The event procedures, as specified in the 'event procedure' property of each gadget
Procedure OkButtonEvent(EventType)
Debug "OkButton event"
EndProcedure Procedure CancelButtonEvent(EventType)
Debug "CancelButton event"
EndProcedure Procedure TrainCalendarEvent(EventType)
Debug "TrainCalendar event"
EndProcedure ; The main event loop as usual, the only change is to call the automatically
; generated event procedure for each window.
Repeat
Event = WaitWindowEvent() Select EventWindow()
Case MainWindow
MainWindow_Events(Event) ; This procedure name is always window name followed by '_Events' Case DateWindow
DateWindow_Events(Event) EndSelect Until Event = #PB_Event_CloseWindow ; Quit on any window closeAs seen, it's easy to integrate visually designed forms in a program. Indeed it's also possible to continue to create window manually, or mix the two. To have all the control over the generated code, just switch to code mode and inspect it.
例子:
main.pbf:
XIncludeFile "pp.pbf"
OpenWindow_()
Procedure OkButtonEvent(EventType)
Select EventType()
Case #PB_EventType_LeftClick : Debug "Click with left mouse button"
Case #PB_EventType_RightClick : Debug "Click with right mouse button"
Case #PB_EventType_LeftDoubleClick : Debug "Double-click with left mouse button"
Case #PB_EventType_RightDoubleClick : Debug "Double-click with right mouse button"
EndSelect
EndProcedure
Procedure PButtonEvent(EventType)
Debug "pkButton event"
EndProcedure
Repeat
Event = WaitWindowEvent() Select EventWindow()
Case Window_
Select EventGadget()
Case Button_
OkButtonEvent(EventType)
Case Button_
PButtonEvent(EventType)
EndSelect EndSelect Until Event = #PB_Event_CloseWindow ; Quit on any window closepp.pb:
Global Window_ Global Button_, Button_ Procedure OpenWindow_()
Window_ = OpenWindow(#PB_Any, , , , , "", #PB_Window_SystemMenu | #PB_Window_Tool | #PB_Window_BorderLess)
Button_ = ButtonGadget(#PB_Any, , , , , "")
Button_ = ButtonGadget(#PB_Any, , , , , "")
EndProcedure Procedure Window__Events(event)
Select event
Case #PB_Event_CloseWindow
ProcedureReturn #False Case #PB_Event_Menu
Select EventMenu()
EndSelect Case #PB_Event_Gadget
Select EventGadget()
EndSelect
EndSelect
ProcedureReturn #True
EndProcedure
PureBasic 集成Form设计器的使用的更多相关文章
- Springboot2集成Activiti设计器并去除security
前言 鉴于项目需要将acitiviti设计器整合到原工程中,在网上查了不少资料都不太适用,经过借鉴和自己倒腾终于搞定了,分享一下经验,如果有问题,可以在留言区咨询. 文中用到的资源代码链接: http ...
- C#自定义运行时窗体设计器Runtime FormDesigner
写在前面:因为业务的需要,有时会使用到自定义运行时窗体设计器Runtime FormDesigner,实现的功能,就是IDE设计器的简化.设想一下,如果可以在程序运行时,再设计一个Form,然后编译代 ...
- Activiti(二) springBoot2集成activiti,集成activiti在线设计器
摘要 本篇随笔主要记录springBoot2集成activiti流程引擎,并且嵌入activiti的在线设计器,可以通过浏览器直接编辑出我们需要的流程,不需要通过eclipse或者IDEA的actiB ...
- 如何在CRM系统中集成ActiveReports最终报表设计器
有时候,将ActiveReports设计器集成到业务系统中,为用户提供一些自定义的数据表,用户不需要了解如何底层的逻辑关系和后台代码,只需要选择几张关联的数据表,我们会根据用户的选择生成可供用户直接使 ...
- java 工作流项目源码 SSM 框架 Activiti-master springmvc 集成web在线流程设计器
即时通讯:支持好友,群组,发图片.文件,消息声音提醒,离线消息,保留聊天记录 (即时聊天功能支持手机端,详情下面有截图) 工作流模块---------------------------------- ...
- .NET 开源工作流: Slickflow流程引擎高级开发(十) -- BpmnJS流程设计器集成
前言: 在Slickflow产品开发过程中,前端流程设计器经历了几个不同的版本(jsPlumb, mxGraph等),目的是为了在设计流程时的用户体验更加良好,得到客户的好评和认可.BpmnJS流程设 ...
- SSH框架集成Activiti Modeler在线设计器页面出现问号及乱码的解决办法
文·原创/朱季谦 工作流是一个针对企业用户.开发人员.系统管理员的轻量级工作流业务管理平台,其核心是使用Java开发的快速.稳定的BPMN2.0流程引擎.在我们日常开发当中,例如oa系统里的请假功能, ...
- YbSoftwareFactory 代码生成插件【十六】:Web 下灵活、强大的审批流程实现(含流程控制组件、流程设计器和表单设计器)
程序=数据结构+算法,而企业级的软件=数据+流程,流程往往千差万别,客户自身有时都搞不清楚,随时变化的情况更是家常便饭,抛开功能等不谈,需求变化很大程度上就是流程的变化,流程的变化会给开发工作造成很大 ...
- F2工作流引擎之-纯JS Web在线可拖拽的流程设计器(八)
Web纯JS流程设计器无需编程,完全是通过鼠标拖.拉.拽的方式来完成,支持串行.并行.分支.异或分支.M取N路分支.会签.聚合.多重聚合.退回.传阅.转交,都可以非常方便快捷地实现,管理员 ...
随机推荐
- Linux常用命令_(磁盘管理)
磁盘信息:df.du df命令–功能:检查文件系统的磁盘空间占用情况–语法:df [选项]–选项:-a 显示所有文件系统的磁盘使用情况,包括0块(block)的文件系统,如/proc文件系统.-k 以 ...
- 递推DP URAL 1353 Milliard Vasya's Function
题目传送门 /* 题意:1~1e9的数字里,各个位数数字相加和为s的个数 递推DP:dp[i][j] 表示i位数字,当前数字和为j的个数 状态转移方程:dp[i][j] += dp[i-1][j-k] ...
- LightOJ1316 A Wedding Party(状压DP)
这题事实上只需要关心15个商店和一个起点一个终点,预处理出这几个点之间的最短距离.Floyd会超时,用Dijkstra即可. 然后就是dp[u][S]表示已经经过商店集合S且当前在第u个商店所花的最少 ...
- C#:代表(delegate)和事件(event)
代表(delegate): 它是C#语言里面的函数指针,代表可以指向某一个函数,在运行的时候调用这个函数的实现.下面来看看它的实现步骤: 声明一个delegate对象. 实现和delegate具有相同 ...
- storm Tutorial 的解读 + 个人理解
参考链接: Tutorial storm Tutorial 中文解读+分析 导读.摘要: .hadoop有master与slave,Storm与之对应的节点是什么? .Storm控制节点上面运行一个后 ...
- CocoaPods 安装的第三方删除
CocoaPods 第三方删除 我们使用CocoaPods非常高效地将一些第三方类库导入到我们的项目中,难免会出现一些错误,这时应怎么删除它呢?以下方法会帮你解决这个问题 打开Build Phases ...
- Interleaving String leetcode java
题目: Given s1, s2, s3, find whether s3 is formed by the interleaving of s1 and s2. For example, Given ...
- COJ500 杨老师的路径规划(MST) (我是认真的)
用LCT来维护生成树,动态加边(s,t,w)时,新建节点x,权值为边权w. 1.若s与t不连通,则连接s-x,x-t,答案+w 2.若s与t连通,找出s-t路径上的最大权w2,若w<w2,删除w ...
- Django 1.6.0 正式发布,大幅改进事务处理
Django 1.6.0 正式发布了,查看官方发行说明. 下载地址:Django-1.6.tar.gz ,也可通过 pip 安装: pip install Django==1.6 要求 Python ...
- ASP.NET中Url重写后,打不开真正的Html页面
不对IIS配置.html的映射,IIS站点目录下.html页面都能显示.当配置了.html的映射 IIS站点目录下真实存在的.html页面无法显示,错误信息:“页面无法显示”解决方法:1.首先照旧在网 ...



