Oso wrote: ↑Tue Aug 02, 2022 4:05 pm
I'm new to this and having difficulty understanding the relationship between the form and my code. I've developed with Visual Basic in the past, which I think stores the coordinates and settings of visual objects within their own file. Does PureBasic's designer store them in this way too?
To start new form, don't write code directly.
Form > New Form
Draw your objects
Save file (as *.pbf)
In the main code, add at the beginning XInclude "xxxxx.pbf"
Then the rest of the code (Procedures and main (unique) loop)
Every time you switch
Form > Switch View/Design Code
The program rereads the ALL code or and fills in the interface or vice versa, it rewrites ALL code according to the interface data.
The only thing you can change directly in the code are the numeric values and the contents of the strings.
If you find a code on forum and want to modify it with the form designer:
! if you copy code to a blank file and save it as .pbf, IDE will not use it as form (can't switch).
You need to create form and then empty it.
- Form > New Form
- Switch to code view
- Select all (CTRL+A)
- Delete it
- Copy your code
- Save it (as *.pbf)
- Switch to visual mode
- Edit what you want
The FD works like some interface generators (in C) it is used to draw the interface but does not take care of the code.
It also has other advantages
- Generate menus (but not popups)
- Create and fill lists and tables
- Manage nested objects (tabs and splitters)
- Create the code to include image files (Form > Image Manager)
- Create procedure to resize objects according to anchors
Remember to right click on the objects to access the options.
This FD works very well (yes, take time to understand it)
I only know three shortcomings:
- The status bar does not use a variable (why?) so it always has ID 0 which is annoying when you have several windows.
- The button bar does not manage the new size of possible icons 24x24
- It does not manage popup menus (but it must be very complicated, I think)