Object Controls
Object Defined Controls  
  Prior Next
 

Object Defined Controls (ODC) are completely defined by the related object which is responsible for all properties, methods and aspects of the control.   The system provides the DEFCTL OBJECT directive to create an ODC as follows:

DEFCTL OBJECT objectid = ctlid

Where:

objectid

Handle to the object that defines the control.   This object will service all property requests and any desired method calls associated with the control

ctlid

This is the number of the control which the object is to be associated with.   It must be in the range of from 1 to 32000.



*Note*

Once an Object Defined Control is defined both the object handle and CTL value will logically refer to the same object



Foundation Classes

PxPlus provides a number of foundation classes for the basic control types in the *plus/ctls directory.   These foundation classes can be used to build your own controls that respond to most of the standard system directives and property requests.

The following is a list of the foundation classes that we supply and their related function.

Class file

Description/purpose

button.pvc

This class provides the foundation for a button style control

control.pvc

The is a common class used by all the *plus/ctls control objects and provides generic logic for common properties and functions

dragdrop.pvc

This class defines the methods required to handle DRAG and DROP functionality.   The actual class does little other than provide the required method prototypes.

itemlist.pvc

This sub class is used by those controls that are required to maintain a list of items such as list boxes.

list_box.pvc

This class defines a basic list box

multi_line.pvc

This class defines a basic input field Multi-Line

radios.pvc

This sub-class is used by the "radio_button.pvc" object class to provide linkages between the various radio button ODC's that share the same CTL value .

radio_button.pvc

The class defines a basic radio button control.

These class files are designed to be inherited by your own class definition, which as a minimum will have to have a Paint method.

Example:

The following is a sample demo button ODC class definition:

 !
 ! Demo text mode button
 !
  def class "mybutton"
  like "*plus/ctls/button"
 !
  function _paint()
  c=int(col),l=int(line),w=int(cols),h=int(lines)
 !
  ml=l+int((h-1)/2)
  if h<1 or w<0 \
   then return 1
  print 'SA','RM', ! Save attributes
 !
  if not(visible) \
   then ml=-1 \
   else if not(enabled) \
         then print 'B8','black', \
         else print tbl(backcolour$="",'_colour'(backcolour$),'B?'),
                    tbl(textcolour$="",'colour'(textcolour$),'black'),;
              if focus \
               then print 'BR',
 !
  while h<>0
  if ml=l \
   then print @(c,l),pad(text$,w,2), \
   else print @(c,l),dim(w),
  l++
  h--
  wend
 !
  print 'RA',
  return 1
  end def



*Note*

Most of these foundation classes are designed to be used in conjunction with an ODC server .



  Prior Next