Forum > General

[SOLVED] Project Inspector — nodes always expanded


furious programming:
Currently, the Project Inspector window can display the tree of files existing in the project, but each time the content of this tree is changed, it collapses (sic!)... I would like the file tree in this window to always be fully expanded, every node, no matter how many there are.

Can anyone suggest what to do so that after each action regarding the file tree (adding, deleting, moving a file, etc.), the tree is expanded? Currently, any action on project files causes the tree to be collapsed (re-created?), so the hack would simply be to expand the tree right after recreating it. What and in which file do you need to add to implement such a hack?

Thank you in advance for your help.

Such a feature will considerably slow down the painting, certainly on complex programs with many branches.... And so slow down your user experience. Do you really want to do that?

(And no, there is not a solution for loosing speed in this case.)

furious programming:

--- Quote from: Thaddy on January 11, 2023, 08:26:22 pm ---Such a feature will considerably slow down the painting, certainly on complex programs with many branches....
--- End quote ---

Are you running Lazarus on your refrigerator that you're worried about the control's painting performance? What kind of answer is that anyway? Have you ever seen any other IDE (like Visual Studio Code, IntelliJ IDEA, Unity or whatever) hide the content of the project tree for fear of rendering performance?

--- Quote ---And so slow down your user experience.
--- End quote ---

Do you want to know what my "user experiences" are like?

The Project Inspector window currently it is probably the most useless window in the entire IDE. It can barely display a file tree and can't do almost anything else. I can't sort the files myself, I can't rename the file, I can't open the file directory in the file explorer, I can't keep a branch (or many branches) open, because each time a change in the tree results in the collapse of the entire tree and I have to manually expand them over and over again. And the more files I add to the project, the more time I waste expanding interesting branches and keeping them that way. This window is one big useless abomination, that is constantly irritating and keeps me wasting my time.

--- Quote ---Do you really want to do that?
--- End quote ---

No, I don't want that, I want to conveniently use the file tree as it is done in other IDEs. That's why I want to manually modify the IDE code and keep all branches up so I don't waste any more time. Is this a sufficient answer to your question?

furious programming:
Okay, I made it. A bit of a shortcut, but the important thing is that it works the way I want it to — the content of the tree is fully expanded all the time, adding and removing files does not collapse the tree (filtering as well), collapsing branches is completely disabled, and the buttons are hidden. Well, I hid this groupbox at the bottom, because I don't know what it is for and I don't use it anyway (so it is by default hidden).

If someone also needs to see the full tree of project files, here is the instruction on how to do it.

* Open the file Lazarus/ide/projectinspector.pas and show the form with F12.
* Go to the designer and select treeview.
* Go to the Object inspector window (Properties page), expand the property Options and check the tvoAutoExpand, uncheck the tvoKeepCollapsedNodes, check the tvoNoDoubleClickExpand and uncheck the tvoShowButtons.
* Go to the Object inspector window (Events page), generate OnCollapsing event and add the following line to it:
--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---procedure TProjectInspectorForm.ItemsTreeViewCollapsing(Sender: TObject; Node: TTreeNode; var AllowCollapse: Boolean);begin  AllowCollapse := False;end;
Done. If you want to additionally hide this groupbox at the bottom, select the PropsGroupBox control and set its Height to 0. Finally, select Tools -> Build Lazarus in the main IDE menu and recompile the IDE. After restarting the IDE, the project file tree will always be fully expanded and you will not be able to collapse branches (both with mouse and keyboard). Tested on Windows 10.


[0] Message Index

Go to full version