Autor Beitrag
Jan_
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 22



BeitragVerfasst: Fr 02.04.04 07:48 
Für ein jatzt schon sehr gutes Programm in Delphi 5 brauche ich eine Prozedur,
Jene ist im VCL grids.pas vorhanden.
Aber sie ist leider Protekted.
Da dacht ich, sie geht einfach zu verschieben, geht nicht, sie geht auch nicht zu kopieren, es koimmt immer ein fehler beim compilen, wenn ich die Prozedur angebe,
StringGrid.Prozedur <-- prozedur nicht vorhanden.

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
  protected
    procedure ColumnMoved(FromIndex, ToIndex: Longint); override;
    procedure DrawCell(ACol, ARow: Longint; ARect: TRect;
      AState: TGridDrawState); override;
    function GetEditText(ACol, ARow: Longint): string; override;
    procedure SetEditText(ACol, ARow: Longint; const Value: string); override;
    procedure RowMoved(FromIndex, ToIndex: Longint); override;
  public
    constructor Create(AOwner: TComponent); override;
    destructor Destroy; override;
    property Cells[ACol, ARow: Integer]: string read GetCells write SetCells;
    property Cols[Index: Integer]: TStrings read GetCols write SetCols;
    property Objects[ACol, ARow: Integer]: TObject read GetObjects write SetObjects;
    property Rows[Index: Integer]: TStrings read GetRows write SetRows;


THX!

Moderiert von user profile iconMotzi: Code- durch Delphi-Tags ersetzt.
Brainiac
Ehemaliges Mitglied
Erhaltene Danke: 1



BeitragVerfasst: Fr 02.04.04 10:30 
Also normalerweise kann man eine Prozedur schon durch verschieben von 'protected' nach 'public' sichtbar machen.
Man sollte jedoch bedenken, dass eine Prozedur normalerweise nicht grundlos unter 'protected' steht.

Sag doch mal, welche Prozedur du genau verschieben wolltest.
Motzi
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 2931

XP Prof, Vista Business
D6, D2k5-D2k7 je Prof
BeitragVerfasst: Fr 02.04.04 11:27 
Also im Source der VCL würd ich auf keinen Fall herumpfuschen..! Es gibt andere Möglichkeiten auf protected-Elemente zuzugreifen..
Einfach in der Unit in der du die Methode benötigst folgendes einfügen:
ausblenden Delphi-Quelltext
1:
2:
3:
type
  THookStringGrid = class(TStringGrid)
  end;

Und wenn du auf die Methode zugreifen willst reicht bereits ein einfacher Typecast nach THookStringGrid aus um an die protected-Methoden zu kommen:
ausblenden Delphi-Quelltext
1:
THookStringGrid(StringGrid1).xyz();					

_________________
gringo pussy cats - eef i see you i will pull your tail out by eets roots!
Jan_ Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 22



BeitragVerfasst: Di 06.04.04 08:12 
@ Motzi, THX klappt!

@ Brainiac, klappt leider nicht, der compiler hängt es dort immer als fehler an!