I try to make my control change state of other controls of the same
type when they have the same GroupIndex set...
All I get is Access Violation :(
could you please take a look at my code and tell me what is wrong?
Excerpt that makes problems:
________________________________________________________
procedure TxImage.Click;
var i, cc: integer;
begin
inherited;
if FGroupIndex <> 0 then
FChecked := True
else
FChecked := not FChecked;
if Assigned(PictureON) and Assigned(PictureOFF) Then
if FChecked then Picture.Bitmap := PictureON.Bitmap
else Picture.Bitmap := PictureOFF.Bitmap;
//THIS PART MAKES PROBLEMS :(((((
if (FGroupIndex <> 0) and (Parent <> nil) and FChecked then
begin
cc := Parent.controlCount -1;
with Parent do
begin
for i := 0 to cc do
if Parent.Controls[i] is TxImage then
if TxImage(Parent.Controls[i]).FGroupIndex = FGroupIndex then
begin
TxImage(Parent.Controls[i]).Checked := False;
TxImage(Parent.Controls[i]).Invalidate;
end;
end;
end;
//THIS PART MAKES PROBLEMS :(((((
invalidate;
end;
________________________________________________________
whole code here:
http://rafb.net/paste/results/qWkjL977.html
Thanks in advance!
~spleen
[...]
my friend has helped me, and here is the final version that works:
http://rafb.net/paste/results/LbtpCl48.html
you may use it and modify as you wish -.^
Cheers!
~spleen