home *** CD-ROM | disk | FTP | other *** search
/ PC World Komputer 1998 April B / Pcwk4b98.iso / Borland / Dbase50w / CBTSAMP.PAK / BUTTONS.CC < prev    next >
C/C++ Source or Header  |  1994-08-02  |  9KB  |  240 lines

  1. ************************************************************************************
  2. *  PROGRAM:      Buttons.cc
  3. *
  4. *  WRITTEN BY:   Borland Samples Group
  5. *
  6. *  DATE:         2/94
  7. *
  8. *  UPDATED:      6/94
  9. *
  10. *  REVISION:     $Revision:   1.51  $
  11. *
  12. *  VERSION:      dBASE FOR WINDOWS 5.0
  13. *
  14. *
  15. *  DESCRIPTION:  This is a procedure file containing class definitions for
  16. *                pushbuttons most frequently used in dBASE for Windows forms.
  17. *                These buttons contain both bitmaps, which are located in
  18. *                <_dbwinhome>\bin\dbas0009.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, then use these classes with:
  43. *                NEW syntax:  x = new OkButton(f),
  44. *                DEFINE syntax: define OkButton x of f
  45. *                FORMS DESIGNER: select the classes from the DBW Custom Classes
  46. *                                inspector when adding controls to your form.
  47. *
  48. *  NOTE:         Right now MarkCustom(control) is executed in the constructor
  49. *                of each custom control so that the control can be streamed out
  50. *                correctly during code generation, when saved through the forms
  51. *                designer.  This is temporary, and will be replaced with the
  52. *                CUSTOM keyword in the DEFINE <control> command.
  53. *******************************************************************************
  54. #include <Messdlg.h>
  55.  
  56. *******************************************************************************
  57. *******************************************************************************
  58. class OkButton(f,n) of Pushbutton(f,n) custom
  59. *******************************************************************************
  60.  
  61.    this.height = 1.50
  62.    this.width = 14.11
  63.    this.upbitmap = "Resource #20"
  64.    this.disabledbitmap = "Resource #21"
  65.    this.text = "OK"
  66.  
  67. endclass
  68.  
  69. *******************************************************************************
  70. class CloseButton(f,n) of Pushbutton(f,n) custom
  71. *******************************************************************************
  72.  
  73.    this.height = 1.50
  74.    this.width = 14.11
  75.    this.upbitmap = "Resource #20"
  76.    this.disabledbitmap = "Resource #21"
  77.    this.text = "C&lose"
  78.    this.OnClick = {;form.Close()}
  79.    this.StatusMessage = "Close this form."
  80.  
  81. endclass
  82.  
  83. *******************************************************************************
  84. *******************************************************************************
  85. class CancelButton(f,n) of Pushbutton(f,n) custom
  86. *******************************************************************************
  87.  
  88.    this.height = 1.50
  89.    this.width = 14.11
  90.    this.upbitmap = "Resource #28"
  91.    this.disabledbitmap = "Resource #29"
  92.    this.text = "Cancel"
  93.    this.OnClick = {;form.Close()}
  94.    this.StatusMessage = "Cancel this form."
  95.  
  96. endclass
  97.  
  98. *******************************************************************************
  99. *******************************************************************************
  100. class HelpButton(f,n) of Pushbutton(f,n) custom
  101. *******************************************************************************
  102.  
  103.    this.height = 1.50
  104.    this.width = 14.11
  105.    this.upbitmap = "Resource #32"
  106.    this.disabledbitmap = "Resource #33"
  107.    this.text = "Help"
  108.  
  109. endclass
  110.  
  111. *******************************************************************************
  112. *******************************************************************************
  113. class YesButton(f,n) of Pushbutton(f,n) custom
  114. *******************************************************************************
  115.  
  116.    this.height = 1.50
  117.    this.width = 14.11
  118.    this.upbitmap = "Resource #20"
  119.    this.disabledbitmap = "Resource #21"
  120.    this.text = "&Yes"
  121.  
  122. endclass
  123.  
  124.  
  125. *******************************************************************************
  126. *******************************************************************************
  127. class NoButton(f,n) of Pushbutton(f,n) custom
  128. *******************************************************************************
  129.  
  130.    this.height = 1.50
  131.    this.width = 14.11
  132.    this.upbitmap = "Resource #24"
  133.    this.disabledbitmap = "Resource #25"
  134.    this.text = "&No"
  135.  
  136. endclass
  137.  
  138. *******************************************************************************
  139. *******************************************************************************
  140. class NextButton(f,n) of Pushbutton(f,n) custom
  141. *******************************************************************************
  142.  
  143.    this.height = 1.50
  144.    this.width = 14.11
  145.    this.upbitmap = "Resource #100"
  146.    this.text = "&Next"
  147.    this.StatusMessage = "Go to next record."
  148.  
  149.    ****************************************************************************
  150.    procedure OnClick
  151.    ****************************************************************************
  152.    skip
  153.    if eof()
  154.       go bottom
  155.       AlertMessage("At the last record","Alert")
  156.    endif
  157. endclass
  158.  
  159. *******************************************************************************
  160. *******************************************************************************
  161. class PrevButton(f,n) of Pushbutton(f,n) custom
  162. *******************************************************************************
  163.  
  164.    this.height = 1.50
  165.    this.width = 14.11
  166.    this.upbitmap = "Resource #104"
  167.    this.text = "&Previous"
  168.    this.StatusMessage = "Go to previous record."
  169.  
  170.    ****************************************************************************
  171.    procedure OnClick
  172.    ****************************************************************************
  173.    skip - 1
  174.    if bof()
  175.       go top
  176.       AlertMessage("At the first record","Alert")
  177.    endif
  178.  
  179. endclass
  180.  
  181.  
  182. *******************************************************************************
  183. *******************************************************************************
  184. class InfoButton(f,n) of Pushbutton(f,n) custom
  185. *******************************************************************************
  186.  
  187.    this.height = 1.50
  188.    this.width = 14.11
  189.    this.upbitmap = "Resource #112"
  190.    this.text = "&Info"
  191.  
  192. endclass
  193.  
  194. *******************************************************************************
  195. *******************************************************************************
  196. class ToolButton(f,n) of Pushbutton(f,n) custom
  197. *******************************************************************************
  198.  
  199.    this.height = 1.50
  200.    this.width = 4
  201.    this.upbitmap = "Resource #148"
  202.    this.text = ""
  203.    this.tabstop = .f.
  204.  
  205. endclass
  206.  
  207. *******************************************************************************
  208. *******************************************************************************
  209. class ReportButton(f,n) of Pushbutton(f,n) custom
  210. *******************************************************************************
  211.  
  212.    this.UpBitmap = "RESOURCE #614"
  213.    this.Text = "Report"
  214.    this.height = 1.50
  215.    this.width = 14.11
  216.  
  217.    ****************************************************************************
  218.    procedure OnClick
  219.    ****************************************************************************
  220.    report form ?
  221.  
  222. ENDCLASS
  223.  
  224. *******************************************************************************
  225. *******************************************************************************
  226. CLASS BrowseButton(f,n) of PushButton(f,n) custom
  227. *******************************************************************************
  228.  
  229.    this.UpBitmap = "RESOURCE #610"
  230.    this.Text = "Browse"
  231.    this.height = 1.50
  232.    this.width = 14.11
  233.  
  234.    ****************************************************************************
  235.    procedure OnClick
  236.    ****************************************************************************
  237.    browse
  238.  
  239. endclass
  240.