> anyone know how to detect what type of cursor has been used on a button?
> eg wrong code:
> procedure TCamForm.Pic1Click(Sender: TObject);
> ncursor:Tcursor;
> begin
> ncursor:= (sender as camform).cursor;

If this is an OnClick handler then the sender will be the button that was
clicked on 'Pic1' ? So this won't help you with getting at the form responsible
for the button... I guess you could traverse up the Parent path until you hit a
TForm descendant.

It is most likely you will be able to use Self as the instance of the form but
there are situations where panels containing buttons are hijacked from another
form (invisible) to provide a sort of aggregation of functionality - In this situation
Self is not actually the form the button is visibly sitting on even though it's
event reside in the Class of Self.

var
  P :TWinControl;
begin
  if Sender is TControl then begin
    P := TControl(Sender).Parent;
    while (P<>nil) and not(P is TForm) do P := P.Parent;
  end;
  if P<>nil then begin
    {Do your stuff in here with the form that is the parent of the clicked button}
  end;
end;

--
Aaron Scott-Boddendijk
Jump Productions
(07) 838-3371 Voice
(07) 838-3372 Fax


---------------------------------------------------------------------------
    New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
                  Website: http://www.delphi.org.nz

Reply via email to