IDE: ProjectManager expands allways its items - delphi

Delphi 2007:
I have a projectgroup with a couple of projects (bpl/dll/exe). Whenever I start the Delphi IDE some of the project entries are expanded and some are not. I would like to see all of them compressed after the start but I cannot see a way to do that.
Any hints?
Chris

When you load the IDE (or a Project/ProjectGroup) does it automatically reopen whatever units you had opened in the editor the last time you closed it? If so, then I believe that the Project Explorer will always auto-expand the tree to show all active units' represenative nodes in the tree.

Related

File sort order lost in IDE

I'm constantly losing the sort order for the files in my Delphi projects:
How can I fix this? Is there a bug in my Delphi 10.4.2 IDE?
(Self answering because I finally found it, and I want to spare others the frustration)
You need to follow a specific sequence because the IDE interface closes the Sort By popup menu after every action:
If you click on e.g. Name, the IDE sorts the files once. The submenu closes immediately (i.e. no visual feedback) and nothing is remembered.
The trick is to first click on Auto Sort, then reopen the submenu, then click on Name.
Now when you save the project, the settings are written to the .local file and applied in later sessions:
<ProjectSortOrder AutoSort="-1" SortType="1">

Visual Studio Professional 2019 version 16.10.0 Can't open .sql files in SSDT project

Upgrade VS 2019 Professional to latest version 16.10.0. Open an existing SSDT project, double-click on any sql script file in the project, the file can't be opened in a tab window.
If the sql script defines a table, I can see the message: The design surface is loading. I can see the separator between design and script surfaces. If I drag the separator to resize the surfaces, the window gets refreshed and the script will open correct.
If the sql script defines a view or stored procedure, I only see blank tab window. i don't see any messages.
If I restart the VS2019, the previous opened scripts are working fine. But still the same problem whenever I want to open a script which is not opened before the restart.
Here's a link to the root Microsoft tacked issue:
https://developercommunity.visualstudio.com/t/Visual-Studio-Pro-16100---Tabs-do-not-/1434964
A quick work around to force the editor to re-draw: resize the editor window by dragging the solution explorer re-size bar.
In VS 2019 Community 16.10, I can open one SQL file at a time. So if you shut all your open SQL files, you should be able to get a single one open.
Note: even uninstalling VS and starting with a clean install from the Microsoft site did not help.
Here's a link to the MS discussion of this topic:
https://developercommunity2.visualstudio.com/t/Cannot-see-content-of-sql-files/1437162?q=%5BVisual+Studio+2019+version+16.10%5D&ftype=problem&space=8&stateGroup=active&sort=newest
I was able to get two SQL windows open at the same time, though it is quite annoying: open both files and detach both from the documents frame so they float. Pick one and move it and size it where you want. The second will disappear as you do this, but never mind.
From the Window menu, select the second file. As you move it and size it, the first one will disappear.
Now select the invisible window from the Window menu. As long as you just move around and work within these two files, you should be able to keep them both open. So this is if you need to be looking at one view while you modify another, or some such thing.
For me, two is the limit. If I try three, only two will be visible.
This was a bug and seems to be fixed in the latest patch 16.10.2 - https://learn.microsoft.com/en-us/visualstudio/releases/2019/release-notes#--visual-studio-2019-version-16102-

Delphi 10 Seattle do NOT open last used project on start

I'm new to Delphi, coming from Visual Studio it's a simple question (I guess): how do I prevent Delphi 10 Seattle to open last use project(group) when I start the IDE?
I've found some information about the .dsk file and what it does:
The .dsk file records your current settings for:
Desktop layout
Breakpoints
Watch items
Files currently open in the IDE
When you reopen the project later, the .dsk file is read, and your
desktop layout, your breakpoints, and your watches are all restored.
Also, all files that were opened when the project was closed are
opened again, regardless of whether they are used by the project.
I'm fine with that when I open a project. But please do not open it when I start the IDE. Mostly I want to start or open another project than the last one I was working on.
I've searched the options and the internet, but couldn't find a solution. Anyone?
Disable "Project desktop" in the IDE Autosave options (Tools\Options\Envinroment options).
But please do not open it when I start the IDE. Mostly I want to start or open another project than the last one
Granted, I do no have Seattle at hands, I settled in XE2.
But try changing the shortcut.
-np: No welcome page. Does not display the welcome page after starting the IDE. np also stands for No Project. Independently of Environment Options Project desktop the last opened project will not be opened
http://docwiki.embarcadero.com/RADStudio/Tokyo/en/IDE_Command_Line_Switches_and_Options
saving the layout and position of the tool windows like Refactorings,
That is what the "Layout" combo-box on the "Desktop" toolbar does. Unless you want different layouts in different projects. R-click over your IDE's tool buttons or go View|Toolbars menu to turn "Desktop" bar on. Alternatively use View|Desktops menu.

Force Delphi to open a project with chdir the project's dir

I have Delphi 6 prof, with Win7.
We have many projects. Some of them are favourites, commonly used/edited.
Formerly I used GExperts' fav. files that is shown in "Open dialog" for this.
But this is vanished with Win7.
The main problem that Delphi don't forcable to use a folder as initial folder.
What's this meaning?
When I start a Delphi with clicking on a dpr, or start with a link that points to Delphi + the needed dpr, Delphi remains in the prev. dir.
Ok, the project is opening, but I'm in the last dir that used in Delphi.
No matter that I shut down, and open the Delphi again. It is remaining in this folder.
Delphi can opens the project dir in two times:
- a.) select a dpr with opendialog
- b.) use the "closed projects" (but this have only 4 items, no more)
I tried many things.
I tried to use batchfile that prev. opens the needed dir, and next start the Delphi with the needed project.
I tried to set "starting folder" in a link. I try to find the dirs...
But no matter what I did, Delphi not use the project's folder.
This problem, because we have many same folder, and I easily miss something, confuse files, because I think I'm in good directory.
Do you have some idea, how to force Delphi to open the folder where the actual project is in?
Thanks for your help:
dd
I suspect it's a registry setting. Look at the registry and try editing the relevant values there (I don't have D6 handy, and I know it's changed in D2010 which is what I have right now).

Best Way to Replace a Visual Component in Delphi

In a Delphi Form, I would like to replace one visual component with another. Example: I want to replace a Panel component with an ElPanel from a 3rd party package.
I would like all identical properties and events of the first component to be transferred to the new one, and all the components that belong to the first component (e.g. Toolbars, memos,status bars, etc.) to end up placed on the new component exactly where they were on the first one.
Is there a best/easiest way to do this other than adding the new component to the form and meticulously transferring every property, event and component to it one-by-one?
I do it as following:
Right click on the form and choose (View as Text).
Press Ctrl + F to search for the Component class name like TPanel and replace it with TElPanel
Switch back to back to the form (View as form)
In the interface section replace the TPanel with TElPanel.
if you have many components using GExperts will be more feasible solutions.
You can use GExperts or you can do it by hand.
To do it by hand, open the .dfm in notepad and replace all the class names. (Replace TPanel with TElPanel for example). When you've made all your changes, open the .pas file with Notepad, and do the same thing.
Make sure you add the required units to your uses clause.
Then open the form in the IDE and clean up any mismatched events or unknown property problems.
If I recall the excellent free GExperts plugin does this. Right click your form and select "Replace Components". http://www.gexperts.org
IMHO, the big drawback of the Replace component GExpert is that it changes the order of the components in the source code. That is not very VCS friendly. :-)
If you have other components inside a container doing this replacement with GExperts will cause some ugly exceptions and possibly unexpected behaviour in the IDE.
So, the best solution is to edit the .dfm file where you want (inside or outside the IDE) and replace manually the types of the components that you want to change. Maybe it will cause some exceptions too, but the IDE will managed them.
If you do it inside the IDE, after switching to design view if you save the .dfm inmediately the IDE will ask you to change the type of the variables related to the components you touched, liberating you to do it.
To convert between text and binary dfm formats, use the convert.exe tool in the Delphi bin\ directory. – Tim Knipe (Oct 28 at 4:15)
You can also use the context menu of the form designer - at least with BDS 2006. It's the last menu item ("Text-DFM" in a German IDE).
In my project I had to convert few doezens forms from one set of components to another.
I have created small perl script to convert components and its properties and do all neccesary mapings.
The script is quick&dirty solution but it is highly configurable. It scanns all dfm and pas files in project direcotory and convert dfm components definitions according to rules that you should provide in ObjectBeginFound, PropertyFound, ObjectEndFound procedures/events.
DFM files should be in text mode. Tested on Delphi 5 files. I don't know if it will be compatible with newer versions. Please send posts if you find it out.
USAGE:
perl.exe cxdfm.pl > logfile.txt
DOWNLOAD LINK
http://dl.dropbox.com/u/15887789/cxdfm.pl

Resources