Where should I store IDE component editor user preferences? - delphi

I'm writing a component editor for the Delphi 10 Seattle IDE which has some form layout customization, such as re-sizing the form, positioning it, splitters to re-side panels, etc. I would like to save these settings so that each time the user opens this editor, it opens in the same layout they last left it.
I'm assuming the location to save such settings should reside somewhere within the HKCU section of the registry, along-side the specific Delphi IDE version settings.
Where in the registry should I save such settings?

After digging further into the registry, I'm pretty sure I found it.
HKEY_CURRENT_USER\SOFTWARE\Embarcadero\BDS\17.0\Property Editors\
It appears that other property and component editors keep their properties here, for example the TActionList. There are traces of editors storing their dimensions in this node.

Related

Can I enable texthint if styleservices is not enabled?

I'm injecting a number of forms into an existing application using a dll.
I don't control the existing application, nor do I have source code for it.
(I doubt the source code exists any more).
I want to show a TextHint in a TEdit.
In the form designer this works, but in the application it doesn't.
I traced it to the fact that StyleServices (This used to be called ThemeServices (now deprecated)) is not enabled, disabling the TextHint.
Obviously I cannot enable styles for the application, all I have is a dll.
Is there a way to show the texthint?
I prefer to use a stock TEdit.
The dll is written in DX and the old application is written in D7.
BTW I don't care a hood about any additional styling/theming or the like. I just want the texthint to display.
Is there a way to show the texthint?
Standard TextHint functionality in a stock TEdit is dependent on the EM_SETCUEBANNER message, which only works when Visual Styles are enabled:
Note To use this API, you must provide a manifest specifying Comclt32.dll version 6.0. For more information on manifests, see Enabling Visual Styles.
If Visual Styles are not enabled in the app you are injecting your code into, then the only way to do what you are asking for is to subclass the TEdit window and custom-draw it manually when its text is empty.

Where is the Component Toolbar configuration data stored in Delphi XE4?

I'm trying to customize the appearance of the Component Toolbar pages within Delphi XE4. I clicked on Tools > Options > Component Toolbar
I highlighted Data Access and moved it up underneath Standard and clicked OK. However it still shows up in the IDE Tool Palette in the original location underneath Samples.
Ray Konopka distributes a utility that moves all the Raize components to the top of the list in the Tool Palette so there's got to be a config file somewhere that I can tweek so the pages and components are in the order I'd like them to be.
Where can I find this file?
Looking at Delphi XE, it is stored in the key HKEY_CURRENT_USER\Software\Embarcadero\BDS\8.0\ToolForm\Mapping(Default), so I guess that for Delphi XE4, it will be HKEY_CURRENT_USER\Software\Embarcadero\BDS\11.0\ToolForm\Mapping(Default). To read this key, this answer should help : How to read Default Value of Registry Key

How to automatically save IDE layout in Delphi XE2?

We are having an issue in Delphi XE2 with the automated saving of the desktop layout. Under environment options I do have the Autosave options - Project Desktop checked. However, changes to the layout of the desktop are not being saved and restored each time the IDE is launched.
The workaround we have in place is to use a custom destkop layout under View | Desktops. This requires us to manually save this layout each time we make a change.
Is there another setting that needs to be enabled in order for the desktop layout (window size, position, toolbar settings, etc) to persist from session to session without requiring the developer to manually save this layout?
The way to do this is to configure a custom desktop, and then save it. You can have multiple desktops (eg., normal and debug, among others) and easily switch between them using the "Desktop SpeedSetting" combobox (and associated toolbuttons) in the main menu/toolbar of the IDE. Saving is as easy as clicking the Save button and either accepting the current name or providing a new name, and switching is choosing a named desktop from the combobox.
"Autosave project desktop" saves the open files in the code editor, and whether you're on the design or code page for each form. It also saves the build configuration (debug or release). It will save which of the selected stored desktop layout you've chosen, but not any changes to that desktop layout.

Turn off context menu for Component applied by CnPack (design time)

After I installed cnPack, right clicking on a component in my form seems to have taken away any specific items that the component itself may have applied.
eg, right clicking on any Dev Express component will usually bring up version details. Now I get a bunch of other context menu items and the Dev Express ones have disappeared.
Is there a wizard or some other option I can disable to stop this? I can't find one anywhere.
Thanks
EDIT
Restarting Delphi fixed it in the short term - but has come back again so I'd still like to find a resolution to this....
Right-click menus are controlled by component editors, and AFAIK there can only be one component editor registered to a particular class type at a time. If CnPack's design-time package is loaded after DevExpress's design-time package, then CnPack's component editor will be the last one registered and take priority.

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