Page 15 of 45

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

Posted: Thu Aug 30, 2012 9:27 pm
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).

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

Posted: Thu Aug 30, 2012 9:56 pm
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?

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

Posted: Thu Aug 30, 2012 10:01 pm
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".

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

Posted: Thu Aug 30, 2012 10:51 pm
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

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

Posted: Thu Aug 30, 2012 10:55 pm
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! :)

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

Posted: Thu Aug 30, 2012 11:24 pm
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

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

Posted: Thu Aug 30, 2012 11:30 pm
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 :)

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

Posted: Fri Aug 31, 2012 12:07 am
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.

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

Posted: Fri Aug 31, 2012 6:25 am
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.

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

Posted: Fri Aug 31, 2012 9:06 am
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! :)

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

Posted: Fri Aug 31, 2012 1:19 pm
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


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

Posted: Fri Aug 31, 2012 1:56 pm
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!

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

Posted: Fri Aug 31, 2012 2:16 pm
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

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

Posted: Fri Aug 31, 2012 2:42 pm
by Polo
Fixed, thanks!

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

Posted: Fri Aug 31, 2012 7:43 pm
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