&<img src="../resources/images/opentocr.png" title="Open Contents list" border="0"&>
You are here:

Reusable Part

Field Name
SECTION(Alpha 2)
Description
How to visualize a field as an ReusablePart in a grid.
You can edit a field in a list as a reusable part. The first step to this is to create the reusable part. The part form MUST have a default property in order to work as expected.
How to create the sample
1.  Create a reusable part called SECTION. Paste the reusable part code from below
2.  Create a form and copy the form code from below. Compile and run.
How it works
When creating a reusable part we ensure we follow the reusable part guidelines. We add a property to the form as follows and ensure it is made the default property for the reusable part (eg Defaultpty(Section) )
Define_Pty Name(Section) Get(Get_Section) Set(Set_Section)
The set of this property will be called when the user activates the cell in the grid. When called the property will be given the current value of the field. This is to allow the reusable part an opportunity to ensure that the correct section is selected prior to the display of the form.
The reusable part will then be made visible and the user is free to enter the new section. When the grid needs the new value for the cell it will call default property Get routine to retrieve the value and update the grid cell.
When time to commit the grid then calls the get of the default property to retrieve the reusable part value and updates its contents from the new value.
Reusable Part Source (SECTIONR)
Function Options(*DIRECT)
Begin_Com Role(*EXTENDS #PRIM_PANL) Defaultpty(Section) Displayposition(1) Height(68) Layoutmanager(#ATLM_1) Left(0) Tabposition(1) Top(0) Width(224)

Note:
To allow for a section reusable part that is filtered by department you can add an event handler for the Grid.Changed event. This handler can then access another property on the reusable part that takes the department to filter by. The reusable part can then respond by updating its contents.
&<img src="../resources/images/opentoc-dark.png" title="Open Contents List" border="0"&>