Those values are not buffered. Each call to WindowWidth() is an API call to measure the width. Whether the API does caching, I don't know.Polo wrote:That's true, though for gadget resizing inside a container there's the same issue then!Andre wrote:I just thought, it will speed up things when using a lot of gadgets, and also the generated code is better readable.
I always had in my mind that PB buffered that kind of data, we'll see what Fred or Timo say about that - if it's not buffered I'll make the change, if it is buffered I'd rather leave the functions directly
Form Designer 5.10
Re: Form Designer for Mac/Windows/Linux -5.00b2
quidquid Latine dictum sit altum videtur
Re: Form Designer for Mac/Windows/Linux -5.00b2
Thanks Timo!freak wrote:Those values are not buffered. Each call to WindowWidth() is an API call to measure the width. Whether the API does caching, I don't know.
- Fangbeast
- PureBasic Protozoa
- Posts: 4789
- Joined: Fri Apr 25, 2003 3:08 pm
- Location: Not Sydney!!! (Bad water, no goats)
Re: Form Designer for Mac/Windows/Linux -5.00b2
Really good work Polo. My eyes get worse every year but your layout seems easy to see for me.
Amateur Radio/VK3HAF, (D-STAR/DMR and more), Arduino, ESP32, Coding, Crochet
Re: Form Designer for Mac/Windows/Linux -5.00b2
Changed the calls to temp values.
Note that dynamic calls are kept for gadgets inside containers.
Note that dynamic calls are kept for gadgets inside containers.
Code: Select all
Global Window_0
Global Button_0, Button_0_1, Tree_0, Panel_0, Scrollbar_0, Scrollbar_1
Declare ResizeGadgetsWindow_0()
Procedure InitWindow_0()
Protected WindowWidth, WindowHeight
Window_0 = OpenWindow(#PB_Any, 0, 0, 600, 400, "", #PB_Window_SystemMenu | #PB_Window_MinimizeGadget | #PB_Window_MaximizeGadget | #PB_Window_SizeGadget)
WindowWidth = WindowWidth(Window_0)
WindowHeight = WindowHeight(Window_0)
Button_0 = ButtonGadget(#PB_Any, WindowWidth - 100, WindowHeight - 30, 90, 25, "Save")
Button_0_1 = ButtonGadget(#PB_Any, WindowWidth - 200, WindowHeight - 30, 90, 25, "Cancel")
Tree_0 = TreeGadget(#PB_Any, 10, 10, 210, WindowHeight - 50)
Panel_0 = PanelGadget(#PB_Any, 230, 10, WindowWidth - 240, WindowHeight - 50)
AddGadgetItem(Panel_0, -1, "Tab 1")
Scrollbar_0 = ScrollBarGadget(#PB_Any, 10, GetGadgetAttribute(Panel_0,#PB_Panel_ItemHeight) - 23, GetGadgetAttribute(Panel_0,#PB_Panel_ItemWidth) - 20, 20, 0, 0, 0)
Scrollbar_1 = ScrollBarGadget(#PB_Any, GetGadgetAttribute(Panel_0,#PB_Panel_ItemWidth) - 20, 0, 20, GetGadgetAttribute(Panel_0,#PB_Panel_ItemHeight) - 30, 0, 0, 0, #PB_ScrollBar_Vertical)
CloseGadgetList()
EndProcedure
Procedure ResizeGadgetsWindow_0()
Protected WindowWidth, WindowHeight
WindowWidth = WindowWidth(Window_0)
WindowHeight = WindowHeight(Window_0)
ResizeGadget(Button_0, WindowWidth - 100, WindowHeight - 30, 90, 25)
ResizeGadget(Button_0_1, WindowWidth - 200, WindowHeight - 30, 90, 25)
ResizeGadget(Tree_0, 10, 10, 210, WindowHeight - 50)
ResizeGadget(Panel_0, 230, 10, WindowWidth - 240, WindowHeight - 50)
ResizeGadget(Scrollbar_0, 10, GetGadgetAttribute(Panel_0,#PB_Panel_ItemHeight) - 23, GetGadgetAttribute(Panel_0,#PB_Panel_ItemWidth) - 20, 20)
ResizeGadget(Scrollbar_1, GetGadgetAttribute(Panel_0,#PB_Panel_ItemWidth) - 20, 0, 20, GetGadgetAttribute(Panel_0,#PB_Panel_ItemHeight) - 30)
EndProcedure
Procedure Window_0_Events(event)
Select event
Case #PB_Event_Gadget
Select EventGadget()
EndSelect
EndSelect
EndProcedure
InitWindow_0()
Repeat
event = WaitWindowEvent()
If event = #PB_Event_SizeWindow
ResizeGadgetsWindow_0()
EndIf
Until event = #PB_Event_CloseWindow
Re: Form Designer for Mac/Windows/Linux -5.00b2
Good news:
Form Designer will make Purebasic even easier and more productive to use, for me it is the best improvement of PB 5.00
Bad news:
a glitch,
to recreate the bug you should start FD and create a simple form and save this, e.g.:
now close FD and open it again, then open the previously saved file.
Add a new gadget as the one which existed, FD will use again the default gadget number: you will end with two gadgets with the same number.
I realized when I saw two gadgets responding to the same event
Form Designer will make Purebasic even easier and more productive to use, for me it is the best improvement of PB 5.00
Bad news:
a glitch,
to recreate the bug you should start FD and create a simple form and save this, e.g.:
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 Image_0
Global Img_0
UsePNGImageDecoder()
Img_0 = LoadImage(#PB_Any,"C:\aqua-ball-green.png")
Procedure InitWindow_0()
Window_0 = OpenWindow(#PB_Any, 0, 0, 600, 400, "", #PB_Window_SystemMenu)
Image_0 = ImageGadget(#PB_Any, 80, 40, 128, 128, ImageID(Img_0))
EndProcedure
Procedure Window_0_Events(event)
Select event
Case #PB_Event_Gadget
Select EventGadget()
EndSelect
EndSelect
EndProcedure
Add a new gadget as the one which existed, FD will use again the default gadget number: you will end with two gadgets with the same number.
I realized when I saw two gadgets responding to the same event

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 Image_0, Image_0
Global Img_0, Img_1
UsePNGImageDecoder()
Img_0 = LoadImage(#PB_Any,"C:\aqua-ball-green.png")
Img_1 = LoadImage(#PB_Any,"C:\Golf ball.png")
Procedure InitWindow_0()
Window_0 = OpenWindow(#PB_Any, 0, 0, 600, 400, "", #PB_Window_SystemMenu)
Image_0 = ImageGadget(#PB_Any, 80, 40, 128, 128, ImageID(Img_0))
Image_0 = ImageGadget(#PB_Any, 230, 110, 64, 64, ImageID(Img_1))
EndProcedure
Procedure Window_0_Events(event)
Select event
Case #PB_Event_Gadget
Select EventGadget()
EndSelect
EndSelect
EndProcedure
Re: Form Designer for Mac/Windows/Linux -5.00b2
Thanks Luciano!
I know about the gadget variable numbering - however I don't know of any easy way to handle this properly.
At the moment I just store a count per gadget (and it's not even window based) and the counts don't get updated when loading a file (that'd be quite messy)
I know about the gadget variable numbering - however I don't know of any easy way to handle this properly.
At the moment I just store a count per gadget (and it's not even window based) and the counts don't get updated when loading a file (that'd be quite messy)
Re: Form Designer for Mac/Windows/Linux -5.00b2
I'm afraid my solution is not an easy one.
Since the problem should arise only with default names, I suggest to parse the code for default names (e.g. image_xx) and when one is found and if your counter is lower then increase the variable counter to image_xx+1
these names were progressively named instead:
Since the problem should arise only with default names, I suggest to parse the code for default names (e.g. image_xx) and when one is found and if your counter is lower then increase the variable counter to image_xx+1
these names were progressively named instead:
Code: Select all
Img_0 = LoadImage(#PB_Any,"C:\aqua-ball-green.png")
Img_1 = LoadImage(#PB_Any,"C:\Golf ball.png")
Last edited by luciano on Sun Sep 02, 2012 2:19 pm, edited 1 time in total.
Re: Form Designer for Mac/Windows/Linux -5.00b2
Yes the images use dynamic names so the problem can't happen on this!
I'm gonna add the count on a per window basic first, then add it to the parser, that's important to have something that works well
I'm gonna add the count on a per window basic first, then add it to the parser, that's important to have something that works well

Re: Form Designer for Mac/Windows/Linux -5.00b2
Your image management is super fantastic,
I tested hard to break it using repated images in the form, but I could never fool it and FD generates a real optimized code, avoiding useless repeated image loading!
I tested hard to break it using repated images in the form, but I could never fool it and FD generates a real optimized code, avoiding useless repeated image loading!
Re: Form Designer for Mac/Windows/Linux -5.00b2
This was reaaaally annoying to doluciano wrote:avoiding useless repeated image loading!

Though it has to be done, considering how much memory images can use.
I added the fix for variable numbering when opening files. Variable numering is on a per window basis now which is much better.
Thanks for reporting this, otherwise i would have been too lazy to do it!

Re: Form Designer for Mac/Windows/Linux -5.00b2
I won't do intermediate releases now it's part of the official PB package, though as this still is an early beta and considering I've changed quite a few things, here's a new beta for you to test. Language files are not included.
This is for OSX, Windows and Linux.
http://www.gdpcomputing.co.uk/formdesigner.html
Please test!
(Andre, let me know if this version works for you, I've still not been able to install OSX Leopard).
This is for OSX, Windows and Linux.
http://www.gdpcomputing.co.uk/formdesigner.html
Please test!

(Andre, let me know if this version works for you, I've still not been able to install OSX Leopard).
Re: Form Designer for Mac/Windows/Linux -5.00b2 (update!)
I think, it is time to add more settings in preferences, for example:
Position and size of FormDesigner,
Default Value for: x, y, width and height of new Window
Default Value for flags (Window)
Default Value for Create Events or not.
Thats not all, but i think the most missing
Greetings - Thomas
Position and size of FormDesigner,
Default Value for: x, y, width and height of new Window
Default Value for flags (Window)
Default Value for Create Events or not.
Thats not all, but i think the most missing

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.

Old bugs good, new bugs bad! Updates are evil: might fix old bugs and introduce no new ones.

Re: Form Designer for Mac/Windows/Linux -5.00b2 (update!)
Added to todo list 
By the way, the preferences window in next version will be a .pbf file

By the way, the preferences window in next version will be a .pbf file

Re: Form Designer for Mac/Windows/Linux -5.00b2 (update!)
Gaetan, I have been fully immersed in your latest release.
WWWWOOOOOWWWW
It is a resized wow
WWWWOOOOOWWWW
It is a resized wow

Re: Form Designer for Mac/Windows/Linux -5.00b2 (update!)
Okay, a Template-File, good idea!Polo wrote:By the way, the preferences window in next version will be a .pbf file

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.

Old bugs good, new bugs bad! Updates are evil: might fix old bugs and introduce no new ones.
