Create a Button Reusable Part

To see how reusable parts can inherit from a component such as a button, create a reusable part (in this example it is called it EOEXAM20) of type panel, and make the  ancestor of this part a button (#PRIM_PHBN):

To see inheritance information, make sure that the Show Advanced Features option is selected in the Editor Settings.

Set PRIM_PHBN as the Ancestor.

Next resize the component to make it look like a button:

Set Button Properties

Display the Details tab to see all the properties of the reusable part. Notice that it has now all the properties of a button (because its Ancestor is a button). Change the Caption to "Button A" and select Buttons as the Group property.

The button reusable part now has a caption:

Create an Event Routine

Lastly create an event routine for the Click event of the button to show a message box when it is clicked. The message box will show the name of the reusable part:

EVTROUTINE HANDLING(#COM_OWNER.Click)

Use Message_Box_Show (ok Ok Info 'The Button Is:' #Com_Owner.Name) (#Std_Obj)

ENDROUTINE

Compile the reusable part.

Source for the Button Reusable Part

This is the source code for the button reusable part:

FUNCTION OPTIONS(*DIRECT)

BEGIN_COM ROLE(*EXTENDS #PRIM_PHBN) CAPTION('Button A') DISPLAYPOSITION(1) HEIGHT(28) LEFT(0) TABPOSITION(1) TOP(0) WIDTH(128)

EVTROUTINE HANDLING(#COM_OWNER.Click)

Use Message_Box_Show (ok Ok Info 'The Button Is:' #Com_Owner.Name) (#Std_Obj)

ENDROUTINE

END_COM