Hopefully this should be quite an easy one . . .
I think all I need is to get the cursor to go to the end of a spinedit box . .
I have a line of code that works out a new width of an image if the height is changed and vice versa.
The problem is that when I select everything in one of the spinedits then press a number to replace it all, first, it has nothing in there so calls the onchange event where I catch an StrToInt exception. This also puts a 0 into the spinedit box. The cursor then goes back to the beginning of the box (ie. before the 0). Then the number that was pressed is inserted into the box.
This means that if I highlight everything and press 1, I get 10 in the spinedit which is really annoying!
procedure TResize.SpinEdit1Change(Sender: TObject);
begin
if CheckBox3.Checked then
try
SpinEdit2.Value:= Round(SpinEdit1.Value * (RealImage.picture.Height/RealImage.picture.Width))
except on EConvertError do begin end;
end;
end;
procedure TResize.SpinEdit2Change(Sender: TObject);
begin
if CheckBox3.Checked then
try
SpinEdit1.Value:= Round(SpinEdit2.Value * (RealImage.picture.Width/RealImage.picture.Height))
except on EConvertError do begin end;
end;
end;
I think all I need is to get the cursor to go to the end of a spinedit box . .
I have a line of code that works out a new width of an image if the height is changed and vice versa.
The problem is that when I select everything in one of the spinedits then press a number to replace it all, first, it has nothing in there so calls the onchange event where I catch an StrToInt exception. This also puts a 0 into the spinedit box. The cursor then goes back to the beginning of the box (ie. before the 0). Then the number that was pressed is inserted into the box.
This means that if I highlight everything and press 1, I get 10 in the spinedit which is really annoying!
procedure TResize.SpinEdit1Change(Sender: TObject);
begin
if CheckBox3.Checked then
try
SpinEdit2.Value:= Round(SpinEdit1.Value * (RealImage.picture.Height/RealImage.picture.Width))
except on EConvertError do begin end;
end;
end;
procedure TResize.SpinEdit2Change(Sender: TObject);
begin
if CheckBox3.Checked then
try
SpinEdit1.Value:= Round(SpinEdit2.Value * (RealImage.picture.Width/RealImage.picture.Height))
except on EConvertError do begin end;
end;
end;