Page 1 of 1

Anchor to sides

Posted: Saturday 16th January 2021 11:39pm
by squidink7
Hey there, I'm relatively new to gambas and am trying to get my applications to resize properly. I've been messing with containers but they can be a real pain sometimes and I was wondering if there was an anchor property I could set to get some objects to follow the bottom right (for example) rather than the top left that they are stuck to now. Thanks in advance!

Re: Anchor to sides

Posted: Sunday 17th January 2021 1:32am
by cage
squidink7 look in project showcase for a program written by Cedron called Resizer. It works pretty good for most things at allowing you to resize the window and it's contents. Cogier is one of the guys that knows the in and outs of what your asking about. I think if you use the search on this website you find all that you are looking for.

Re: Anchor to sides

Posted: Sunday 17th January 2021 11:43am
by squidink7
That's great! I will probably use it in my projects from now on, so thanks for letting me know about it. However it would still be nice to have an anchor option as it serves a different use case; say you wanted all the buttons and text to stay the same size but a frame in the middle to grow in size, sort of like how dolphin handles it (or whatever file manager your desktop comes with) Plus having either that or resizer integrated by default into gambas would make it more discoverable and easy to use.

Re: Anchor to sides

Posted: Sunday 17th January 2021 1:11pm
by cogier
The code that Cedron uses works but in most cases no code, or very little, is required. Have a look at a program I wrote to help people with this. It is on the 'Farm' or available here.

If you post your form here I will look at it and make it expandable for you.

If you are thinking VB then don't. Gambas does this in a very different way but once you get the hang of it you can do a lot.

Re: Anchor to sides

Posted: Sunday 17th January 2021 7:14pm
by sjsepan
squidink7 wrote: Sunday 17th January 2021 11:43am That's great! I will probably use it in my projects from now on, so thanks for letting me know about it. However it would still be nice to have an anchor option as it serves a different use case; say you wanted all the buttons and text to stay the same size but a frame in the middle to grow in size, sort of like how dolphin handles it (or whatever file manager your desktop comes with) Plus having either that or resizer integrated by default into gambas would make it more discoverable and easy to use.
Also have a peek at GambasGuiGeneric (https://gambas.one/gambasfarm/?id=675&action=search) and the DockAnchor (https://gambas.one/gambasfarm/?id=658&action=search) library it uses. These are early versions, though, and the most up-to-date copies of the DockAnchor project are on my GitHub (https://github.com/ssepan2?tab=repositories).
Downside is that it does require code, but I tried to emulate WinForms Docking/Anchoring.

To try out (that particular) project, you would need:
1) https://github.com/ssepan2/GambasGuiGeneric
2) https://github.com/ssepan2/DockAnchor
3) https://github.com/ssepan2/GambasGuiAppUtilityLib
4) https://github.com/ssepan2/GambasAppUtilityLib
5) https://github.com/ssepan2/GambasSomeModelLib

However if you just want to read the code and see how I am using DockAnchor in the GUI app, you would only need to grab the 1st two.
To run DockAnchor, you need #2 and #4.

Re: Anchor to sides

Posted: Monday 18th January 2021 4:20pm
by cogier
Let me try again. Here is a video showing a Gambas form expanding. Note that there is no code created to do this, it is all done inside the IDE.

Image

Here is the program: -
ExpandIt-0.0.1.tar.gz
(212.47 KiB) Downloaded 320 times

Re: Anchor to sides

Posted: Friday 29th January 2021 1:02pm
by squidink7
Thanks everyone! Up until now I had no idea about things like springs or using panels as spacers, or even the arrangement property. I guess Gambas just needs some better documentation to help make these things more discoverable and understandable but until then thanks again. :D