Form Designer 5.10

You need some new stunning features ? Tell us here.
User avatar
Shield
Addict
Addict
Posts: 1021
Joined: Fri Jan 21, 2011 8:25 am
Location: 'stralia!
Contact:

Re: Form Designer for Mac/Windows/Linux - beta 9

Post by Shield »

App crashes when moving the splitter to the right edge.
When moving it to the left edge there are drawing errors (whole area is white until I move the splitter back again).
Image
Blog: Why Does It Suck? (http://whydoesitsuck.com/)
"You can disagree with me as much as you want, but during this talk, by definition, anybody who disagrees is stupid and ugly."
- Linus Torvalds
Polo
Addict
Addict
Posts: 2422
Joined: Tue May 06, 2003 5:07 pm
Location: UK

Re: Form Designer for Mac/Windows/Linux - beta 9

Post by Polo »

Shield wrote:App crashes when moving the splitter to the right edge.
When moving it to the left edge there are drawing errors (whole area is white until I move the splitter back again).
On which OS?
Polo
Addict
Addict
Posts: 2422
Joined: Tue May 06, 2003 5:07 pm
Location: UK

Re: Form Designer for Mac/Windows/Linux - beta 9

Post by Polo »

I've added the minimum size to the splitter to avoid the crash (though it doesn't crash on OSX).
Cannot reproduce the "drawing errors".
User avatar
Shield
Addict
Addict
Posts: 1021
Joined: Fri Jan 21, 2011 8:25 am
Location: 'stralia!
Contact:

Re: Form Designer for Mac/Windows/Linux - beta 9

Post by Shield »

It doesn't crash anymore when dragged to the right, but now it crashes when dragged to the left. :mrgreen:
Windows 7 (x64) Home Premium
Image
Blog: Why Does It Suck? (http://whydoesitsuck.com/)
"You can disagree with me as much as you want, but during this talk, by definition, anybody who disagrees is stupid and ugly."
- Linus Torvalds
Polo
Addict
Addict
Posts: 2422
Joined: Tue May 06, 2003 5:07 pm
Location: UK

Re: Form Designer for Mac/Windows/Linux - beta 9

Post by Polo »

Shield wrote:It doesn't crash anymore when dragged to the right, but now it crashes when dragged to the left. :mrgreen:
Windows 7 (x64) Home Premium
Won't happen in next beta, thanks for reporting that, I hate apps that crash! :)
luciano
Enthusiast
Enthusiast
Posts: 151
Joined: Wed Mar 09, 2011 8:25 pm

Re: Form Designer for Mac/Windows/Linux - beta 9

Post by luciano »

One doubt and one crash :-)
1- I selected an event file by mistake; I see that I can select another one easily, but I have not understood how to return to default (without any event file).
2- I could crash while resizing (reducing) the main window of FD.
Image
Edit: it takes a large property area to cause the crash, no crash with small ones.
Image
Polo
Addict
Addict
Posts: 2422
Joined: Tue May 06, 2003 5:07 pm
Location: UK

Re: Form Designer for Mac/Windows/Linux - beta 9

Post by Polo »

The resizing issue is probably linked to the min size of the splitter which should be fixed.

I though I had added a right click to remove the file (like the right click on colour) - but I apparently forgot!

Thanks :)
luciano
Enthusiast
Enthusiast
Posts: 151
Joined: Wed Mar 09, 2011 8:25 pm

Re: Form Designer for Mac/Windows/Linux - beta 9

Post by luciano »

Gaetan,
you are right, it is the splitter; I can cause a crash if I move the splitter to the left.
CAUTION for beta testers, crashing FD moving the splitter to the left side may prevent FD from starting again , I had to remove preferences.
wilbert
PureBasic Expert
PureBasic Expert
Posts: 3942
Joined: Sun Aug 08, 2004 5:21 am
Location: Netherlands

Re: Form Designer for Mac/Windows/Linux - beta 9

Post by wilbert »

The generated code spells Calendar as CalEndar.
I know PB isn't case sensitive so it will work fine but the capital E looks a bit strange.
Polo
Addict
Addict
Posts: 2422
Joined: Tue May 06, 2003 5:07 pm
Location: UK

Re: Form Designer for Mac/Windows/Linux - beta 9

Post by Polo »

wilbert wrote:The generated code spells Calendar as CalEndar.
I know PB isn't case sensitive so it will work fine but the capital E looks a bit strange.
Fixed, thanks! :)
luciano
Enthusiast
Enthusiast
Posts: 151
Joined: Wed Mar 09, 2011 8:25 pm

Re: Form Designer for Mac/Windows/Linux -5.00b2

Post by luciano »

"Set Gadget Font" is saved in the pbf files, but this command is lost when the file is open again in Form Designer.
See these two files as "before" and "after" :

As saved

Code: Select all

; Form Designer for Purebasic - 5.0
; Warning: this file uses a strict syntax, if you edit it, make sure to respect the Form Designer limitation or it won't be opened again.

Global Img_0

Enumeration
  #Window_0
EndEnumeration

Enumeration
  #Button_0
  #Image_0
  #TrackBar_0
EndEnumeration

Img_0 = CatchImage(#PB_Any,?img_0)

Enumeration
  #Font_0
EndEnumeration

LoadFont(#Font_0,"Arial", 9)

XIncludeFile "C:\Programmi\PureBasic_500\events_test.pb"

Procedure InitWindow_0()
  OpenWindow(#Window_0, 0, 0, 600, 400, "FORM TEST", #PB_Window_SystemMenu | #PB_Window_MinimizeGadget | #PB_Window_TitleBar)
  ButtonGadget(#Button_0, 30, 30, 140, 60, "message request")
  SetGadgetFont(#Button_0, FontID(#Font_0))
  ImageGadget(#Image_0, 30, 100, 32, 32, ImageID(Img_0))
  TrackBarGadget(#TrackBar_0, 240, 40, 190, 40, 0, 50, #PB_TrackBar_Ticks)
EndProcedure


Procedure Window_0_Events(event)
  Select event
    Case #PB_Event_Gadget
      Select EventGadget()
        Case #Button_0
          messaggio(EventGadget(),EventType())          
        Case #Image_0
          messaggio(EventGadget(),EventType())          
      EndSelect
  EndSelect
EndProcedure

DataSection
  img_0: IncludeBinary "C:\Programmi\PureBasic_500\Examples\Sources - Advanced\Waponez II\Waponez.ico"
EndDataSection
After re-opening

Code: Select all

; Form Designer for Purebasic - 5.0
; Warning: this file uses a strict syntax, if you edit it, make sure to respect the Form Designer limitation or it won't be opened again.

Global Img_0

Enumeration
  #Window_0
EndEnumeration

Enumeration
  #Button_0
  #Image_0
  #TrackBar_0
EndEnumeration

Img_0 = CatchImage(#PB_Any,?img_0)

XIncludeFile "C:\Programmi\PureBasic_500\events_test.pb"

Procedure InitWindow_0()
  OpenWindow(#Window_0, 0, 0, 600, 400, "FORM TEST", #PB_Window_SystemMenu | #PB_Window_MinimizeGadget | #PB_Window_TitleBar)
  ButtonGadget(#Button_0, 30, 30, 140, 60, "message request")
  ImageGadget(#Image_0, 30, 100, 32, 32, ImageID(Img_0))
  TrackBarGadget(#TrackBar_0, 240, 40, 190, 40, 0, 50, #PB_TrackBar_Ticks)
EndProcedure


Procedure Window_0_Events(event)
  Select event
    Case #PB_Event_Gadget
      Select EventGadget()
        Case #Button_0
          messaggio(EventGadget(),EventType())          
        Case #Image_0
          messaggio(EventGadget(),EventType())          
      EndSelect
  EndSelect
EndProcedure

DataSection
  img_0: IncludeBinary "C:\Programmi\PureBasic_500\Examples\Sources - Advanced\Waponez II\Waponez.ico"
EndDataSection

here is my simple "events_test.pb" file which is included

Code: Select all

Procedure messaggio(who.i,how.i)
  
  
  If how=#PB_EventType_LeftClick       
    MessageRequester("Information", "LEFT click", #PB_MessageRequester_Ok) 
  EndIf
  
  
EndProcedure

Polo
Addict
Addict
Posts: 2422
Joined: Tue May 06, 2003 5:07 pm
Location: UK

Re: Form Designer for Mac/Windows/Linux -5.00b2

Post by Polo »

:oops:
Fixed.

This problem only occurs when PB_Any is not used - you'll find the same problem for SetGadgetState and so on. Until next beta comes out ;)
Sorry for that!
User avatar
ts-soft
Always Here
Always Here
Posts: 5756
Joined: Thu Jun 24, 2004 2:44 pm
Location: Berlin - Germany

Re: Form Designer for Mac/Windows/Linux -5.00b2

Post by ts-soft »

Thx Polo for you're great work, but i have found some glitches :wink:

On Linux:
If you resize the designer, the splitter for the properties/objects is to small, no minwidht defined!
In Preferences the comboboxes to small, the text is not readable.

Greetings - Thomas
PureBasic 5.73 | SpiderBasic 2.30 | Windows 10 Pro (x64) | Linux Mint 20.1 (x64)
Old bugs good, new bugs bad! Updates are evil: might fix old bugs and introduce no new ones.
Image
Polo
Addict
Addict
Posts: 2422
Joined: Tue May 06, 2003 5:07 pm
Location: UK

Re: Form Designer for Mac/Windows/Linux -5.00b2

Post by Polo »

Fixed, thanks!
Polo
Addict
Addict
Posts: 2422
Joined: Tue May 06, 2003 5:07 pm
Location: UK

Re: Form Designer for Mac/Windows/Linux -5.00b2

Post by Polo »

Look what I've just added... automatic resizing ;)

Each gadgets can now be assigned two new flags: width / height relative to parent.
If these flags are assigned, the generated code will compute the width / height according to the parent (either the window or a container).
You just have to check the flag, you can still input the width/height or resize the gadgets as you wish, the FD computes the differences all by itself!

You'll end up with a generated code like this:

Code: Select all

Procedure InitWindow_0()
  Window_0 = OpenWindow(#PB_Any, 0, 0, 600, 400, "", #PB_Window_SystemMenu)
  Panel_0 = PanelGadget(#PB_Any, 10, 10, 300, WindowHeight(Window_0) - 20)
  AddGadgetItem(Panel_0, -1, "Tab 1")
  ScrollArea_0 = ScrollAreaGadget(#PB_Any, 0, 0, GetGadgetAttribute(Panel_0,#PB_Panel_ItemWidth) - 10, GetGadgetAttribute(Panel_0,#PB_Panel_ItemHeight) - 10, 380, 560,1)
  CloseGadgetList()
  CloseGadgetList()
EndProcedure
(which was tricky to parse back :mrgreen: )

I also added a ResizeGadgets procedure that you can use if you want, it looks like this:

Code: Select all

Procedure ResizeGadgetsWindow_0()
  ResizeGadget(Panel_0, 10, 10, 300, WindowHeight(Window_0) - 20)
  ResizeGadget(ScrollArea_0, 0, 0, GetGadgetAttribute(Panel_0,#PB_Panel_ItemWidth) - 10, GetGadgetAttribute(Panel_0,#PB_Panel_ItemHeight) - 10)
EndProcedure
Just add a call to ResizeGadgetsWindow_0() in your window event procedure and all the gadgets are resized automatically!
I used to spend hours typing all ResizeGadget so that they correctly resize everything, it's just amazing not having to do it anymore.

Huge work implementing this though...!

You can test the generated code here (I just added an event loop for testing):

Code: Select all

; Form Designer for Purebasic - 5.0
; Warning: this file uses a strict syntax, if you edit it, make sure to respect the Form Designer limitation or it won't be opened again.

Global Window_0

Global Panel_0, ScrollArea_0

Declare ResizeGadgetsWindow_0()

Procedure InitWindow_0()
  Window_0 = OpenWindow(#PB_Any, 0, 0, 600, 400, "", #PB_Window_SystemMenu | #PB_Window_SizeGadget)
  Panel_0 = PanelGadget(#PB_Any, 10, 10, 300, WindowHeight(Window_0) - 20)
  AddGadgetItem(Panel_0, -1, "Tab 1")
  ScrollArea_0 = ScrollAreaGadget(#PB_Any, 0, 0, GetGadgetAttribute(Panel_0,#PB_Panel_ItemWidth) - 10, GetGadgetAttribute(Panel_0,#PB_Panel_ItemHeight) - 10, 380, 560,1)
  CloseGadgetList()
  CloseGadgetList()
EndProcedure

Procedure ResizeGadgetsWindow_0()
  ResizeGadget(Panel_0, 10, 10, 300, WindowHeight(Window_0) - 20)
  ResizeGadget(ScrollArea_0, 0, 0, GetGadgetAttribute(Panel_0,#PB_Panel_ItemWidth) - 10, GetGadgetAttribute(Panel_0,#PB_Panel_ItemHeight) - 10)
EndProcedure

Procedure Window_0_Events(event)
  Select event
    Case #PB_Event_Gadget
      Select EventGadget()
      EndSelect
  EndSelect
EndProcedure

; --- end of generated code ---

InitWindow_0()
Repeat
  event = WaitWindowEvent()
  If event = #PB_Event_SizeWindow
    ResizeGadgetsWindow_0()
  EndIf
Until event = #PB_Event_CloseWindow
Post Reply