recreating vscode explorer pane

89 views
Skip to first unread message

Paul Moore

unread,
Mar 1, 2024, 5:27:08 PM3/1/24
to fltk.general
I am trying to create something that looks like the left pane of vscode. A stack of user resizable panes with title bars that can also be collapsed.

I started with TIle (constrained to only horizontal dividers) and have multiple contained widgets and that works fine. But I cant get the titles on the panes, I tried to make a window with a title to wrap each contained widget , no luck.

I also wonder if Tile is the best choice, maybe I should use Pack or Flex instead (or maybe grid). 

Any suggestions for the collapse / expand widgetage would be welcome too

Matthias Melcher

unread,
Mar 1, 2024, 6:09:55 PM3/1/24
to fltk.general
Something like the toolbar on the very left can be implemented with one or two Fl_Pack to get the toll buttons in a single column from the top and from the bottom.

The "Explorer" pane on the left has collapsible groups. We do not have a ready made widget for those, but the same functionality can often be solved either with tabs, or with a tree that has collapsible lists. Fl_Tree allows for arbitrary widgets within the tree, so you could make a tree item out of an Fl_Group. 

Collapsible groups are not too hard to implement using a groups and a check button, maybe with custom graphics. Animating them is a bit more advanced. 

Let me know which route you want to go and I will try to help.

Matthias Melcher

unread,
Mar 1, 2024, 6:11:40 PM3/1/24
to fltk.general
VS Code Explorer:
Screenshot 2024-03-02 at 00.05.33.jpg

Xcode doing the same thing with tabs (and symbols instead of text)
Screenshot 2024-03-02 at 00.04.55.jpg

moore.m...@gmail.com

unread,
Mar 1, 2024, 6:13:08 PM3/1/24
to fltkg...@googlegroups.com

I had intended to add a screen shot

 

 

From: 'Matthias Melcher' via fltk.general <fltkg...@googlegroups.com>
Sent: Friday, March 1, 2024 3:12 PM
To: fltk.general <fltkg...@googlegroups.com>
Subject: [fltk.general] Re: recreating vscode explorer pane

 

VS Code Explorer:

 

Xcode doing the same thing with tabs (and symbols instead of text)

--
You received this message because you are subscribed to the Google Groups "fltk.general" group.
To unsubscribe from this group and stop receiving emails from it, send an email to fltkgeneral...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/fltkgeneral/7f497453-6ca6-455d-9b1c-3965f2f26fd8n%40googlegroups.com.

image001.png
image002.jpg
image003.jpg

Paul Moore

unread,
Mar 1, 2024, 6:26:50 PM3/1/24
to fltk.general
they are also user resizable, thats why I used Tile

Matthias Melcher

unread,
Mar 1, 2024, 6:29:48 PM3/1/24
to fltk.general
If you want the user resizability, then the Tile is the correct choice. There is no support for the collapsible feature in FLTK though. Lemme think about this tonight and see if that's easy to implement.

Paul Moore

unread,
Mar 1, 2024, 6:46:48 PM3/1/24
to fltk.general
tile is better than flex or pack?

Matthias Melcher

unread,
Mar 2, 2024, 6:50:26 AM3/2/24
to fltk.general
Better, no. Fl_Tiles is the only widget where the enduser can interactively move the dividers between the children. Flaex and Pack do auto arrange their children, but the enduser has no influence on that.

Matthias Melcher

unread,
Mar 2, 2024, 7:38:46 AM3/2/24
to fltk.general
Ok, I wrote a rough layout of how this could be implemented. To make the code as simple and brief as possible there is no error checking etc. . And of course, the collapse and expand behavior need refinement. But the basic idea works, and every tile is user resizable.


hello.cxx

moore.m...@gmail.com

unread,
Mar 2, 2024, 12:35:22 PM3/2/24
to fltkg...@googlegroups.com

Ty, I will check this out (and convert to rust )

 

From: 'Matthias Melcher' via fltk.general <fltkg...@googlegroups.com>

--

You received this message because you are subscribed to the Google Groups "fltk.general" group.
To unsubscribe from this group and stop receiving emails from it, send an email to fltkgeneral...@googlegroups.com.

Greg Ercolano

unread,
Mar 2, 2024, 1:11:39 PM3/2/24
to fltkg...@googlegroups.com


On 3/2/24 04:38, 'Matthias Melcher' via fltk.general wrote:
Ok, I wrote a rough layout of how this could be implemented. To make the code as simple and brief as possible there is no error checking etc. . And of course, the collapse and expand behavior need refinement. But the basic idea works, and every tile is user resizable.


    That's neat and works pretty well!
    Would make a good addition to the /examples/ folder..


Matthias Melcher

unread,
Mar 3, 2024, 11:31:04 AM3/3/24
to fltk.general
er...@seriss.com schrieb am Samstag, 2. März 2024 um 19:11:39 UTC+1:

    That's neat and works pretty well!
    Would make a good addition to the /examples/ folder.

Thanks. If I find the patience to improve it before the Release, I will add it to examples. 

Paul Moore

unread,
Mar 3, 2024, 11:55:02 AM3/3/24
to fltkg...@googlegroups.com
I added a tweak to remember the original size after the shrink so that they restore to the original size.

This sample was very useful , to see somebody who knows fltk well using it. I still don't get what resizable(widget) does


From: 'Matthias Melcher' via fltk.general <fltkg...@googlegroups.com>
Sent: Sunday, March 3, 2024 8:31:04 AM
To: fltk.general <fltkg...@googlegroups.com>
Subject: Re: [fltk.general] Re: recreating vscode explorer pane
 
--
You received this message because you are subscribed to a topic in the Google Groups "fltk.general" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/fltkgeneral/6srkhNzDdGE/unsubscribe.
To unsubscribe from this group and all its topics, send an email to fltkgeneral...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/fltkgeneral/afcf2d82-b165-4a78-b176-624ca1acd796n%40googlegroups.com.

Matthias Melcher

unread,
Mar 3, 2024, 3:01:01 PM3/3/24
to fltk.general
moore.m...@gmail.com schrieb am Sonntag, 3. März 2024 um 17:55:02 UTC+1:
This sample was very useful , to see somebody who knows fltk well using it.

Thanks for the feedback. Glad I could help. If you get it to work well, maybe you can post your changes back, and we can think about adding it to the FLTK core.
 
I still don't get what resizable(widget) does

If you have multiple widgets in a group, and you set the_group->resizable(the_group), all widgets inside the group will resize. If you set the_group->resizable(child_1), only child_1 will resize, and all other widgets stay the same size (massively simplified, there is a whole chapter about resizing in the docs and many examples in the test directory).
Reply all
Reply to author
Forward
0 new messages