Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- FiveWin 1.9.2 - January 97 - <b>what is and how to use a vbx control ?</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 What is and how to use a VBX control ?
--------------------------------------------------------------------------------

   For us a VBX control is an object we are going to use from our applications
   in the same manner as we use PushButtons, GETs, SAYs, Radios, CheckBoxes,
   etc... standard Windows objects.

   When you define a VBX to be used in FiveWin through the xBase commands:

      @ <nRow>, <nCol> VBX ...       // Placing a VBX on a window

      or

      REDEFINE VBX oVbx ...          // Using a VBX from a DialogBox

   FiveWin internally automatically builds a new Class which inherits from
   FiveWin Class TVbControl. This is done automatically so you don't have to
   care at all (let the computer work for you! <g>).

   As soon as the VBX object gets initialized (Borland does this for us!)
   FiveWin replaces your TVbControl object with a new object based on a
   new class built from the information contained inside the VBX. All this
   complex process is done automatically. For you, it is as easy as
   using our beloved xBase commands.

   See TVbControl FiveWin Class documentation for understand all the
   DATA and METHODs that all VBX controls have as standard.

   When FiveWin automatically inherits the new VBX Class, it adds new
   DATA and METHODs according to the VBX internal information. All VBXs
   comes with a help file explaining theirs PROPERTIES and EVENTS, and
   FiveWin turns them into new DATA and METHODs!

               VBX         ---->       FiveWin
               ===                     =======

            Properties                   DATA

              Events                    METHODs

   For example, lets suppose you are going to use Borland's SWITCH.VBX
   controls:

   According to that VBX manufacturer documentation, that VBX has a new
   property called ON which is logical and may be .t. or .f..

   When that VBX switch control is clicked or Keypressed, it generates
   two kinds of events: "ON" and "OFF" (the VBX manufacturer informs this):

   From your application you simply do:

           REDEFINE VBX oVbx ID 110 OF oDlg ;   // 110 is the ID you assign
              ON  MsgInfo( "On" ) ;
              ON OFF MsgInfo( "Off" )

  That oVbx object automatically will have the DATA On with logical type!

  CA-Clipper extraordinary and powerful PreProcessor has allowed us to
  build an incredible VBX commands which are dynamic!!! and accepts any
  kind of ON __event__ __Action__ you may specify. Great!

  So don't look inside FiveWin.ch for a ON ON ... and ON OFF clauses...
  They are processed dynamically letting us code any kind of Event
  dispatching (this is really something absolutely incredible which
  demonstrates the incredible power of CA-Clipper 5).

  Some events, according to the VBXs manufacturer documentation, may
  use some parameters, which FiveWin automatically! supplies to your
  events dispatcher:

  Suppose the VBX manufacturer specifies a "DOOROPEN" event, which
  automatically receives a numeric parameter nDirection:

  When you use that VBX in your code you type:

            REDEFINE VBX ...  ;
               ON DOOROPEN TheAction( bP1 )   // TheAction( nDirection )

  TheAction() may be any action you want to be performed there! And as
  there was just one parameter specified by the manufacturer, you only
  receives bP1 -block parameter 1- which has the same type as nDirection.
  (it is the nDirection value!!!).

  bP1, bP2, bP3,... means 'block parameter 1, 2, 3, ...', which in the
  above sample it is of numeric type. (nDirection was numeric!).

  Another sample: Suppose you are going to use a VBX which has two
  properties and three different kind of events:

       Manufacturer Info    ( Lets suppose an imaginary Phone.VBX )
       =================

    Properties:                                              Sample

       cDialNumber  --> The phone number to dial           "GO-FIVEWIN"
       lOnLine      --> If the phone line is available         .t.

    Events:
                                                             Parameters
       Dialing      --> The phone control is dialing           nTries
       OnLine       --> The call has been answered          cConectionTime
       HangUp       --> The line is off                cHangUpTime, nCallCost


     Now, we are going to use it from FiveWin:

        DEFINE DIALOG oDlg RESOURCE "PhoneCall"

        REDEFINE VBX oPhone ID ... OF oDlg ;
           ON DIALING Dial( bP1 ) ;                     // nTries value !
           ON ONLINE  Connect( bP1 ) ;                  // cConectionTime
           ON HANGUP  Finish( bP1, bP2 )                // cHangUpTime and
                                                        // cost of the call !
       ...

       ACTIVATE DIALOG oDlg ;
          ON INIT oPhone:cDialNumber := "GO-FIVEWIN"    // lOnLine will be .f.
                                                        // until it is not
                                                        // connected !

    !!! This VBX will be really useful !!! <g>

    Yes, FiveWin VBX support is simple and incredible! and we are sure
    you will become a VBXs master in just a few days!



Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson