Description:
When a TcxDBTextEdit is focused, the Screen.ActiveControl has the type TcxCustomInnerTextEdit. In my opinion, the ActiveControl should be of the type TcxDBTextEdit. How else could I determine if ActiveControl is of the type TcxTextEdit or TcxDBTextEdit?
Answer:
By design, our editors are wrappers (to support CX styles) for inner editors which implement the editing functionality. You may use code similar to the following to obtain the editor corresponding to a particular inner control:
Delphifunction GetEditor: TcxCustomEdit;
var
AControl: TWinControl;
begin
Result := nil;
AControl := Screen.ActiveControl;
if Supports(AControl, IcxInnerEditHelper) or Supports(AControl, IcxContainerInnerControl) then
Result := TcxCustomEdit(AControl.Owner)
else
if AControl is TcxCustomEdit then
Result := TcxCustomEdit(AControl);
end;
See Also:
How to determine if a cxGrid is focused by using the ActiveControl property
I have used this function for anumber of years successfully - but i have just noticed that recently it has started to fail. If i call this with a standard edit box it is returning the owner of the control rather than the control itself. I used this previously so that the memo control would return the owner control and the same for in place editors in a grid but this seems to return the owner for everything now?
Any ideas why this has changed recently?
Hello,
To process your recent post more efficiently, I created a separate ticket on your behalf: A1102: How to obtain the CX editor corresponding to the ActiveControl property. This ticket is currently in our processing queue. Our team will address it as soon as we have any updates.