Helo, I have the following stuff: selectedPanel should get the clicked panel object, and if the form is clicked, selectedPanel should be "null", nada, empty, etc :)
var
selectedBlock: Tpanel; <== fixed typo
...
procedure TForm1.stubPanelMouseDown(Sender: TObject...
begin
...
Panel:= Sender as TPanel;
if (*selectedBlock is not null*) then
begin
// ie, store the current panel
selectedBlock:= Panel;
end
else
begin
// empty the selection
*selectedBlock:= null*;
end;
So the question is: how I set that variable to "null"? Doing selectedBlock:= Unassigned throws me an error.
Thanks
EDIT: this still throws an error: access violation
if (selectedBlock=nil) then <= fixed and works
begin
selectedBlock:= Panel;
end
else
begin
selectedBlock:= nil;
end;
Pointers are set to "null" using the nil constant:
selectedBlock := nil;
Null
is a special value that only applies to Variant
and OleVariant
.