|
<< Click to Display Table of Contents >> Navigation: Telegram > 2020 > 02 > 10 > Telegram_2020-02-10T03 |
2020-02-10T03:46:10
Alexandre what are improvements for ServerController in the coming IW17? Also would it make sense for me to use TCriticalSection to protect the access to the database or it is already included in the ServerController?
2020-02-10T03:51:25
Hi Sokel,
if I correctly understood what you want to achieve is this:
In the OnChange event in ComboBox X within the context of your Frame ComboBox Y is updated.
Within the Context of any host form where this Frame is embedded in you would like to be signaled when the selection of ComboBoxes X or Y changes.
Right?
Well, in case of 'Yes', this is what I would do:
In the frame class I would add a TNotifyEvent property, for instance OnSelectionChange
.
.
private
FOnSelectionChange: TNotifyEvent;
.
.
.
public
property OnSelectionChange: TNotifyEvent read FOnSelectionChange write FOnSelectionChange;
.
.
end;
Then, in the implementation of the events of ComboBoxes X and Y I would add:
if Assigned(FOnSelectionChange) then
FOnSelectionChange(Sender);
In the host form, where you instantiate the frame (FormCreate?), you assign a event procedure to this property in which you put your code to update the grid.
2020-02-10T03:55:28
Yes that’s what I wanna I do however I want also to keep original event handler to does the updates of the other combobox and add additional events handler that select data based on the selectedvalue to feed the DbGrid in the host form
2020-02-10T03:58:18
The original eventhandlers stay as they are except at the end, where everything is prepared, you'll add the
if Assigned(FOnSelectionChange) then
FOnSelectionChange(Sender);