2011/12/12 Bart <[email protected]>: > On 12/11/11, silvioprog <[email protected]> wrote: >> I tried to run this code, but I have not found the function >> GetCurrentEditor. > > This code just finds the active tabsheet, then finds an instance of > TEditor on it. > It'rather trivial. > > function TEditorPageControl.GetCurrentEditor: TEditor; > var > Pg: TTabSheet; > begin > Result := nil; > //ActivePageIndex = -1 when you remove the last (as in no more pages > available) page > //PageCount will still be 1 at this time > if (PageCount > 0) and (ActivePageIndex >= 0) then > begin > Pg := Pages[ActivePageIndex]; > Result := EditorAtPage(Pg); > end; > end; > > And now you want to know the implementation of EditorAtPage() > > function TEditorPageControl.EditorAtPage(const APage: TTabSheet): TEditor; > var > cc: Integer; > begin > Result := nil; > if not Assigned(APage) then Exit; > for cc := 0 to APage.ComponentCount - 1 do > begin > if APage.Components[cc] is TEditor then > begin > Result := TEditor(APage.Components[cc]); > Exit; > end; > end; > end;
Nice code. I'll test it later. > I never have had that (a PageControl inside anothe PageControl is what > you mean by that?). I think the translator was not very clear, but it would be: http://imagebin.org/188205 Thx. -- Silvio Clécio =============================================== Blog - <silvioprog.com.br> Twitter - <twitter.com/silvioprog> Facebook - <facebook.com/silvioprog> LazSolutions - <code.google.com/p/lazsolutions> Lazarus-BR - <groups.google.com.br/group/lazarus-br?hl=pt-BR> =============================================== * Conheça nosso canal IRC sobre Lazarus: #lazarus-br * =============================================== -- _______________________________________________ Lazarus mailing list [email protected] http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
