You need to create your type based on the type of TShape , made:

 Type TOperation = class(tshape) private Opname:string; procedure Opcreate(); end; 

Further, by pressing any button, this object will be created on the form. Sets the width, height, position, in general, everything that is needed to display this descendant on the form. Is displayed.

Next question itself:

How to organize it drag-and-drop? Although, as drag-and-drop works, I know, the problem itself is in accessing the ancestor event OnMouseDown , etc.

We inherited the TShape object, how to address its events?

  • one
    would you even specify the language for decency - DreamChild
  • along the way it is delphi. public and published properties are available without restrictions. what's the problem and what’s d'n'd to do with it is completely incomprehensible. - Yura Ivanov
  • Thank. Indeed, I apologize .... Yes, this is a delphi. The problem ... I create my own object, which is a descendant of TShape. How then to describe the event onclick at least? If we do this through the constructor, it is generated in the program text itself, it remains only to prompt him what to do in this event. - SCHIP
  • if I write like this: procedure Toperation.OnMouseDown (Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer); begin flag: = true; end; he swears that such an identifier is not declared. - SCHIP
  • @SCHIP, why do you write TOperation.OnMouseDown? TOperation.OnMouseDown is a property of an object of type TMouseEvent. If you want to hang the handler on the mousemove, this should be done in the form of procedure TForm1.Shape1MouseMove(....) , which can be assigned to the object Op: TOperation; in the form of Op.OnMouseMove:=Shape1MouseMove; or in Object Inspectore (if your component was installed in the palette ...). - Yura Ivanov

0