Is there a way to activate component editor menu for a concealed component in Delphi - delphi

I implemented two menu items for my component in Delphi IDE with TComponentEditor descendant. They're both supposed to be used with "right-clicking" a component on the form. But can I do this for component that is currently hidden (concealed) by other components? So I select a component with other tools (for example object inspector) and would like to activate one of my context menu items.
Shift-F10 doesn't work (at least in D5).
Bringing the component to top for this task is not an option.

Right-click the component in the Object TreeView (Shift-Alt-F11).
D7: Menu > View > Object TreeView
XE2: Menu > View > Structure
Or make a property editor with paDialog in the attributes and forward the Edit method to your component editor. Then double clicking that property or clicking the ellipsis will bring up the component editor, just like the Colums property for TDBEdit does.

If you feel like writing a something mimicking Delphi IDE's Object TreeView, I suggests you the following resources:
Populating all controls of a container object using recursion (Blog post). Using TVirtualTreeView like the Delphi IDE is better than the stock TTreeView to my opinion.
Study the commercial TLMDComponentTree
of the LMD IDE-Tools (Excerpt: This powerful control allows to use a Delphi IDE like Object TreeView. Collections, child controls etc. are automatically handled).

Related

(delphi) how to add property to child controls?

In the Delphi IDE, some components in Delphi have the ability to "add" properties to the child controls they contain in the property editor.
How can I achieve the same thing with my own TCustomPanel descendant?
Some more details:
What I want to achieve is the following: I have a very complex configuration dialog for an application with a large number of visual components.
I want to add to each of these components a "complexity index" (an integer) that will be used to show or hide the component based on a selection made by the user (a dropdown with "simple", "advanced" and "expert" options).
I understand that the property will actually belong to the parent panel but I need a way to display it, in the IDE, as if it was attached to the control it is related to.
The perfect exemples are the various "organizational" panels provided by Delphi: TGridPanel and TRelativePanel. Each of these have a ControlCollection (published) properties that is used to hold the actual states of the additional properties but I failed to locate how the property editor knows that it must attach the properties to the child controls.
Here is a screenshot of a TLabel placed inside a TRelativePanel with the relevant properties highlighted:

Delphi: Styled TMainMenu and TToolBar in TCoolBar

I'm attempting to create an application menu and toolbar in Delphi XE3 that looks like the following (from a program I have):
I'm able to replicate a portion of this look by doing the following:
Create a new VCL Forms application
Add a TMainMenu and insert template menus for File/Edit/etc.
Add a TCoolBar to the form
Add a TToolBar to the TCoolBar
Add a TToolButton to the TToolBar for each of File/Edit/etc. and choose the Group property
Delete the Menu property from the form (so no program menu shows)
Assign the MenuItem property for each TToolButton to the corresponding File/Edit/etc.
Add a second TToolBar to the TCoolBar beneath the first one
Here's what it looks like:
It's somewhat similar but is still missing all the style elements to modify the look of the new application menu.
My question is, does anyone know of how to achieve a similar look, perhaps with a third-party component library? It seems likely that the original developer used a third-party VCL library. I'd like the drop shadow in addition to the styled menus and TCoolBar.
I've tried Raize Components, TMS Advanced Toolbars & Menus, and am in the process of trying DevExpress VCL components. None of them seem to provide a solution, but perhaps I'm not familiar enough with them yet to figure it out.
Delphi has come with an ActionBands demo that can show you how to obtain this appearance "out of the box" for your menus using TActionMainMenuBar (and TActionToolBar). Just change the Style menu to XP Style in the demo:
The rest of your steps seem pretty well complete. For the images on the menu items and toolbar buttons, see the use of ImageList components in association with the TActions on the menu and toolbar in the demo.

Firemonkey and dockable forms

Is it possible to have dockable forms in FireMonkey, as I have inspected the forms properties, and there is no such property to do that.
Is there any workaround to accomplish that?
There's nothing built in, as far as I know but it shouldn't be too difficult to add in yourself. Just bear in mind that any form can parent any control on another form:
On the child form, add any controls inside a container (e.g. a TLayout).
Create the child form.
Set the Parent property of the TLayout (etc.) to the parent form (or, more probably a container on the parent form so you can set the child TLayout's alignment to alClient).
If you want to show the placement during a drag operation, experiment with the various effec ts included.
Unlike VCL, the Firemonkey does not have a built-in dockable interface for creating dock forms. But there is a commercial component for creating a complete dockable interface in FMX. The component implements dockable forms only. So far, the docked document panels are not supported (like the visual studio IDE does) and no docked toolbars. But in general, they have all the necessary functionality, including auto-hide panels and the ability to be saved/restored in/from XML.
https://www.devmachines.com/firedocking-overview.html

How can I create a context menu for a Delphi component?

I want to create a context menu for Delphi components like TDBGrid, TTreeView or similar. How can I do that?
Place a TPopupMenu onto your form and design your menu with it. Then select the component the popupmenu is meant for (DbGrid, TreeView, ...) and set it's PopupMenu property to the PopupMenu you just designed.
You can have different PopupMenus for different components.
After placing a TPopupmenu control and linking it to the desired control, if you want to change the available items in the popup menu according to the selected cell or node in a treeview use the OnContextPopup event of the control, that gives you a chance to alter the default behaivor of the Popupmenu

Delphi control that could mimic "Add-ons|Extension list" of Firefox?

My aim is to update the look of the GUI in my app. Currently my GUI contains a lot of listboxes which are used to edit some objects in an old fashioned way, that is, user double-clicks an item and a dialog is shown to modify the corresponding object.
I think a good modern approach is how Firefox displays the extensions installed (a snapshot below).
My question is about how to build such a GUI in Delphi(win32) easily? Are there any components you use mimicing such behaviour or will I just need to code this from stratch using panels? (IMO a very cumbersome job I'd like to avoid - the selection logic, resizings, etc...)
You can do something similar (not exactly) with standard components; TDBCtrlGrid, TSpeedButton,...
alt text http://img8.imageshack.us/img8/9585/imagen29ox3.png
If you're using Delphi 2007 or Delphi 2009, you might be able to do something similar using TCategoryButtons (from the 'Additional' component palette page). Drop it on a form and right click to display the popup menu, and then click "Categories Editor...". Add a category with the resulting dialog, set it's caption, and optionally set up Items it contains. Not exactly the same, but it might do what you need.
You could also use a dialog with a TTreeView (if you have categories of objects) or TListView to emulate the Delphi 2007 Projects->Options dialog. Clicking an item in the TreeView or ListView displays the proper page of a TPageControl to configure the object.
I mostly agree with Lars, but I would use a frame for each item instead of a panel. That would separate into its own file, and you would get easy designtime support for it.
Using a TFrame for each list item and put them all Aligned Top on a TScrollBox might work. Also see TDBCtrlGrid which does something like that in combination with datasets.
It can be done with existing Delphi controls.
For instance in the TCustomListBox control you can create your own OnDrawItem event to draw your own list item. You also need to create your own OnMeasureItem to change the item height.
In some cases it is very limited, so if you want more freedom you will need to do it from scratch.

Resources