精华内容
下载资源
问答
  • PureBasic 集成Form设计器的使用
    2019-10-09 04:48:18

    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 window
    
    If 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 close
    
    As 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_0()
    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_0  
            Select EventGadget()
              Case  Button_0
                OkButtonEvent(EventType)
              Case  Button_1 
                PButtonEvent(EventType)
            EndSelect    
            
        EndSelect
        
      Until Event = #PB_Event_CloseWindow ; Quit on any window close

    pp.pb:

    Global Window_0
    
    Global Button_0, Button_1
    
    
    Procedure OpenWindow_0()
      Window_0 = OpenWindow(#PB_Any, 0, 0, 600, 400, "", #PB_Window_SystemMenu | #PB_Window_Tool | #PB_Window_BorderLess)
      Button_0 = ButtonGadget(#PB_Any, 20, 350, 110, 30, "")
      Button_1 = ButtonGadget(#PB_Any, 220, 310, 120, 30, "")
    EndProcedure
    
    Procedure Window_0_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

     

    posted on 2014-03-08 23:21  向北方 阅读( ...) 评论( ...) 编辑 收藏

    转载于:https://www.cnblogs.com/China3S/p/3588810.html

    更多相关内容
  • PureBasic开源项目 Repository: Repository: Vanity URL: Vanity URL: 欢迎来到PureBasic OpenSources Projects ,这是一个中央公共资源库,可以访问所有开源代码, 是Windows,Linux和OS X的本机代码BASIC编译器...
  • 这是功能强大的编程语言PureBasic的一些有用且有效的模板的集合。
  • 纯碱 GPL下的一些纯基本应用程序和代码。 附件: animatoon:一个2D位图应用程序,用于绘制和变换图像(调整大小,颜色,图层,笔刷...) 精灵动画:使用精灵(带有精灵和骨骼)创建动画 cartoon:2D矢量绘图和...
  • PureBasic.chm

    2018-09-18 20:02:25
    PureBasic编程语言的帮助说明文档,用于学习和应用PureBasic
  • PBTools是用PureBasic编写的命令行工具集。 它是用于脚本编写(bat,cmd,vbs,js等)和系统管理的有用工具。 该软件包包括用于将列表/菜单/对话框添加到批处理脚本的GUI工具。
  • Atom-language-purebasic.zip,atom中的pureBasic语言支持atom中的pureBasic语言支持,atom是一个用web技术构建的开源文本编辑器。
  • PureBasic项目 子目录 介绍 当您在GitHub上时,此仓库的每个子目录都是一个单独的示例项目,如果您有类似的项目,则可以使用。 但是,当您现在作为xdvrx1.github.io域中的网页查看此内容时,您需要单击View on ...
  • A beginner guide for Purebasic language
  • WebSocket标准的一致服务器实现,作为PureBasic的模块。 特征: 支持未分段和分段的二进制和文本框架。 基于回调,易于使用且延迟低。 该模块自动组合片段帧,默认情况下处于启用状态,可以在应用程序需要自行...
  • IRC Bot - 用 PureBasic 编码 感谢以下一些 afk-operator 的支持代码: irc 基础的参考(在 pb 中):DarkDragon @ purebasic 论坛 cryptlib 包装器(对于最后一分钟的 SSL 支持附加组件): : TrayIcon.pbc: ...
  • PureBasic 4.51 x64

    2013-05-15 03:39:18
    PureBasic 是一个新的基于"BASIC"标准的"高级"编程语言. 它兼容其它任何 "BASIC" 编译器, 不管它是Amiga 或 PC 格式. 学习 PureBasic非常简单,所以PureBasic已经赢得了很多初学者和资质高深的程序员. [1] 她语法...
  • Purebasic函数.txt

    2019-12-23 13:52:37
    搜集整理的purebasic所有函数 Abs(Value) ;返回绝对值(没有给定的浮动值的符号)。 ACos(Angle) ;返回弧指定角度Cosinus,在弧度。 ActivateGadget(#Gadget) ;设置指定的小工具焦点 ActivateWindow() ;激活...
  • purebasic工具

    2014-01-01 17:33:39
    自己看吧,PUREBASIC的工具,绝对好,不信!
  • Visual PureBasic IDE-开源

    2021-05-13 20:34:59
    公告:开发已永久移至CODEPLEX(http://vpbide.codeplex.com/)! Visual PureBasic IDE是PureBasic的强大开发环境-尤其是对于具有窗体的Windows应用程序。 它结合了PureBasic w的强大功能
  • PureBasic Utilities-开源

    2021-07-20 11:35:04
    PureBasic 源代码和工具形式的通用实用程序。
  • purebasic开发窗体控件,计算故障电流的小计算程序。
  • PureBasic-CodeArchiv重生 此代码档案库包含来自PureBasic官方论坛和其他来源的有用代码,并以经过分类且可快速访问的格式显示它们。 档案中的每个代码都是拥有版权拥有者的单独作品,因此这些代码可能具有不同的...
  • PureBasic 4.51 x86

    2011-04-14 13:05:58
    PureBasic 是一个新的基于"BASIC"标准的"高级"编程语言. 它兼容其它任何 "BASIC" 编译器, 不管它是Amiga 或 PC 格式. 学习 PureBasic非常简单,所以PureBasic已经赢得了很多初学者和资质高深的程序员. 她语法简单却...
  • pmotion-purebasicPureBasic中的Cosmigo Pro Motion NG插件界面
  • PureBasic Mac是一款基于BASIC规则的编程语言,PureBASIC的显着特色是它广泛的可移植性。它可以在Windows, MacOS X和 Linux系统上流畅运行。可以帮助用户创建或编辑PureBasic代码,调试,运行它并创建可执行文件,使...
  • PureBasic 4.60 Win

    2012-04-02 18:49:12
    Purebasic 4.60 Windows版 含X86和64两个安装包及中文语言包
  • purebasic中不同窗口代码 内详述了purebasic建立不同相式窗口的方法 希望对大家有帮助
  • Arkeos Scene Editor 3D是用于使用Ogre 3D创建游戏的场景编辑器。 它是用Purebasic创建的。
  • PureBasic DX9 子系统的来源。
  • purebasic4.61,你知道的..
  • PureBasic_5.60_Portable_32位.rar 网上目前很难找到的全功能(Retail)最新版本,其他介绍的都是Demo版。 支持GIF解码器。
  • PureBasic 5.11 x86

    2013-05-15 03:37:35
    PureBasic 是一个新的基于"BASIC"标准的"高级"编程语言. 它兼容其它任何 "BASIC" 编译器, 不管它是Amiga 或 PC 格式. 学习 PureBasic非常简单,所以PureBasic已经赢得了很多初学者和资质高深的程序员. [1] 她语法...
  • PureBasic 4.3 Linux 版

    2009-03-06 17:43:39
    关于PureBasic:    PureBasic 是一个新的基于"BASIC"标准的"高级"编程语言. 它兼容其它任何 "BASIC" 编译器, 不管它是Amiga 或 PC 格式. 学习 PureBasic非常简单,所以PureBasic已经赢得了很多初学者和资质高深的...
  • purebasic编程软件

    2008-10-24 11:28:02
    purebasic上一个很不借的basic软件。适合初学者使用。

空空如也

空空如也

1 2 3 4 5 ... 20
收藏数 437
精华内容 174
关键字:

PureBasic

友情链接: 11.rar