![]() |
Fragen zu Assigned und Handle
Hallo,
bin momentan dabei ein schon bestehendes Programm umzuschreiben, nun bin ich auf die Abfrage gestoßen, ob eine bestimmte Assigned ist. Meine Frage ist nun, wie man etwas Assigned bekommt? Und wozu Assigned überhaupt dient. Dann wird noch der Wert Handle benutzt von dem ich nicht weiß, wie sein Wert zustande kommt, könnt ihr mir da vielleicht helfen? Tschuldigung wegen diese blöden Fragen, aber ich kann mir da wirklich keinen Reim drauf mach Gruß Lich |
Re: Fragen zu Assigned und Handle
Hallo,
Assigned checked normalerweise auf <>NIL, da NIL intern ein Pointer auf 0 (oder so ähnlich) ist, könnte das Assigned auf Handle<>0 testen, Handle=0 ist bei Windows meistens ein Fehler, also if Assigned(Handle) bedeutet, if Handle is valid Ein bissel Bsp.-Code würde helfen. Heiko |
Re: Fragen zu Assigned und Handle
Das ist der Code, der zu der Komponente ColerGrid gehört
Delphi-Quellcode:
Bei mir ist das ganze irgentwie nie Assigned und ich weiß nicht wodran es liegen könnte?
unit Clrgrid;
interface uses winTypes, classes, Graphics, grids; type TColorEvent = procedure (Sender: TObject; ARow, ACol: Longint; AState: TGridDrawState; ABrush: TBrush; AFont: TFont ) of object; TColorStringGrid = class(TStringGrid) private FonGetCellColor: TColorEvent; protected procedure DrawCell(ACol, ARow: Longint; ARect: TRect; AState: TGridDrawState); override; Published property OnGetCellColor: TColorEvent read FOnGetCellColor write FOnGetCellColor; end; procedure Register; implementation procedure Register; begin RegisterComponents('Samples',[TColorStringGrid]); end; procedure TColorStringGrid.DrawCell(ACol, ARow: Longint; ARect: TRect; AState: TGridDrawState); begin if Assigned(FOnGetCellColor) then FOnGetCellColor(Self, ARow, ACol, AState, Canvas.Brush, Canvas.Font); inherited DrawCell(ACol, ARow, ARect, AState); end;[/quote] Und hier wird überprüft, ob FOnGetCellColor Assigned ist, bevor die Funktion zum Ausfüllen der Grid gestartet wird: [quote]if Assigned(FOnGetCellColor) then FOnGetCellColor(Self, ARow, ACol, AState, Canvas.Brush, Canvas.Font); inherited DrawCell(ACol, ARow, ARect, AState); [edit=SirThornberry]Delphi-Tags gesetzt - Mfg, SirThornberry[/edit] |
Alle Zeitangaben in WEZ +1. Es ist jetzt 15:12 Uhr. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz