Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

D Forms Library TableLayoutPanel?

Every time I try to use the D Forms Library, I run across the fact that it has no TableLayoutPanel -- which makes it practically impossible for me to make a good GUI.

Is there any TableLayoutPanel implementation out there for DFL?
How do people usually use this library without it?

Edit:

A link to another program that uses DFL would be a great bonus for an answer. :)

like image 484
user541686 Avatar asked Jul 09 '11 07:07

user541686


3 Answers

Posting as an answer because length exceeds comment length limit.

I downvoted your question because it is formulated with elements of flamebait. I would guess that your previous experience with GUI libraries was mostly with libraries supporting box layouts, such as Qt. The Win32 GUI API itself does not provide any primitives for creating box layouts - it uses absolute coordinates through and through. This remains unchanged in many OO libraries that build on top of the API, such as MFC. Some libraries, like VCL, have optional primitives for creating box layouts (panels with alignment and auto-size) - but in the end, all control repositioning has to be done by the application or the GUI framework, so something like this would need to be implemented in DFL from scratch.

So, to answer your questions:

Is there any TableLayoutPanel implementation out there for DFL?

Probably not.

How do people usually use this library without it?

They draw the controls on the form with a mouse, using Entice Designer. (The same is true for MFC/Visual Studio, VCL/Delphi IDE, etc.)


Reply to comment:

how do I put things in a table layout (e.g. two side-by-side, and one below)?

I understand that you'd like to have a fixed-height panel at the bottom, and split the remaining space into two areas which both remain half the form's width when the form is resized.

  1. In Entice Designer, place a Panel, set its dock to BOTTOM. Set its height appropriately.
  2. Place a second panel, set its dock to RIGHT.
  3. In your form's code, add the following method:
    protected override void onResize(EventArgs ea)
    {
        super.onResize(ea);
        panel2.width = this.clientRectangle.width / 2;
    }

As you can see, it can quickly get messy to get a more complicated "rubber table". I wouldn't bother, or if I really needed complex dynamic layouts, would look for another library.

Or are you saying that's a bad idea in the first place?

Definitely not my point - the advantages of semantic layouts that don't require using an IDE to build are clearly visible. It's just that due to their Win32 API roots, Windows GUI libraries rarely provide good means to build them. Of course, their absence doesn't make building GUIs impossible or even hard - people simply usually go with fixed-size forms, etc. (This is clearly visible to end users switching from Windows to KDE - most KDE dialogs are resizable, while Windows' aren't.)

like image 137
Vladimir Panteleev Avatar answered Sep 19 '22 04:09

Vladimir Panteleev


in lack of a table layout you can use the location and size properties to position stuff on the board (and maybe even implement your own table layout)

you can use the entice designer to make the gui and build further on the generated source

like image 32
ratchet freak Avatar answered Sep 20 '22 04:09

ratchet freak


Now that I'm near my code, there are two ways to manage layout. As mentioned by ratchet there is absolute positions and also docking. Docking places the item in 5 possible locations. The Top, Bottom, Left, Right, or Center (fill). You can then place a panel in one of these which can itself contain elements that are docked within it. You assign the docking value to the dock property.

Entice Designer is written with DFL.

like image 38
he_the_great Avatar answered Sep 22 '22 04:09

he_the_great