home *** CD-ROM | disk | FTP | other *** search
/ Programming Languages Suite / ProgramD2.iso / Visual Database / Visual dBase v5.5 / CUSTOM.PAK / BUTTONS.CC < prev    next >
Encoding:
C/C++ Source or Header  |  1995-07-18  |  9.1 KB  |  264 lines

  1. ************************************************************************************
  2. *  PROGRAM:      Buttons.cc
  3. *
  4. *  WRITTEN BY:   Borland Samples Group
  5. *
  6. *  DATE:         2/94
  7. *
  8. *  UPDATED:      7/95
  9. *
  10. *  REVISION:     $Revision:   1.13  $
  11. *
  12. *  VERSION:      Visual dBASE
  13. *
  14. *
  15. *  DESCRIPTION:  This is a procedure file containing class definitions for
  16. *                pushbuttons most frequently used in Visual dBASE forms.
  17. *                These buttons contain both bitmaps, which are located in
  18. *                <_dbwinhome>\designer\form\Resource.dll, and text.
  19. *                Current Classes:
  20. *                   OkButton
  21. *                   CloseButton
  22. *                   CancelButton
  23. *                   YesButton
  24. *                   NoButton
  25. *                   NextButton
  26. *                   PrevButton
  27. *                   HelpButton
  28. *                   InfoButton
  29. *                   ToolButton
  30. *                   ReportButton
  31. *                   BrowseButton
  32. *
  33. *  PARAMETERS:   Each custom button control in this file requires 2 arguments:
  34. *                F    -- Object -- Reference to the parent form
  35. *                Name -- String -- Name of the control being created
  36. *                Example:
  37. *                   f = new form()
  38. *                   p = new OkButton(f,"myOkButton")
  39. *
  40. *  CALLS:        None
  41. *
  42. *  USAGE:        set procedure to Buttons.cc additive, then use these classes
  43. *                with:
  44. *
  45. *                NEW syntax:     x = new OkButton(f,"myOkButton"),
  46. *                DEFINE syntax:  define OkButton x of f
  47. *                FORMS DESIGNER: <Select Buttons.cc from the
  48. *                                 "Set Up Custom Controls" dialog, and then
  49. *                                 select the classes you want from the
  50. *                                 "Custom" page of the Controls Palette.>
  51. *
  52. *******************************************************************************
  53. #include <Messdlg.h>
  54.  
  55. *******************************************************************************
  56. *******************************************************************************
  57. class OkButton(f,n) of Pushbutton(f,n) custom
  58. *******************************************************************************
  59.  
  60.    this.height = 1.50
  61.    this.width = 14.11
  62.    this.upbitmap = "Resource #20"
  63.    this.disabledbitmap = "Resource #21"
  64.    this.text = "OK"
  65.    this.statusMessage = "Ok to close form"
  66.    this.speedTip = "Ok to close form"
  67.  
  68. endclass
  69.  
  70. *******************************************************************************
  71. class CloseButton(f,n) of Pushbutton(f,n) custom
  72. *******************************************************************************
  73.  
  74.    this.height = 1.50
  75.    this.width = 14.11
  76.    this.upbitmap = "Resource #1005"
  77.    this.disabledbitmap = "Resource #1006"
  78.    this.text = "C&lose"
  79.    this.OnClick = {;form.Close()}
  80.    this.statusMessage = "Close this form."
  81.    this.speedTip = "Close this form"
  82.  
  83. endclass
  84.  
  85. *******************************************************************************
  86. *******************************************************************************
  87. class CancelButton(f,n) of Pushbutton(f,n) custom
  88. *******************************************************************************
  89.  
  90.    this.height = 1.50
  91.    this.width = 14.11
  92.    this.upbitmap = "Resource #28"
  93.    this.disabledbitmap = "Resource #29"
  94.    this.text = "Cancel"
  95.    this.OnClick = {;form.Close()}
  96.    this.statusMessage = "Cancel this form."
  97.    this.speedTip = "Cancel this form"
  98.  
  99. endclass
  100.  
  101. *******************************************************************************
  102. *******************************************************************************
  103. class HelpButton(f,n) of Pushbutton(f,n) custom
  104. *******************************************************************************
  105.  
  106.    this.height = 1.50
  107.    this.width = 14.11
  108.    this.upbitmap = "Resource #32"
  109.    this.disabledbitmap = "Resource #33"
  110.    this.text = "Help"
  111.    this.speedTip = "Help with current topic"
  112.  
  113. endclass
  114.  
  115. *******************************************************************************
  116. *******************************************************************************
  117. class YesButton(f,n) of Pushbutton(f,n) custom
  118. *******************************************************************************
  119.  
  120.    this.height = 1.50
  121.    this.width = 14.11
  122.    this.upbitmap = "Resource #36"
  123.    this.disabledbitmap = "Resource #37"
  124.    this.text = "&Yes"
  125.    this.speedTip = "Answer Yes"
  126.  
  127. endclass
  128.  
  129.  
  130. *******************************************************************************
  131. *******************************************************************************
  132. class NoButton(f,n) of Pushbutton(f,n) custom
  133. *******************************************************************************
  134.  
  135.    this.height = 1.50
  136.    this.width = 14.11
  137.    this.upbitmap = "Resource #24"
  138.    this.disabledbitmap = "Resource #25"
  139.    this.text = "&No"
  140.    this.speedTip = "Answer No"
  141.  
  142. endclass
  143.  
  144. *******************************************************************************
  145. *******************************************************************************
  146. class NextButton(f,n) of Pushbutton(f,n) custom
  147. *******************************************************************************
  148.  
  149.    this.height = 1.50
  150.    this.width = 14.11
  151.    this.upbitmap = "Resource #100"
  152.    this.text = "&Next"
  153.    this.statusMessage = "Go to next record."
  154.    this.speedTip = "Next Record"
  155.  
  156.    ****************************************************************************
  157.    procedure OnClick
  158.    ****************************************************************************
  159.    if .not. empty(dbf())        && if a table is open in the current workarea
  160.       skip
  161.       if eof()
  162.          go bottom
  163.          AlertMessage("At the last record","Alert")
  164.       endif
  165.    else
  166.       InformationMessage("There is no table open in the current workarea.",;
  167.          "Info")
  168.    endif
  169. endclass
  170.  
  171. *******************************************************************************
  172. *******************************************************************************
  173. class PrevButton(f,n) of Pushbutton(f,n) custom
  174. *******************************************************************************
  175.  
  176.    this.height = 1.50
  177.    this.width = 14.11
  178.    this.upbitmap = "Resource #104"
  179.    this.text = "&Previous"
  180.    this.statusMessage = "Go to previous record."
  181.    this.speedTip = "Previous Record"
  182.  
  183.    ****************************************************************************
  184.    procedure OnClick
  185.    ****************************************************************************
  186.    if .not. empty(dbf())        && if a table is open in the current workarea
  187.       skip - 1
  188.       if bof()
  189.          go top
  190.          AlertMessage("At the first record","Alert")
  191.       endif
  192.    else
  193.       InformationMessage("There is no table open in the current workarea.",;
  194.          "Info")
  195.    endif
  196.  
  197. endclass
  198.  
  199.  
  200. *******************************************************************************
  201. *******************************************************************************
  202. class InfoButton(f,n) of Pushbutton(f,n) custom
  203. *******************************************************************************
  204.  
  205.    this.height = 1.50
  206.    this.width = 14.11
  207.    this.upbitmap = "Resource #112"
  208.    this.text = "&Info"
  209.    this.speedTip = "View Information"
  210.  
  211. endclass
  212.  
  213. *******************************************************************************
  214. *******************************************************************************
  215. class ToolButton(f,n) of Pushbutton(f,n) custom
  216. *******************************************************************************
  217.  
  218.    this.height = 1.50
  219.    this.width = 4
  220.    this.upbitmap = "Resource #144"
  221.    this.text = ""
  222.    this.tabstop = .f.
  223.    this.speedTip = "Tool"
  224.  
  225. endclass
  226.  
  227. *******************************************************************************
  228. *******************************************************************************
  229. class ReportButton(f,n) of Pushbutton(f,n) custom
  230. *******************************************************************************
  231.  
  232.    this.upBitmap = "RESOURCE #614"
  233.    this.text = "Report"
  234.    this.height = 1.50
  235.    this.width = 14.11
  236.    this.speedTip = "Show Report"
  237.  
  238.    ****************************************************************************
  239.    procedure OnClick
  240.    ****************************************************************************
  241.    report form ?
  242.  
  243. endclass
  244.  
  245. *******************************************************************************
  246. *******************************************************************************
  247. class BrowseButton(f,n) of PushButton(f,n) custom
  248. *******************************************************************************
  249.  
  250.    this.upBitmap = "RESOURCE #610"
  251.    this.text = "Browse"
  252.    this.height = 1.50
  253.    this.width = 14.11
  254.    this.speedTip = "Browse Data"
  255.  
  256.    ****************************************************************************
  257.    procedure OnClick
  258.    ****************************************************************************
  259.    browse nowait
  260.  
  261. endclass
  262.  
  263.  
  264.