I'm working with Firemonkey in Delphi XE4 and I'm unable to create a new component using the menu item Component -> New Component.
Whether the component is a VCL or Firemonkey component or whether I create a package first the result is the same.
The Tool Palette in Delphi appears to be searched and gradually it closes leaving it empty of components and a component dialog box that says "No Items available" when it comes to selecting an ancestor component.
I have two separate installations of Delphi XE4 and the same symptoms appear on both.
It appears that Delphi believes that there are no suitable base components on which to build a new component.
Creating components is fairly straightforward in code.
Create a unit.
Add code for your component.
Add a Register procedure.
procedure Register;
begin
RegisterComponents('NewPage', [TMyComponent]);
end;
Add a declaration for Register in the implements section.
Add a call to RegisterFMXClasses in your initialization section.
implementation
uses FMX.Types;
...
initialization
RegisterFMXClasses([TMyComponent]);
end.
Create a package.
Add the unit to the package.
Right-click the package (in the top-right panel) and select Install.
(Note: It's usually best to create your component at run time whilst testing. You only need to do the package stuff once it's fairly stable).
Related
I am developing a mobile app in FMX where i need Popupmenu but it is showing disable in Tool Palette i cant use it but in VCL its enabled in Tool Palette and can use it. I just want to know if Firemonkey supports Popupmenu or my installation is having problems or we have to use other tools instead of Popupmenu in FMX? or what else can I do?
and actually i opened one VCL project and copied popupmenu from there to FMX and wrote code on one button and that code is
procedure TFRM_Party.BTN_Party_OptionClick(Sender: TObject);
begin
PopupMenu1.Popup(10,10);
PopupMenu1.Parent := Self;
end;
this code is not showing any error and also not performing also.
what to do? anybody having idea?
The short answer to your question is "Yes", you ought to be able to use the FMX version of TPopupMenu in a project created from File | New |Multi-Device Application in the IDE. If you can't find the FMX TPopupMenu on the Component Palette, something must be wrong with your Delphi install. I'm not quite sure what you mean when you say that it's "disabled" - components are usually either on the Component Palette or not, I don't recall seeing one looking disabled there.
You don't say in your question which version of Delphi you are using, but if it has FireMonkey at all, AFAIK it definitely ought to have the FMX version of TPopupMenu.
In Delphi 10.2 Seattle, for example, the FMX TPopupMenu appears on the "Standard" tab of the component palette, and is contained in the source unit FMX.Menus along with TMenuBar and TMainMenu, amongst others.
If you go to Component | Install packages in the IDE, the pop-up should show Embarcadero FMX Standard Components in the list, which is the file dclfmxstd250.bpl in the bin folder of your Delphi install. If that package isn't listed, that explains why you can't find the FMX TPopupMenu, but if that's the case for you, your Delphi ought to be lacking a lot more FMC components besides TPopupMenu. However, it should be easily solved by installing the .bpl file (or equivalent in your Delphi version). If the package is there, clicking the Components button to the bottom right of the pop-up should bring up the entire list of FXM standard components (which in my case does include TPopupMenu).
If your Delphi does include the Embarcadero FMX Standard Components but is still lacking TPopupMenu, you might try creating a new Package, adding FMX.Menus.pas to it and compiling and installing it in the IDE.
BTW, although it is possible to set up a combined FMX + VCL project (Google for how), just because you might be able to put a VCL TPopupMenu on an FMX Form doesn't mean that it's going to work.
Components are Grayed if you can't use its on current OS(your current choice in top combobox)
As the title says really. How can I add an FMX form to a delphi package? In the package I have a Tpanel descendant component - which is all installed fine. What I'd like to do is include a form in the package so that when I click on the panel at runtime the form pops up for example. (I don't want to use the FMX form at design time - just at runtime, so I just want to include the FMX form as in the package, the component has design time properties though)
It seems I can only add a VCL form to the package - when I right click and 'add new' to the package, it tries to add the VCL to the package - which I don't want. I want to run it on OSX.
I've found plenty of adding VCL forms e.g. Adding forms and frames to packages probably something obvious I'm missing - tia
Delphi XE6 on Windows 8/OSX target
Packages have affinity to a particular framework. Your package appears to be a VCL package. In the .dproj file you will find
<FrameworkType>VCL</FrameworkType>
Change this to
<FrameworkType>FMX</FrameworkType>
to have affinity to FireMonkey.
Although I've not done so recently, I expect that you get to make the framework affinity choice when you create the package. Presumably you chose VCL. Or the package was created before FMX existed and the project upgrade process added (correctly) the VCL framework setting.
Delphi XE2
I am trying out the creation of an ActiveX control for the first time.
Steps follow
1) Create ActiveX library
2) Create ActiveX Controls
Wizard field Component Name does not show my VCL component. The component is visible under installed packages and other components in that .bpl are visible in the Component Name dropdown list.
Why are some components visible whilst others not
TIA
Ephraim
VCL controls that can be wrapped in an ActiveX have to be TWinControl descendants that have not been marked as being incompatible, and that are either installed in the IDE or have had its unit added to your project. From the Delphi docwiki (emphasis mine):
In the ActiveX Control wizard, select the name of the VCL control that will be wrapped by the new ActiveX control. The dialog lists all available controls, which are descendants of TWinControl that are not registered as incompatible with ActiveX using the RegisterNonActiveX procedure.
Tip: If you do not see the control you want in the drop-down list, check whether you have installed it in the IDE or added its unit to your project.
So the first thing you have to do is ensure that your component descends from TWinControl, not just TComponent.
I am working on a component in Delphi 7 and Delphi 2006, where I am using a unit which I need to add to the .dpr file of the project on which the component is dropped automatically.
Like the way Eureka Log automatically adds the unit 'ExceptionLog' to the project file:
Can anyone tell me how to programmatically add a unit to the project file when I drop my component on any form in the project?
You most likely have to use the Open Tools API for that.
Also it might require to write a TSelectionEditor for your component to trigger the adding of the unit (I would try the RequiresUnit method).
While there is an easy way to just add a unit to the active project (code below) this just works for the active project which might not be the project the form belongs to you are adding the component to. Also it adds the unit at the end of the uses clause.
uses
ToolsAPI;
var
currentProject: IOTAProject;
begin
currentProject := GetActiveProject();
currentProject.AddFile('MyUnit.pas', True);
You can check the GExperts source code because it contains a class (TUsesManager) that can parse units and modify the uses clause.
Odd.
I used to set my default dpr to contain next to nothing as a result my toolbox was very empty. So if it was in my toolbox it was in the dpr - what are you having problems with - normally if its in the toolbox, its already in the dpr.
go Project > Eurekalog Options and disable Eurekalog.
This question already has answers here:
Closed 10 years ago.
Possible Duplicate:
How to invoke a property editor at design time
I'm creating a non-visual component, and I want the user to be able to double click on my component at design-time and have that open a design-time editor.
How can I do it?
Double-clicking a component at design time invokes a component editor. The default component editor is one that looks for event properties with certain names and creates a handler for what it finds. You can write your own component editor that does whatever you want.
Create a descendant of TComponentEditor (from the DesignEditors unit) and override the Edit method to handle double-clicks. You can also override the GetVerbCount, GetVerb, and ExecuteVerb methods to add context-menu items to your component. To get a reference to the component your editor is being asked to edit, check the Component property. Call Designer.Modified if your editor modifies the component.
Tell the IDE that your editor should be used with your component by calling RegisterComponentEditor (from DesignIntf) in your Register procedure.
You should put this code in a design-time package, separate from your component's code. Put your run-time package on the "requires" list of the design-time package. If you put everything in a single package, then consumers of your component won't be able to use run-time packages in their projects; they're not allowed to distribute the dependencies of your design-time package, which are only for use by the IDE.