Hi, I'm having problems making a TImage display when it is created at run-time. I've used virtually identical code before and it worked, so there must be something really stupid that I'm missing.
I have a class that contains the TImage in question declared thus (I will use '...' to show that there is other unrealted code there):
in newClasses.pas and added into the Uses clause of Main.pas. In Main.pas I create in instance of this class like this:
It appears to be created fine (I added showmessage('done') to various parts of the code and they all triggered, so the code is being executed), but it just isn't displaying.
Any thoughts on this one as I am stumped.
I have a class that contains the TImage in question declared thus (I will use '...' to show that there is other unrealted code there):
Code:
unit newClasses;
...
type SectorClass = class(TObject)
public
img:TImage;
...
end;
...
constructor SectorClass.Create(AOwner: TComponent);
begin
img := TEdit.Create(AOwner);
with img do
begin
Name := 'imgSector';
AutoSize := False;
Stretch := True;
Visible := True;
Top := 247;
Left := 160;
Width := 126;
Height := 91;
onClick := sectorClick;
end;
end;
in newClasses.pas and added into the Uses clause of Main.pas. In Main.pas I create in instance of this class like this:
Code:
unit Main;
...
type
TfrmMain = class(TForm)
...
private
{ Private declarations }
sectorList:SectorListClass;
public
{ Public declarations }
end;
...
procedure TfrmMain.FormCreate(Sender: TObject);
begin
sector := SectorClass.Create(frmMain);
end;
It appears to be created fine (I added showmessage('done') to various parts of the code and they all triggered, so the code is being executed), but it just isn't displaying.
Any thoughts on this one as I am stumped.