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

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.

Related

How can I create a Delphi Object Inspector at run time and use my own components with it?

Like the title says. I want to add an Object Inspector to my form at rum time, and when I click other components, it should have two way data binding with them.
That is, if I, for instance, change the top property of a TPanel in the object inspector, then the panel should move; and, if I drag the panel, the object inspector should reflect its Top & Left properties.
Of course, I mean this to work for all proprieties, and select a new component each time the user clicks one at run time.
I don't even know where to start :-(
[Update] I do know, however, that I would strongly prefer to use Delphi components, and nothing 3rd party
No, you cannot use the Object Inspector in your own code. It's a proprietary part of the IDE, and it is not available as source or a component. It never has been, and I highly doubt it will ever be. It's also integrated with the rest of the IDE (the Code Editor and Form Designer), neither of which are available as components either. It's functionality is contained in packages that are design-time only, and are not licensed for use outside the IDE (you can't use them in your application).
In addition, most of the property editors that are invoked by the Object Inspector are also implemented in design-time only packages that wouldn't be available to your application either.

How keep the debug layout the same as the desktop layout

I try to have a similar layout during editing as well debugging. When running the program my structure and object inspector disappear. I did create my own desktop speedsetting, set the debug desktop to it as well, but as soon as the program runs structure and obejct inspector disappear. How can I prevent that?
A question related to this: the edit menu changes as well. A right click on a procedure name results in a popup menu with the first item being "find declaration". When debugging the first item is "close page". I find the find declaration item a fast way to find some code. Apart from that it is frustrating to lose one's code because you click "no" on the question to save the information (I know, it's my fault but menu's shouldn't change in my opinion).
Thanks,
Arnold
What version of Delphi? Dialogs and menus change between versions (and even between SKUs of the same version).
For the first, open Tools->Options->Environment Options and uncheck Hide designers on run in the Running group box (D2010, XE, and XE2), or Tools->Options->Environment Options and unchecking Hide designers on run in the Compiling and Running group box (D2007).
For the second: The right-click menu is called a context menu, meaning it displays what is appropriate in the context of when it's being shown. It's entirely appropriate for it to change depending on when and how you're using it; that's the way it's supposed to work.
Right-clicking on a .zip file in Windows Explorer is different than right-clicking on a Word .doc file, because they have different options based on context - a zip file has an 'Extract to...' option that the Word document doesn't have, because 'extracting' a Word document doesn't apply. Same applies to right-clicking a .exe file, which has the Run as Administrator option (Win7), as opposed to right-clicking a .pas file, which doesn't offer that option.

How can I interrogate the Delphi component palette?

I have lots of components installed - trouble is when I want to find one I rarely use it takes ages to find it. I can look at the ALL choice which lists all components but finding one with say 'grid' in the title is still very time consuming. Is there a database of titles or (preferably) a text file I could interrogate and search?
Try DDevExtensions 1.61, it add ability to search for components for Delphi from version 5 and above, with other many improvement for the IDE.
Which version of Delphi? In recent versions, just click on the top of the palette and type "grid". Ctrl-Alt-P will focus the palette, and then you can just start typing.
In RAD2009 and RS2010, do this and it'll find all components with "grid" anywhere in the title.
Since you didn't specify which version of Delphi...
1) In older versions (D7 and before), you can right click on the component palette to see the properties. This shows all of the components you have installed one page at a time. It isn't searchable, but at least the list shows each component's name and package, so it's easier than using the popup hints on each individual component.
2) In Delphi 7, you can select View|Component List, which brings up a searchable alphabetical list of all components. Unfortunately, it only matches on the first part of the component name. The first version of the "new" tool palette had this same limitation.
3) DDevExtensions (free) allows partial string matches in the old component palette (D5-D7), and restores something like the old palette in newer versions of Delphi (D2005 and up). It's also included in Delphi 2010 for people who prefer that style. I like how the search works in Delphi 7, but in Delphi 2010, the filtering seems a little awkward to me. It filters the components and palette pages, but if you have matching components on more than one page, they aren't all shown at the same time. You still have to click on each individual page.
4) My favourite. I prefer the new tool palette (Delphi 2005 and up). Very configurable, lets me see the component names, shows components on more than one page at a time, dockable, etc.
Bottom line. If you don't have or don't like the new tool palette, get DDevExtensions.
Before Delphi 2005: Install DDevExtensions, then choose Tools -> DDevExtensions Options -> Component Selector -> Check the "Active" box, click OK
Delphi 2005 and later: Click in the component palette and type the name of the one you want.
Use GExperts - they help a lot.

Delphi 7 - Embedded file open dialog in a form

Does anyone know if it is possible to embed a file open dialog inside your own form?
We have a tabbed dialog and on one of the tabs we want the user to be able to browse for a file with the same functionality as the the standard open dialog e.g. 'Look in' combobox, places bar, shell file list, file name comboedit with name completion etc etc.
I've looked at recreating the dialog with some 3rd party components, namely Jam Shell Browser Components
I can get most of the functionality this way, but I'm missing a couple of things e.g. the places bar and the filename auto completion\suggestion
I don't want to say it's impossible but considering the amount of ugly winapi hacks you'd probably involve I suggest "recreating the dialog with some 3rd party components" but with VirtualShellTools.
VirtualShellTools can be downloaded from this SVN archive.
And here's the google code project page.
(At least it has the filename autocompletion combobox though i am not sure if it has the places bar). Hope it helps.
The places bar is not that difficult to implement using a TListView component set to large icons. The Raize Components library also has some source that would help in this arena.
Just a small note, it's fairly easy to add an auto-completing combobox with SHAutoComplete.
See this article for details.
Maybe this Shell Controls Demo can help you.
Edit: ATM the site seems to be down. The Wayback Machine helps.
Here's the latest download link for the controls involved from the wayback machine:
I would re-create it: it shouldn't take long with the VCL Components. The autocomplete is not hard, and you can get the rest of the data if you look through the windows docs long enough.
You can try and cheat by detecting the tab change and displaying the open dialog as if it were the tab page. You will have to detect the user clicking outside of the dialog (e.g. on a different tab) and prevent it closing until you want to change tabs.
Cheers

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