home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 7 / 07.iso / c / c083 / 20.ddi / DOC.PAK / VBX.TXT < prev   
Encoding:
Text File  |  1993-12-02  |  4.4 KB  |  122 lines

  1. This text file contains information about VBXGEN that is not included
  2. in the documentation. See the ObjectWindows Reference Guide for additional 
  3. information about VBX classes or the ObjectWindows Programmer's Guide for 
  4. instructions about writing applications that use VBX controls. For an
  5. example using VBX controls in an ObjectWindows program, see the VBXCTLX example
  6. in the \EXAMPLES\OWL\OWLAPI\VBXCTL directory. For an example using VBX controls
  7. in a C program, see the VBDIALOG example in the \EXAMPLES\WINDOWS\VBDIALOG directory.
  8.  
  9. See the online text file, BIVBX.WRI, for information about using the BIVBX
  10. library functions.
  11.  
  12.  ---------
  13. VBXGEN 1.0
  14. ==========
  15.  
  16. VBXGEN is a utility program which generates a header file (.h)
  17. from a VBX control library (.vbx). The generated header file
  18. can be used by C, C++, or OWL programs and simplifies the use
  19. of VBX controls. The header file contains a section for each
  20. control model supported by a VBX library.  Each model section
  21. contains a set of symbolic property and event names, default
  22. property data, and a custom C++ class for use with OWL programs.
  23.  
  24.  
  25. Symbolic Property and Event Names
  26.  ---------------------------------
  27. The use of symbolic property and event indices improves the
  28. performance and memory requirements of your program by
  29. eliminating the need to store and search for string names at
  30. run-time.
  31.  
  32. For example, the following code sets the bar color property of
  33. a Gauge control and requires a string search on the property name:
  34.  
  35.     VBXSetPropByName( hCtlGauge, "BarColor", RGB(0,0,0) );
  36.  
  37. By using VBXGEN to generate a header file (switch.h), the above
  38. code can be replaced by a more efficient version which uses the
  39. index of the bar color property:
  40.  
  41.     #include "switch.h"
  42.  
  43.     VBXSetProp( hCtlGauge, Prop_BIGAUGE_BarColor, RGB(0,0,0) );
  44.  
  45. Similar replacements can be performed with event-related functions.
  46. Event indices are particularly useful when defining switch statements
  47. for event processing since strings cannot be used as case labels.
  48.  
  49.  
  50. Default Property Data
  51.  ---------------------------------
  52. Some VBX controls do not operate correctly when created without
  53. a form file.  This occurs when a program creates a control
  54. dynamically rather than as part of a dialog resource.  If a
  55. control exhibits problems in this mode, try creating it with
  56. a form file created from the default property data generated
  57. in the header file.
  58.  
  59. For C/C++ programs:
  60.   HFORMFILE f = VBXCreateFormFile(sizeof(BIGAUGEData), BIGAUGEData);
  61.   HCTL g = VBXCreate(..., f);
  62.   VBXDeleteFormFile(f);
  63.  
  64. For OWL programs:
  65.   TVbxBIGAUGE* g = new TVbxBIGAUGE(..., sizeof(BIGAUGEData), BIGAUGEData);
  66.  
  67. Note that the VBXGEN_DATA or BIGAUGE_DATA symbol must be defined
  68. in order to use the default property data.
  69.  
  70.  
  71. Custom OWL Classes
  72.  ------------------
  73. VBXGEN generates a custom OWL class, derived from TVbxControl, for
  74. each control class in a VBX library. The OWL class defines simplified
  75. constructors, event handler stubs with parameter documentation,
  76. inline get and set functions for each property, and a sample
  77. response table which lists each event.
  78.  
  79. * Constructors: defines constructors which automatically fill
  80.   in the file and class name (i.e. GAUGE.VBX and BIGAUGE). For
  81.   example:
  82.  
  83.     new TVbxBIGAUGE( *window, IDC_GAUGE, "", 0, 0, 200, 30 );
  84.  
  85. * Event stubs: documents event arguments and can be used for
  86.   pasting into your own derived classes. For example:
  87.  
  88.     void EvMouseMove(VBXEVENT FAR*)
  89.     {
  90.       // Button As Integer,Shift As Integer,X As Integer,Y As Integer
  91.     }
  92.  
  93. * Get/Set functions: defines inline functions to get and set
  94.   each control property. For example:
  95.  
  96.     BOOL GetPropBarColor(COLORREF& v);
  97.     BOOL SetPropBarColor(COLORREF v);
  98.  
  99. * Response Table: defines a sample response table for pasting
  100.   into your own derived classes. For example:
  101.  
  102.     DEFINE_RESPONSE_TABLE1(TVbxBIGAUGE, TVbxControl)
  103.       EV_VBXEVENTINDEX( IDC_BIGAUGE, Event_BIGAUGE_MouseMove, EvMouseMove ),
  104.       ...
  105.     END_RESPONSE_TABLE;
  106.  
  107.  
  108. Running VBXGEN
  109.  --------------
  110. To generate a VBX header file, perform the following steps:
  111.  
  112.   1) Start VBXGEN by clicking on its icon or running it from the
  113.      Program or File Manager.
  114.  
  115.   2) Select the name of the VBX library.
  116.  
  117.   3) Select the name of the header file to be generated.
  118.  
  119.   4) VBXGEN will generate the header file and display a message
  120.      box when finished.
  121.  
  122.