home *** CD-ROM | disk | FTP | other *** search
/ DP Tool Club 19 / CD_ASCQ_19_010295.iso / vrac / toolti.zip / README.TXT < prev    next >
Text File  |  1994-11-22  |  4KB  |  112 lines

  1. MS-OFFICE STYLE TOOLTIPS IN OWL 2.0
  2. ===================================
  3.  
  4. Introduction
  5. ------------
  6.  
  7. The latest batch of Microsoft applications includes a novel feature called
  8. tooltips.  With tooltips, as the cursor is moved over the buttons on the
  9. toolbar, a small yellow box pops up giving a short description of the
  10. button under the cursor.
  11.  
  12. This feature is currently supported by Word 6, Excel 5 and the other
  13. Office applications, and will be a feature in the next release of Visual
  14. C++ (version 2).  I present here a set of C++ classes that allows your
  15. existing Borland C++/OWL2 applications to support this functionality today!
  16.  
  17.  
  18. How to use tooltips
  19. -------------------
  20.  
  21. There are three tooltip classes in this set:
  22.  
  23.   TToolTip            the tooltip window itself
  24.   TTipControlBar    replacement for TControlBar in your application
  25.   TTipStatusBar        replacement for TStatusBar in your application
  26.  
  27. To be able to use tooltips in your application you will need to create a
  28. TToolTip object.  The constructor for this object takes no parameters and,
  29. should be put into the definition of your main application class:
  30.  
  31.   #include "tooltip.h"
  32.  
  33.   class TMyApplication : public TApplication
  34.   {
  35.     TToolTip    tooltip;
  36.  
  37.     ...
  38.  
  39. Having done that, you will need to modify your program to use the
  40. TTipControlBar and TTipStatusBar classes instead of the normal OWL
  41. TControlBar and TStatusBar.  The first parameter in the constructor to
  42. these new classes is a reference to the TToolTip object created above, to
  43. be followed by the parameters passed to the original objects:
  44.  
  45.   TControlBar* cb = new TTipControlBar(tooltip, frame);
  46.   cb->Insert(*new TButtonGadget(CM_FILENEW, CM_FILENEW));
  47.   ...
  48.  
  49.   TStatusBar *sb = new TTipStatusBar(tooltip, frame, TGadget::Recessed,
  50.                                     TStatusBar::CapsLock        |
  51.                                     TStatusBar::NumLock         |
  52.                                     TStatusBar::ScrollLock      |
  53.                                     TStatusBar::Overtype);
  54.   ...
  55.  
  56. The final stage is to modify the stringtable in your .RC file to include
  57. the tooltip messages.  To add a tooltip to a particular button, you simply
  58. need to modify the hint text message normally displayed on the status bar
  59. when the mouse is moved over the button, by adding a "\n" followed by your
  60. tooltip text:
  61.  
  62.   STRINGTABLE
  63.   {
  64.    CM_FILENEW, "Creates a new window\nNew"
  65.    CM_FILEOPEN, "Opens a window\nOpen"
  66.    CM_FILECLOSE, "Close this document\nClose"
  67.    CM_FILESAVE, "Saves this document\nSave"
  68.    ...
  69.  
  70.  
  71. Using different Tooltip styles
  72. ------------------------------
  73.  
  74. It is possible to tell the tooltip class to use different styles of
  75. presentation.  At present there are three styles of presentation:
  76.  
  77. - square border (the default)
  78. - rounded border**
  79. - shadowed
  80.  
  81. ** The square border and rounded border styles are mutually exclusive
  82.  
  83. To specify one of these styles you need to ensure that the TTooltip
  84. object instance is constructed with the style as a parameter.  Styles
  85. can also be combined together, as the following code (taken from
  86. the supplied TEST.CPP file) shows:
  87.  
  88.   TooltipApp::TooltipApp ()
  89.     :     TApplication("Tooltip Application"),
  90.         tooltip (Tip::SquareBorder | Tip::Shadow)
  91.  
  92.         
  93. Limitations in this version
  94. ---------------------------
  95.  
  96. - Does not work with TControlGadget objects.  This is because the mouse
  97.   messages are sent to the embedded control, not the control bar
  98. - Only works with other TGadget derived objects if they set the hint text
  99.   on the status bar.  You can override the MouseEnter function for the
  100.   gadget to add this functionality (see the source for TButtonGadget)
  101.  
  102.  
  103. Getting in touch with the author
  104. --------------------------------
  105.  
  106. I am distributing this code free of charge.  I don't ask for anything in
  107. return, but if you have any experiences good or bad using this code, I
  108. would appreciate hearing from you.
  109.  
  110. Steve Saxon
  111. London, England.
  112. CIS: 100321,2355