Complementary guide rapidq on components/objects definition.


 
 
 

REDEFINITION OF AN  INHERITED EVENT.

 USE OF API FUNCTIONS WINDOW IN AN OBJECT TYPE.

 PARENT PROPERTY OF VISIBLE COMPONENTS.

PROTECTION OF FIELDS OBJECT.

 LIMITATIONS KNOWN.



 
 
 
 

If an inherited event is redefined within a new object, its use requires the call of the event with the key word inherit in the routine allotted has this event as indicated in the documentation of origin.  In order to avoid the use of this key word, which can be forgotten at the time of the writing of a program, one can create an event additional having the same function as that which is redefined but with an other name and called by the redefined event.
So the actions added in the redefined event will be carried out without having has to add the call of the event with the allotted key word inherit in the routine has this one.
However, it is not possible to mask the event redefined with the key word Private in the structure of the object for the user.
In the example below, the OnClick event inherited object QBUTTON is redefined with an action on its Caption property with a call of routine associated with the new On_Click event created in the object.
 

EXAMPLE:
         $TYPECHECK ON
         $Include "Rapidq.inc"

        Declare Sub routine1
        Declare Sub event_click

        Type button extends QBUTTON
          On_Click as EVENT(event_click)

          EVENT OnClick
            button.caption="check"
            if button.On_Click<>0 then CALLFUNC button.On_Click
          END EVENT
        End type

        CREATE Form AS QFORM
          Caption="Form1"
          Width=320
          Height=240
          Center
          CREATE Button1 AS button
           Caption="Button1"
           Left=34
           Top=41
           On_Click=routine1
         END CREATE
     END CREATE

     Form.ShowModal

     sub routine1
      form.Caption = "check"
     end sub