Please dont judge on simplicity of question (or questioner) -  :)

if I call the following procedure with either a TButton or Panel ctrl (for example), how can I use the class info contained within the MyObj to choose the correct Class

procedure SetThis( MyObj :TObject );
begin

  // this works -
  if pos('Button', MyObj.ClassName) > 0
  then TButton(MyObj).OnMouseDown := tmethod (not important here)
  else TButton(MyObj).OnMouseDown := tmethod; (not important here)

  // what I would like is the single assignment as could cover multiple controls / events
  TClass(MyObj).OnMouseDown := tmethod (not important here)

end;

Regards SteveG

--
_______________________________________________
lazarus mailing list
lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus

Reply via email to