Description:
How would one modify or replace the event modal dialog? I believe I can use the ExpressScheduler to make an awesome front-end to one of my apps, but I need to add a few fields to the event. I would prefer if those fields could be accessed at the same time the event is created. The event dialog would be the obvious choice.
Answer:
You can derive a custom dialog form from the required dialog form (TcxSchedulerEventEditor
or TcxSchedulerRecurrenceEventEditor
) and assign it to the corresponding dialog class variable:
Delphiinitialization
cxEventEditorClass := cxSchedulerCustomizedEventEditorForm;
cxRecurrenceEventEditorClass: TcxSchedulerRecurrenceEventEditorClass = TcxSchedulerRecurrenceCustomizedEventEditor;
end.
Override the dialog form's TcxSchedulerCustomizedEventEditorForm.LoadEventValuesIntoControls
and TcxSchedulerCustomizedEventEditorForm.DoHelperSaveChanges
to load and save custom field values:
Delphiprocedure TcxSchedulerCustomizedEventEditorForm.cxLookupComboBox1PropertiesChange(
Sender: TObject);
begin
Modified := True;
end;
procedure TcxSchedulerCustomizedEventEditorForm.DoHelperSaveChanges;
begin
inherited;
if cbCustomField.EditModified then
Event.SetCustomFieldValueByName('CustomField_Value', cbCustomField.EditValue);
end;
procedure TcxSchedulerCustomizedEventEditorForm.LoadEventValuesIntoControls;
begin
inherited;
cbCustomField.EditValue := Event.GetCustomFieldValueByName('CustomField_Value');
end;
Notes.
- Due to the particularities of the IDE's form inheritance mechanisms, you need to include the required dialog unit (cxSchedulerEventEditor~ or cxSchedulerRecurrenceEditor~) in your project.
DelphicxSchedulerEventEditor in 'C:\Program Files (x86)\DevExpress\VCL\ExpressScheduler\Sources\cxSchedulerEventEditor.pas' {cxSchedulerEventEditorForm};
- The attached project illustrates the main idea. You need to modify it according to your task requirements.
does this allso work for 12.1.x
Yes, it should work for VCL 12.1. However, I think that it will be better to refer to the similar "Customizing Event and Event recurrence dialogs" help topic instead.
I believe var "FModified" should be replaced with var "Modified" as var "FModified" is now protected (since 2013.2.2).
Quite right. Thank you for your comment.
Where do I set the TcxSchedulerRecurrenceEventEditorCustomized.FModified property to True in the code?
Vinicius,
It is convenient to enable the Modified property in the Properties.OnChange event handler of your custom editors that are used to edit additional fields in your custom dialog. I suggest that you review how it is done in our default editors in the cxSchedulerRecurrenceEditor unit. For example, in the TcxSchedulerRecurrenceEventEditorForm.deEndByPropertiesChange method.
After installing the devexpress in 2 delphi on the same machine I am having the following compilation error.
[DCC Error] cxSchedulerRecurrenceEditor.pas(58): E2003 Undeclared identifier: 'TcxSchedulerCustomEditorFormHelper'
Hello Vinicius,
I've created a separate ticket on your behalf (Undeclared identifier: 'TcxSchedulerCustomEditorFormHelper'). It has been placed in our processing queue and will be answered shortly.
Using 16.2.2 I do not see TcxSchedulerCustomEventEditor available to use in the source directory. Is there an updated version of how to do this?
Hello Michael,
This looks strange. I have checked the …\ExpressScheduler\Sources\cxSchedulerEventEditor.pas file in the latest version of our controls (16.2.2) and see that the TcxSchedulerCustomEventEditor class is still declared there. Moreover, the general approach described in this article should work with the latest build. Please review the attached small sample project where I demonstrated how to create a custom dialog with an additional field editor. This project is compatible with 16.2.2.
Hi
I am in the process of migrating from XE6(DevExpress 14.2.11) to XE10.2(DevExpress 17.1.4)
In this process I am re visiting this issue with the intention of using your new eventeditor forms with layout control as the previous work around I had been using for XE6 causes an exception in XE12.
The script in A2352 does not match my screens in XE10.2, in particular there is no option in the Delphi Project Repository for '…Then create a new dialog form using the TcxSchedulerEventEditor’s template form stored in the Object Repository…'
I have tried the dxSample from 11 months ago but when I try and compile this I get an exception
[dcc32 Fatal Error] F2084 Internal Error: AV0988CBCF-R000004CC-0
Can you please advise how I should now inherit both the Event Editor and the Resource Editor in 17.1.4.
Many Thanks
PLJ
Greetings PLJ,
Add these to you project manager source
C:\Delphi XE\Components\DevExpress\ExpressScheduler\Sources\cxSchedulerEventEditor.pas
C:\Delphi XE\Components\DevExpress\ExpressScheduler\Sources\cxSchedulerRecurrenceEditor.pas
Then select File | New | Other… and select cxSchedulerEventEditorForm and cxSchedulerRecurrenceEditorFrom (Inheritied) from the "New Items" dialog and modify these inherited forms as needed.
Mike
Well if added NEW elements it is ok, but how do I edit captions at least of the controls which are INHERITED? Changing them in MyCustomEvent.dfm (inherited) form or in Dev original cxSchedulerEventEditor.dfm doesn't influence on runtime Event dialog.
Hello,
I've created a separate ticket on your behalf (Cannot change custom dialog's captions). It has been placed in our processing queue and will be answered shortly.