PureFORM 1.99 (yet another FORM designer)

All PureFORM, JaPBe, Libs and useful code maintained by gnozal

Moderator: gnozal

gnozal
PureBasic Expert
PureBasic Expert
Posts: 4229
Joined: Sat Apr 26, 2003 8:27 am
Location: Strasbourg / France
Contact:

Post by gnozal »

1. PureFORM doesn't need PB to work. It only calls the PBCompiler to detect the PB version (to adapt the generated code) or to compile a form.
It uses PB's scintilla dll if found, else it uses a RichEdit control.

2. Memory leaks in Vista64 : I don't undestand why it should only leak on 64 bits OS's !? No problems here on 98 / NT4 / XP. If there were some more specific issues reproductible on 32 bits systems I could investigate.
For free libraries and tools, visit my web site (also home of jaPBe V3 and PureFORM).
swan
Enthusiast
Enthusiast
Posts: 225
Joined: Sat Jul 03, 2004 9:04 am
Location: Sydney Australia
Contact:

Post by swan »

Gnozal: S..T happens ! :wink:

Thanx ...
hm
User
User
Posts: 30
Joined: Mon Oct 27, 2003 12:15 pm
Location: Germany
Contact:

Post by hm »

I just recently discovered this piece of gold. Nice work.

But there seems to be a bug in the generated code for PureBasic v4.30, using "PureFORM 1.99 build 365" and option "Generate PB4 compatible code":

Create a window containing a PanelGadget with two tabs and some controls on the tabs. In the generated code, there are two calls to "CloseGadgetList()". The debugger always vomits on the second call to "CloseGadgetList()" giving the following error:
[ERROR] OpenGadgetList() must be successfully called before calling CloseGadgetList().
I can continue program execution without errors.
There is no problem when executing the code with debugger deactivated.
If there is need I can post example code.

I think this could possibly be a PureBasic bug since the debugger has to give error on the first call to "CloseGadgetList()" but it did not (according to the debugger error message, the calling of "OpenGadgetList()" is not an option but a requirement before calling "CloseGadgetList()").

I will post to the "Bugs" forums if this is not a PureFORM bug but a PureBasic bug but I'm not sure about it.
gnozal
PureBasic Expert
PureBasic Expert
Posts: 4229
Joined: Sat Apr 26, 2003 8:27 am
Location: Strasbourg / France
Contact:

Post by gnozal »

hm wrote:... there seems to be a bug in the generated code for PureBasic v4.30, using "PureFORM 1.99 build 365" and option "Generate PB4 compatible code"
Hmm, seems to work here.
Using this form

Code: Select all

;{[PureFORM Project]
;PureFORM_Project_Begin
;Project¶PureFORM_Clipboard2
;Window¶1¶#Window_0¶13500416¶#PB_Window_SystemMenu|#PB_Window_SizeGadget|#PB_Window_MinimizeGadget|#PB_Window_TitleBar¶Window_0¶450¶200¶400¶400¶0¶10¶10¶0¶5000¶5000¶0¶-1¶0¶¶¶
;PanelGadget¶1¶#Panel_0¶1¶-1¶-1¶2¶0¶19¶0¶0¶¶¶¶-1¶0¶¶¶0¶0¶1¶1¶3¶20¶60¶330¶250¶0¶0¶0¶0¶0¶0·0·0·0·0·0·0¶0¶-1¶-1¶-1¶-1¶Tab #1¸¸·Tab #2¸¸¶0¶¶0¶0
;ButtonGadget¶2¶#Button_1_Gadget1¶1¶1¶19¶1¶0¶0¶0¶0¶¶Gadget_1¶¶-1¶0¶¶¶0¶0¶0¶0¶0¶30¶30¶120¶30¶0¶0¶0¶0¶0¶0·0·0·0·0·0·0¶0¶-1¶-1¶-1¶-1¶¶0¶¶0¶0
;ButtonGadget¶3¶#Button_2_Gadget2¶1¶1¶19¶1¶1¶0¶0¶0¶¶Gadget_2¶¶-1¶0¶¶¶0¶0¶0¶0¶0¶20¶10¶110¶40¶0¶0¶0¶0¶0¶0·0·0·0·0·0·0¶0¶-1¶-1¶-1¶-1¶¶0¶¶0¶0
;PureFORM_Project_End
;}
I get this code with PB 4.30 :

Code: Select all

Enumeration
  #Window_0
EndEnumeration
Enumeration
  #Panel_0
  #Button_1_Gadget1
  #Button_2_Gadget2
EndEnumeration
Procedure OpenWindow_Window_0()
  If OpenWindow(#Window_0, 450, 200, 400, 400, "Window_0", #PB_Window_SystemMenu|#PB_Window_SizeGadget|#PB_Window_MinimizeGadget|#PB_Window_TitleBar)
    PanelGadget(#Panel_0, 20, 60, 330, 250)
      AddGadgetItem(#Panel_0, -1, "Tab #1")
      ButtonGadget(#Button_1_Gadget1, 30, 30, 120, 30, "Gadget_1")
      AddGadgetItem(#Panel_0, -1, "Tab #2")
      ButtonGadget(#Button_2_Gadget2, 20, 10, 110, 40, "Gadget_2")
    CloseGadgetList()
  EndIf
EndProcedure

OpenWindow_Window_0()

Repeat
  Select WaitWindowEvent()
    Case #PB_Event_Gadget
      Select EventGadget()
        Case #Panel_0
        Case #Button_1_Gadget1
        Case #Button_2_Gadget2
      EndSelect
    Case #PB_Event_CloseWindow
      Select EventWindow()
        Case #Window_0
          CloseWindow(#Window_0)
          Break
      EndSelect
  EndSelect
Forever
which is correct.
1. What compiler version does PureFORM report in the 'About' window ?
2. Does the compiler path in Preferences points to a v4.30 compiler ?
3. Could you post your form [Menu -> Edit -> Copy project to clipboard] between code tags ?
For free libraries and tools, visit my web site (also home of jaPBe V3 and PureFORM).
hm
User
User
Posts: 30
Joined: Mon Oct 27, 2003 12:15 pm
Location: Germany
Contact:

Post by hm »

ok i have to post example code. here it is.

project:

Code: Select all

PureFORM_Project_Begin
Project¶ak
Window¶1¶#Window_Main¶13500416¶#PB_Window_SystemMenu|#PB_Window_SizeGadget|#PB_Window_MinimizeGadget|#PB_Window_TitleBar¶AK¶416¶58¶700¶525¶1¶300¶400¶0¶0¶0¶0¶-1¶1¶¶\6¸¸1·\7¸¸2·\8¸¸3·\9¸¸3·\1¸¸5·\2¸¸6·\9¸¸4·\B¸¸4¶...¸100¸LS¸
TreeGadget¶1¶#Tree_Websites¶1¶-1¶-1¶0¶0¶28¶0¶32¶#PB_Tree_AlwaysShowSelection¶¶¶-1¶3¶¶¶0¶0¶0¶0¶0¶5¶25¶115¶490¶0¶0¶0¶0¶0¶0·0·0·0·0·0·0¶0¶-1¶-1¶-1¶-1¶¶0¶¶0¶0
PanelGadget¶2¶#Panel_AK¶1¶-1¶-1¶0¶0¶19¶0¶0¶¶¶¶1¶3¶¶¶0¶0¶1¶1¶3¶125¶25¶470¶490¶0¶0¶0¶0¶0¶0·0·0·0·0·0·0¶0¶-1¶-1¶-1¶-1¶* <Neu>¸¸0·Tab #2¸¸0¶0¶¶0¶0
WebGadget¶4¶#Web_3¶1¶2¶19¶1¶0¶29¶0¶0¶¶about:mozilla¶¶-1¶0¶¶¶0¶0¶0¶0¶0¶10¶200¶470¶250¶1¶1¶0¶1¶1¶1·0·0·0·0·0·0¶0¶-1¶-1¶-1¶-1¶¶0¶¶0¶0
SplitterGadget¶3¶#Splitter_Main¶1¶-1¶-1¶0¶0¶24¶200¶3¶#PB_Splitter_Separator|#PB_Splitter_Vertical¶¶¶-1¶0¶#Tree_Websites¶#Panel_AK¶1¶2¶0¶0¶0¶0¶25¶700¶480¶1¶1¶1¶1¶1¶0·0·0·0·0·0·0¶0¶-1¶-1¶100¶-1¶¶0¶¶0¶0
PureFORM_Project_End
generated code:

Code: Select all

;{- Enumerations / DataSections
;:PureFORM:Init:Start:
; PureFORM V1.99 ~ 18.05.2009 17:24:14
;{ Windows
Enumeration
  #Window_Main
EndEnumeration
;}
;{ Toolbars
Enumeration
  #Toolbar_Window_Main
EndEnumeration
;}
;{ Menu/Toolbar items
Enumeration
  #Toolbar_Window_Main_New
  #Toolbar_Window_Main_Open
  #Toolbar_Window_Main_Save
  #Toolbar_Window_Main_Copy
  #Toolbar_Window_Main_Paste
  #Toolbar_Window_Main_Help
EndEnumeration
;}
;{ Status bars
Enumeration
  #StatusBar_Window_Main
EndEnumeration
;}
;{ Gadgets
Enumeration
  #Tree_Websites
  #Panel_AK
  #Web_3
  #Splitter_Main
EndEnumeration
;}
Define.l Event, EventWindow, EventGadget, EventType, EventMenu
;
Structure AKList
  Name$
  
EndStructure
Global NewList GAKList.AKList()
;
;:PureFORM:Init:End:
;}
;:PureFORM:Windows:Start:
;:PureFORM:Window_0_1:Start:
Procedure OpenWindow_Window_Main()
  If OpenWindow(#Window_Main, 416, 58, 700, 525, "AK", #PB_Window_SystemMenu|#PB_Window_SizeGadget|#PB_Window_MinimizeGadget|#PB_Window_TitleBar)
    If CreateToolBar(#Toolbar_Window_Main, WindowID(#Window_Main))
      ToolBarStandardButton(#Toolbar_Window_Main_New, #PB_ToolBarIcon_New)
      ToolBarStandardButton(#Toolbar_Window_Main_Open, #PB_ToolBarIcon_Open)
      ToolBarStandardButton(#Toolbar_Window_Main_Save, #PB_ToolBarIcon_Save)
      ToolBarSeparator()
      ToolBarStandardButton(#Toolbar_Window_Main_Copy, #PB_ToolBarIcon_Copy)
      ToolBarStandardButton(#Toolbar_Window_Main_Paste, #PB_ToolBarIcon_Paste)
      ToolBarSeparator()
      ToolBarStandardButton(#Toolbar_Window_Main_Help, #PB_ToolBarIcon_Help)
    EndIf
    If CreateStatusBar(#StatusBar_Window_Main, WindowID(#Window_Main))
      AddStatusBarField(100)
      StatusBarText(#StatusBar_Window_Main, 0, "...")
    EndIf
    TreeGadget(#Tree_Websites, 5, 25, 115, 490, #PB_Tree_AlwaysShowSelection)
    PanelGadget(#Panel_AK, 125, 25, 470, 490)
      ; * <Neu>
      AddGadgetItem(#Panel_AK, -1, "* <Neu>")
      WebGadget(#Web_3, 10, 200, 470, 250, "about:mozilla")
      ; Tab #2
      AddGadgetItem(#Panel_AK, -1, "Tab #2")
    CloseGadgetList()
    SplitterGadget(#Splitter_Main, 0, 25, 700, 480, #Tree_Websites, #Panel_AK, #PB_Splitter_Separator|#PB_Splitter_Vertical)
  CloseGadgetList()
  SetGadgetAttribute(#Splitter_Main, #PB_Splitter_FirstMinimumSize, 100)
  SetGadgetAttribute(#Splitter_Main, #PB_Splitter_SecondMinimumSize, -1)
  SetGadgetState(#Splitter_Main, 200)
  ; Gadget Resizing
  PureRESIZE_SetGadgetResize(#Web_3, 1, 0, 1, 1, #Panel_AK)
  PureRESIZE_SetGadgetResize(#Splitter_Main, 1, 1, 1, 1)
  ; Window Minimum Size
  PureRESIZE_SetWindowMinimumSize(#Window_Main, 400, 300)
  ;:PureFORM:Window_0_1:End:
  ; Your code here ...
  
  ;
  ;:PureFORM:Window_0_2:Start:
EndIf
EndProcedure
;:PureFORM:Window_0_2:End:
;:PureFORM:Windows:End:
;
;:PureFORM:Gadgets:Start:
;:PureFORM:Gadgets:End:

OpenWindow_Window_Main()
;:PureFORM:Main:Start:
;:PureFORM:Main:End:

;{- Event loop
Repeat
  Event = WaitWindowEvent()
  ;:PureFORM:Loop:Start:
  Select Event
    ; ///////////////////
    Case #PB_Event_Gadget
      EventGadget = EventGadget()
      EventType = EventType()
      If EventGadget = #Tree_Websites
      ElseIf EventGadget = #Panel_AK
      ElseIf EventGadget = #Web_3
      ElseIf EventGadget = #Splitter_Main
      EndIf
    ; /////////////////
    Case #PB_Event_Menu
      EventMenu = EventMenu()
      If EventMenu = #Toolbar_Window_Main_New
      ElseIf EventMenu = #Toolbar_Window_Main_Open
      ElseIf EventMenu = #Toolbar_Window_Main_Save
      ElseIf EventMenu = #Toolbar_Window_Main_Copy
      ElseIf EventMenu = #Toolbar_Window_Main_Paste
      ElseIf EventMenu = #Toolbar_Window_Main_Help
      EndIf
    ; ////////////////////////
    Case #PB_Event_CloseWindow
      EventWindow = EventWindow()
      If EventWindow = #Window_Main
        CloseWindow(#Window_Main)
        Break
      EndIf
  EndSelect
  ;:PureFORM:Loop:End:
Forever
;
;}
;:PureFORM:AfterLoop:Start:
;:PureFORM:AfterLoop:End:
i don't have controls on second tab but debug error still occurs when having a button on second tab. i don't know why...
gnozal
PureBasic Expert
PureBasic Expert
Posts: 4229
Joined: Sat Apr 26, 2003 8:27 am
Location: Strasbourg / France
Contact:

Post by gnozal »

hm wrote:ok i have to post example code. here it is.
Confirmed.
For free libraries and tools, visit my web site (also home of jaPBe V3 and PureFORM).
gnozal
PureBasic Expert
PureBasic Expert
Posts: 4229
Joined: Sat Apr 26, 2003 8:27 am
Location: Strasbourg / France
Contact:

Post by gnozal »

Update (build 366)

Changes :
- this build should fix the code generation issue posted by Hm.
For free libraries and tools, visit my web site (also home of jaPBe V3 and PureFORM).
Klonk
Enthusiast
Enthusiast
Posts: 173
Joined: Tue Jul 13, 2004 2:17 pm

Post by Klonk »

Two things I found:

* When opening PureForm without a filename provided it starts with an empty project. I changed nothing. then I wanted to load an existing project and am always priompted whether the changed project should be saved. This is a bit annoying.
* Disabling a gadget is not saved within the project.
* When a gadget is disabled no apropriate source code is generated
Bye Karl
gnozal
PureBasic Expert
PureBasic Expert
Posts: 4229
Joined: Sat Apr 26, 2003 8:27 am
Location: Strasbourg / France
Contact:

Post by gnozal »

Klonk wrote:* When opening PureForm without a filename provided it starts with an empty project. I changed nothing. then I wanted to load an existing project and am always priompted whether the changed project should be saved.
Changed in build 368. Note that PureFORM may open the last used project if you choose so in preferences.
Klonk wrote:* Disabling a gadget is not saved within the project.
* When a gadget is disabled no apropriate source code is generated
From the help file :
http://freenet-homepage.de/gnozal/PureFORM/GadgetPropertiesWindow.htm wrote:Special properties

 - Not in event loop :

  If checked, no code is generated in the event-loop for this gadget.

 - Disable / Hide :

  You can hide and/or disable the gadget in the form. This can be handy if you have several layers of gadgets.
  The hidden or disabled state is not saved with the form nor translated during code generation.
Last edited by gnozal on Thu May 28, 2009 7:37 am, edited 1 time in total.
For free libraries and tools, visit my web site (also home of jaPBe V3 and PureFORM).
gnozal
PureBasic Expert
PureBasic Expert
Posts: 4229
Joined: Sat Apr 26, 2003 8:27 am
Location: Strasbourg / France
Contact:

Post by gnozal »

Update (build 368)

Changes :
- the toolbar builder now supports 'icon+text' buttons in window or container toolbars.
For free libraries and tools, visit my web site (also home of jaPBe V3 and PureFORM).
User avatar
Kurzer
Enthusiast
Enthusiast
Posts: 670
Joined: Sun Jun 11, 2006 12:07 am
Location: Near Hamburg

Post by Kurzer »

Hello Gnozal, thank you for the updates.
Since a few weeks I use PB on a netbook with a screen resolution of 1024 x 600.
Is it posible to make the Integrator Windows (alternativ UI mode) resizeable?
The minimum size is higher than 600 pixels and the Titelbar is outside the screen. So I cannot drag the window. :-/
I'm obliged to use not the alternative UI mode with all the seperate windows. On 1024 x 600 this is not amusing. ;-D
gnozal
PureBasic Expert
PureBasic Expert
Posts: 4229
Joined: Sat Apr 26, 2003 8:27 am
Location: Strasbourg / France
Contact:

Post by gnozal »

kurzer wrote:Since a few weeks I use PB on a netbook with a screen resolution of 1024 x 600.
The minimum size is higher than 600 pixels and the Titelbar is outside the screen. So I cannot drag the window. :-/
Yes, the minimum size is the minimum _usable_ size. With the Integrator, the minimum screen resolution should be 1024 x 768. I tried 800 x 600 before setting the minimum size.
I think 1024 x 600 is not very reasonable to design windows.

Maybe I will make the Integrator height resizable. Will see ...
For free libraries and tools, visit my web site (also home of jaPBe V3 and PureFORM).
User avatar
Kurzer
Enthusiast
Enthusiast
Posts: 670
Joined: Sun Jun 11, 2006 12:07 am
Location: Near Hamburg

Post by Kurzer »

Thanks for thinking about it, Gnozal.

btw: The window in 566 pixels height looks like this (I reserved some pixels for the taskbar):

Image
(this is a retouched image)

I can live with this height. What do you think? It's not so unusable as expected. ;-)

And yes, designing UIs on a netbook is also not an amusing job, but if I want to change some minor parts in a UI I have to use the designer.
gnozal
PureBasic Expert
PureBasic Expert
Posts: 4229
Joined: Sat Apr 26, 2003 8:27 am
Location: Strasbourg / France
Contact:

Post by gnozal »

Ok, ok, ...
I have uploaded build 369. You can specify the Integrator minimum height in PureFORM.INI using the 'Window_Integrator_H_Min' key in the 'Windows' section :

Code: Select all

...
[Windows]
...
Window_Integrator_H_Min = 499
...
(Default value is 599).
For free libraries and tools, visit my web site (also home of jaPBe V3 and PureFORM).
User avatar
Kurzer
Enthusiast
Enthusiast
Posts: 670
Joined: Sun Jun 11, 2006 12:07 am
Location: Near Hamburg

Post by Kurzer »

Thank you very much!
Image
(A picture is worth a thousand words.)

edit: Looks nice now on 1024 x 600.
Image
Post Reply