Using the following extract will somebody please tell me why, in the implementation section (blue), I must put self in front of height and width otherwise I get zero as the values??
Also why wasn't it required in the other (red) position?
The code was working without this when I first wrote it some months ago so it seems that I have done something somewhere, possibly even in the IDE that has affected it.
How can I cure this please?
Thank you
Also why wasn't it required in the other (red) position?
The code was working without this when I first wrote it some months ago so it seems that I have done something somewhere, possibly even in the IDE that has affected it.
How can I cure this please?
Thank you
Code:
interface
uses windows, graphics, classes, math, controls, SysUtils,Reuseable;
type
TBody = class(TGraphicControl)
private
FOrientation: Char; //Can be H or V or U for Upright
FPen: TPen;
FBrush: TBrush;
Fmiddle: TPoint;
procedure SetOrientation(value: Char);
procedure SetMiddle(value: TPoint);
procedure SetPen(value: TPen);
procedure SetBrush(value: TBrush);
protected
procedure Paint; override;
procedure StyleChange(sender: TObject); dynamic;
procedure MouseDown(Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);override;
procedure MouseMove(Shift: TShiftState; X, Y: integer);override;
published
procedure DblClick;override;
public
constructor Create(AOwner: TComponent); override;
destructor Destroy; override;
property Orientation: Char read FOrientation
write SetOrientation;
property middle: TPoint read Fmiddle write SetMiddle;
end;
implementation
procedure TBody.DblClick;
var temp: integer;
begin
inherited DblClick;
if (formm.AxialLock.checked) or (Forientation='U') then
exit;
{Will body fit on other wseg?}
with Board1.Wires[tag] do
begin
if wseg[bodywire xor 7].length >= max([COLOR=red][b]width,height[/b][/color]) then
begin
bodywire:=bodywire xor 7;
[COLOR=blue][b] temp:=self.height;
self.height:=self.width;
self.width:=temp;
[/b][/color] if Forientation='H' then
orientation:='V'
else if Forientation='V' then
orientation:='H';
middle:=wseg[bodyWire].middle;
end;
end;
end;