Jaume Posted July 2, 2013 Share Posted July 2, 2013 Hi, i'm trying to implement my own TuniDBGrid, adding the SelectedField to it: The problem i have is that i can't find the default procedure AjaxEvent to override it: TMyUniDBGrid = class(TUniDBGrid) private fSelectedField : TField; //procedure AjaxEvent(Sender: TComponent;EventName: string; Params: TStrings); override; public constructor Create(Aowner :TComponent); override; published end; procedure Register; implementation procedure Register; begin RegisterComponents('MYUNIGUI', [TSGIUniDBGrid]); end; constructor TMyUniDBGrid.Create(AOwner: TComponent); begin inherited create(AOwner); //fSelectedField := Columns[GetCol].Field; end; function TMyUniDBGrid.SelectedField: TField; begin Result := fSelectedField; end; {procedure AjaxEvent(Sender: TComponent;EventName: string; Params: TStrings); begin inherited; if SameText(EventName, 'select') then fSelectedField := Columns[StrToInt(Params.Values['colindex'])].Field; end;} So how can i implement it without having to use the OnAjaxEvent procedure? Thank you very much. Quote Link to comment Share on other sites More sharing options...
Jaume Posted July 2, 2013 Author Share Posted July 2, 2013 I will try with this code right now: function TMyUniDBGrid.SelectedField: TField; begin Result := Columns[CurrCol].Field; end; I'll let you know if it works. Quote Link to comment Share on other sites More sharing options...
Jaume Posted July 2, 2013 Author Share Posted July 2, 2013 I think this should work: function TMyUniDBGrid.SelectedField: TField; begin if ((CurrCol >= 0) and (CurrCol <= (Columns.Count-1))) then Result := Columns[CurrCol].Field else Result:= nil; end; 1 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.