home *** CD-ROM | disk | FTP | other *** search
/ PC World 2002 June / PCWorld_2002-06_cd.bin / Software / Komercni / xbase / express / exd17208.r04 / exp17 / Samples / Xdemo1.prg < prev    next >
Text File  |  2002-01-30  |  41KB  |  1,445 lines

  1. /*
  2.  ╓──────────────────────────────────────────────────────────────╖
  3.  ║  Program..: XDEMO1.PRG                                       ║
  4.  ║  Author...: Roger J. Donnay                                  ║
  5.  ║  Notice...: (c) DONNAY Software Designs 1987-2001            ║
  6.  ║  Date.....: Sep 14, 2001                                     ║
  7.  ║  Notes....: eXPress Demo Program #1                          ║
  8.  ╙──────────────────────────────────────────────────────────────╜
  9.  
  10.  This sample program demonstrates a complete application that is
  11.  written in a procedural fashion using commands supported by the
  12.  DCDIALOG.CH header file.  The application includes 5 Tab Pages,
  13.  a Bar Menu, a Pop-Up Menu, a Toolbar, a Message box area,
  14.  @Say..Gets, Multiline Gets, Bitmaps, a Database browse,
  15.  combo boxes, check boxes, radio buttons, Tooltips, context help,
  16.  and printing.
  17. */
  18.  
  19.  
  20. MEMVAR aApp, oMenuBar
  21.  
  22. #include "dcdialog.ch"
  23. #include "dcbitmap.ch"
  24. #include "dccursor.ch"
  25. #include "dcprint.ch"
  26. #include "xbp.ch"
  27. #include "gra.ch"
  28. #include "appevent.ch"
  29. #include 'dmlb.ch'
  30. #include 'dcgra.ch'
  31.  
  32. #define  oTabPage1     aApp[1]
  33. #define  oTabPage2     aApp[2]
  34. #define  oTabPage3     aApp[3]
  35. #define  oTabPage4     aApp[4]
  36. #define  oTabPage5     aApp[5]
  37. #define  oTabPage6     aApp[6]
  38. #define  cBitMap1      aApp[7]
  39. #define  cBitMap2      aApp[8]
  40. #define  oBrowse       aApp[9]
  41. #define  oToolBar      aApp[10]
  42. #define  oMenuBar      aApp[11]
  43. #define  oMenuFile     aApp[12]
  44. #define  oMenuEdit     aApp[13]
  45. #define  oMenuPrint    aApp[14]
  46. #define  nMenuExit     aApp[15]
  47. #define  nMenuPack     aApp[16]
  48. #define  nMenuNext     aApp[17]
  49. #define  nMenuPrev     aApp[18]
  50. #define  nMenuTop      aApp[19]
  51. #define  nMenuBott     aApp[20]
  52. #define  nMenuFont     aApp[21]
  53. #define  nMenuList     aApp[22]
  54. #define  nMenuItem     aApp[23]
  55. #define  nRecord       aApp[24]
  56. #define  cDesc         aApp[25]
  57. #define  cType         aApp[26]
  58. #define  cSubType      aApp[27]
  59. #define  cLocation     aApp[28]
  60. #define  cMemo         aApp[29]
  61. #define  cComments     aApp[30]
  62. #define  dDateAcq      aApp[31]
  63. #define  dDateOrig     aApp[32]
  64. #define  nOrigPrice    aApp[33]
  65. #define  nApprValue    aApp[34]
  66. #define  aForSale      aApp[35]
  67. #define  aType         aApp[36]
  68. #define  aSubType      aApp[37]
  69. #define  aLocation     aApp[38]
  70. #define  xSpare1       aApp[39]
  71. #define  oCheckGroup   aApp[40]
  72. #define  lOriginal     aApp[41]
  73. #define  nForSale      aApp[42]
  74. #define  oRadioGroup   aApp[43]
  75. #define  cCondition    aApp[44]
  76. #define  n3State       aApp[45]
  77. #define  xSpare2       aApp[46]
  78. #define  oFontDlg      aApp[47]
  79. #define  oMsgBox1      aApp[48]
  80. #define  oPhoto1       aApp[49]
  81. #define  oPhoto2       aApp[50]
  82. #define  aGetList      aApp[51]
  83. #define  aGetOptions   aApp[52]
  84. #define  cSource       aApp[53]
  85. #define  aPres         aApp[54]
  86. #define  xSpare3       aApp[55]
  87. #define  xSpare4       aApp[56]
  88. #define  aColors       aApp[57]
  89. #define  aChildList    aApp[58]
  90. #define  oNextButton   aApp[59]
  91. #define  oPrevButton   aApp[60]
  92. #define  oTopButton    aApp[61]
  93. #define  oBottButton   aApp[62]
  94. #define  oBrowBox      aApp[64]
  95. #define  oMenuMemo     aApp[65]
  96. #define  oMemo         aApp[66]
  97. #define  oTabPage7     aApp[67]
  98. #define  oCrt          aApp[68]
  99. #define  oMsgBox2      aApp[69]
  100. #define  oTab1Static   aApp[70]
  101. #define  oTab2Static   aApp[71]
  102. #define  oTab3Static   aApp[72]
  103. #define  oTab4Static   aApp[73]
  104. #define  oTab5Static   aApp[74]
  105. #define  oTab6Static   aApp[75]
  106. #define  oTab7Static   aApp[76]
  107. #define  oDlgWindow    aApp[77]
  108. #define  nMenuFile     aApp[78]
  109. #define  nMenuEdit     aApp[79]
  110. #define  nMenuPrint    aApp[80]
  111. #define  oDlg          aApp[81]
  112. #define  cTitle        aApp[82]
  113. #define  bForSale      aApp[83]
  114. #define  cAlias        aApp[84]
  115. #define  cSayFont      aApp[85]
  116. #define  cGetFont      aApp[86]
  117. #define  nColPixels    aApp[87]
  118. #define  nRowPixels    aApp[88]
  119. #define  nWidth        aApp[89]
  120. #define  nHeight       aApp[90]
  121. #define  nSayWidth     aApp[91]
  122.  
  123.  
  124. FUNCTION XDemo_1 ( oDialog )
  125.  
  126. STATIC slIsRunning := .f.
  127.  
  128. #ifdef EXPRESS17
  129. LOCAL nTransColor := DC_BitmapTransparentColor({192,192,192})
  130. #endif
  131. LOCAL GetOptions, GetList := {}, aApp[100], aPopup
  132.  
  133. IF slIsRunning
  134.   DC_Winalert('This program is running in another window')
  135.   RETURN nil
  136. ENDIF
  137.  
  138. slIsRunning := .t.
  139.  
  140. aPopup := DC_GetPopupCaption({'12.Alaska Crt',BITMAP_PICKLIST,1})
  141.  
  142. SET DELETED ON
  143. SET DEFA TO
  144. SET PATH TO ..\DATA
  145. SET DATE FORMAT TO 'mm/dd/yyyy'
  146.  
  147. IF Select('COLLECT') = 0
  148.   USE COLLECT VIA DBFNTX NEW SHARED
  149. ELSE
  150.   dbSelectArea('COLLECT')
  151. ENDIF
  152.  
  153. aType := { 'HollyWood','Sports','Star-Trek','Comics','Books','Other' }
  154.  
  155. aSubType  := ;
  156.   { 'Artifact','Document','Signature','Photo','Trading-Card','Other' }
  157.  
  158. aLocation  := ;
  159.   { 'Bedroom Safe','On Wall','Safe Deposit',"Don't Know",'Secret','Other' }
  160.  
  161. aForSale := { 'Not for Sale','For Sale','Not Sure' }
  162.  
  163. aPres := ;
  164.   { { XBP_PP_COL_HA_FGCLR, GRA_CLR_WHITE },     /*  Header FG Color  */     ;
  165.     { XBP_PP_COL_HA_BGCLR, GRA_CLR_DARKGRAY },  /*  Header BG Color  */     ;
  166.     { XBP_PP_COL_HA_ALIGNMENT, XBPALIGN_HCENTER }, /*  Align Header  */     ;
  167.     { XBP_PP_COL_DA_ROWSEPARATOR, XBPCOL_SEP_DOTTED },   /* Row Sep  */     ;
  168.     { XBP_PP_COL_DA_COLSEPARATOR, XBPCOL_SEP_DOTTED },   /* Col Sep  */     ;
  169.     { XBP_PP_COL_DA_ROWHEIGHT, 20 },                   /* Row Height */     ;
  170.     { XBP_PP_COL_DA_CELLHEIGHT, 20 },                 /* Cell Height */     ;
  171.     { XBP_PP_COL_DA_HILITE_FGCLR, GRA_CLR_BLUE }, /* Cursor FG Color*/     ;
  172.     { XBP_PP_COL_DA_HILITE_BGCLR, GRA_CLR_YELLOW } } /* Cursor BG Color*/
  173.  
  174. bForSale := {|n|IIF(n==NIL.OR.COLLECT->for_sale=n,COLLECT->for_sale,COLLECT->for_sale:=n)}
  175.  
  176. aColors := { {GRA_CLR_BLACK,GRA_CLR_GREEN}, ;
  177.              {GRA_CLR_BLACK,GRA_CLR_RED}, ;
  178.              {GRA_CLR_BLACK,GRA_CLR_BLUE} }
  179.  
  180. cAlias := 'COLLECT'
  181.  
  182. cTitle := 'My Personal Collection Inventory'
  183.  
  184. cSource := MemoRead('XDEMO1.PRG')
  185. IF Empty(cSource)
  186.   cSource := MemoRead('..\PRG\XDEMO1.PRG')
  187. ENDIF
  188. IF Empty(cSource)
  189.   cSource := 'XDEMO1.PRG cannot be found'
  190. ENDIF
  191.  
  192. XDemo1_LoadFields( aApp, -1 )
  193.  
  194. _BuildGets( @GetList, aApp, oDialog )
  195.  
  196. nRecord    := COLLECT->(RecNo())
  197. aGetList   := GetList
  198.  
  199. /* -- Build Options Array -- */
  200.  
  201. nWidth := AppDeskTop():currentSize()[1]
  202. nHeight := AppDeskTop():currentSize()[2]
  203.  
  204. IF nWidth <= 800
  205.   nSayWidth := 130
  206.   cSayFont := '8.Helv'
  207.   cGetFont := '10.Courier'
  208.   nColPixels := 7
  209.   nRowPixels := 20
  210. ELSEIF nWidth <= 1024
  211.   cSayFont := '10.Helv'
  212.   cGetFont := '12.Courier'
  213.   nSayWidth := 160
  214.   nColPixels := 8.5
  215.   nRowPixels := 24
  216. ELSEIF nWidth <= 1280
  217.   cSayFont := '12.Helv'
  218.   cGetFont := '14.Courier'
  219.   nSayWidth := 190
  220.   nColPixels := 10
  221.   nRowPixels := 28
  222. ELSE
  223.   cSayFont := '14.Helv'
  224.   cGetFont := '16.Courier'
  225.   nSayWidth := 210
  226.   nColPixels := 11.5
  227.   nRowPixels := 32
  228. ENDIF
  229.  
  230. DCGETOPTIONS ;
  231.    SAYWIDTH nSayWidth ;
  232.    NAME 'COLLECT' ;
  233.    SAYOPTIONS XBPSTATIC_TEXT_BOTTOM ;
  234.    HELPFILE {|c|DisplayHelp(c)} ;
  235.    AUTORESIZE ;
  236.    NOMAXBUTTON ;
  237.    TABSTOP ;
  238.    FONT cSayFont ;
  239.    SAYFONT cSayFont ;
  240.    GETFONT cGetFont ;
  241.    ROWPIXELS nRowPixels ;
  242.    ROWSPACE nRowPixels ;
  243.    COLPIXELS nColPixels ;
  244.    ABORTQUERY ;
  245.    CLOSEQUERY MSG {||DC_MsgBox(,, ;
  246.       {'Are you sure you want to Exit this program?'},,,,.t.) } ;
  247.    EVAL {|o|SetAppWindow(o)} ;
  248.    TOOLTIPCOLOR GRA_CLR_BLACK, GRA_CLR_YELLOW ;
  249.    HILITEGETS GRA_CLR_RED ;
  250.    BUTTONSOUND { 'type.wav' } ;
  251.    CASCADE
  252.  
  253. DCREAD GUI ;
  254.    PARENT @oDlg ;
  255.    TITLE cTitle ;
  256.    OPTIONS GetOptions ;
  257.    APPWINDOW oDialog ;
  258.    EVAL {||oDialog:show()} ;
  259.    WRITESOURCE 'XDEMO1.SRC' ;
  260.    FIT
  261.  
  262. #ifdef EXPRESS17
  263. DC_BitmapTransparentColor(nTransColor)
  264. #endif
  265.  
  266. IF !Empty(Alias())
  267.   dbCloseAll()
  268. ENDIF
  269.  
  270. DC_GetPopupCaption(aPopup)
  271.  
  272. slIsRunning := .f.
  273.  
  274. RETURN nil
  275.  
  276. * ---------------------
  277.  
  278. STATIC PROCEDURE _BuildGets ( GetList, aApp, oDialog )
  279.  
  280. LOCAL xNIL, aCoords
  281.  
  282. GetList := {}
  283.  
  284. DC_DotHotKey(xbeK_ALT_F12)
  285.  
  286. /* ---- Tab Page #1 ---- */
  287.  
  288. @  .5,1 DCTABPAGE oTabPage1 CAPTION 'C&ollection' ;
  289.    SIZE 74,14.8 PREOFFSET 0 POSTOFFSET 85 ;
  290.    MESSAGE {||'General information about the Collectible'} INTO oMsgBox1 ;
  291.    TITLE 'TAB-PAGE 1 (Collection)' ;
  292.    ACCELKEY xbeK_ALT_O ;
  293.    STATICAREA oTab1Static ;
  294.    HELPCODE 'COLLECTION' ;
  295.    GOTFOCUS {||SetAppFocus(DC_GetObject(GetList,'DESCRIPTION'))}
  296.  
  297. @  1,2  DCSAY "Description" GET cDesc ;
  298.    SAYRIGHTBOTTOM ;
  299.    PARENT oTab1Static ;
  300.    SAYSIZE 10 ;
  301.    TABSTOP ;
  302.    SAYTOOLTIP 'Enter the description of this item' ;
  303.    MESSAGE 'Keep description short.  You can add more in memo' INTO oMsgBox2 ;
  304.    VALID { || IIF(Empty(cDesc),DC_WinAlert('Description Required'),nil), ;
  305.               !Empty(cDesc) } ;
  306.    SAYTITLE 'SAY Description' ;
  307.    GETTITLE 'GET Description' ;
  308.    GETID 'DESCRIPTION' ;
  309.    HELPCODE 'DESCRIPTION'
  310.  
  311. @  3,10  DCSAY "Type" PARENT oTab1Static SAYSIZE 10 ;
  312.    TITLE 'SAY Type'
  313.  
  314. @  3,10 DCCOMBOBOX cType LIST aType SIZE 12,6 PARENT oTab1Static ;
  315.    TITLE 'COMBO-BOX Types' ;
  316.    MESSAGE 'Enter the TYPE of article' INTO oMsgBox2 ;
  317.    TYPE XBPCOMBO_SIMPLE ;
  318.    TABSTOP ;
  319.    ID 'TYPE' ;
  320.    HELPCODE 'TYPE' ;
  321.    VALID { || IIF(Empty(cType), ;
  322.               DC_WinAlert('Type Required'),nil), ;
  323.               !Empty(cType) }
  324.  
  325.  
  326. @  3,30 DCSAY "Sub-Type" PARENT oTab1Static SAYSIZE 10  ;
  327.    TITLE 'SAY Sub-Type'
  328.  
  329. @  3,30 DCCOMBOBOX cSubType LIST aSubType SIZE 12,6 PARENT oTab1Static ;
  330.    TITLE 'COMBO-BOX Sub-Types' ;
  331.    MESSAGE 'Enter the SUB-TYPE of article' INTO oMsgBox2 ;
  332.    TABSTOP ;
  333.    TYPE XBPCOMBO_SIMPLE ;
  334.    VALID { || IIF(Empty(cSubType),DC_WinAlert('Sub-Type Required'),nil), ;
  335.               !Empty(cSubType) } ;
  336.    ID 'SUB_TYPE' ;
  337.    HELPCODE 'SUB_TYPE'
  338.  
  339. @  3,50 DCSAY "Location" PARENT oTab1Static SAYSIZE 10 ;
  340.    TITLE 'SAY Location'
  341.  
  342. @  3,50 DCCOMBOBOX cLocation LIST aLocation SIZE 12,6 PARENT oTab1Static ;
  343.    TITLE 'COMBO-BOX Locations' ;
  344.    TABSTOP ;
  345.    MESSAGE 'Enter the LOCATION of article' INTO oMsgBox2 ;
  346.    TYPE XBPCOMBO_SIMPLE ;
  347.    VALID { || IIF(Empty(cLocation),DC_WinAlert('Location-Type Required'),nil), ;
  348.               !Empty(cLocation) } ;
  349.    ID 'LOCATION' ;
  350.    HELPCODE 'LOCATION'
  351.  
  352. @ 11,2 DCSAY 'Comments' GET cComments GETID 'EDIT_COMMENTS' ;
  353.    PARENT oTab1Static ;
  354.    SAYSIZE 10 SAYRIGHTBOTTOM GETSIZE 40 ;
  355.    GETID 'COMMENTS' ;
  356.    MESSAGE 'Enter some Comments' INTO oMsgBox2
  357.  
  358.  
  359. /* ---- Tab Page #2 ---- */
  360.  
  361. @ 0,0 DCTABPAGE oTabPage2 ;
  362.    CAPTION 'Fin~ancial' ;
  363.    RELATIVE oTabPage1 ;
  364.    MESSAGE 'Financial Data about this Collectible' INTO oMsgBox1 ;
  365.    TITLE 'TAB-PAGE 2 (Financial)' ;
  366.    ACCELKEY xbeK_ALT_A ;
  367.    STATICAREA oTab2Static ;
  368.    HELPCODE 'FINANCIAL' ;
  369.    GOTFOCUS {||SetAppFocus(DC_GetObject(GetList,'ORIGINAL_DATE'))}
  370.  
  371. @ 1,2 DCSAY {||COLLECT->descrip} ;
  372.    SAYSIZE 35 FONT "10.Helv Bold" ;
  373.    PARENT oTab2Static ;
  374.    COLOR {||{IIF( RecNo()>3, GRA_CLR_RED, GRA_CLR_DARKBLUE), GRA_CLR_WHITE}}
  375.  
  376. @ 3,2 DCSAY " Original Date" GET dDateOrig  PICT '99/99/9999' ;
  377.    POPUP {|d|DC_PopDate(d,,,,,,2)} ;
  378.    PARENT oTab2Static SAYRIGHTBOTTOM ;
  379.    TABSTOP ;
  380.    MESSAGE 'Date that article was created or discovered' INTO oMsgBox2 ;
  381.    SAYTITLE 'SAY Original Date' ;
  382.    GETTITLE 'GET Original Date' ;
  383.    GETID 'ORIGINAL_DATE' ;
  384.    HELPCODE 'ORIGINAL_DATE'
  385.  
  386. @ 5,2 DCSAY " Acquired Date" GET dDateAcq  PICT '99/99/9999' ;
  387.    POPUP {|d|DC_PopDate(d,,,,,,2)} ;
  388.    MESSAGE 'Date that article was acquired' INTO oMsgBox2 ;
  389.    PARENT oTab2Static SAYRIGHTBOTTOM ;
  390.    TABSTOP ;
  391.    SAYTITLE 'SAY Acquired Date' ;
  392.    GETTITLE 'GET Acquired Date' ;
  393.    GETID 'ACQUIRED_DATE' ;
  394.    HELPCODE 'ACQUIRED_DATE'
  395.  
  396. @ 7,2 DCSAY "Acquired Price" GET nOrigPrice PICT '@E 99,999.99'  ;
  397.    POPUP {|n|DC_PopCalc(n)} ;
  398.    TABSTOP ;
  399.    MESSAGE 'Price paid for article' INTO oMsgBox2 ;
  400.    PARENT oTab2Static SAYRIGHTBOTTOM ;
  401.    SAYTITLE 'SAY Acquired Price' ;
  402.    GETTITLE 'GET Acquired Price' ;
  403.    GETID 'ACQUIRED_PRICE' ;
  404.    HELPCODE 'ACQUIRED_PRICE'
  405.  
  406. @ 9,2 DCSAY "Appraised Value" GET nApprValue PICT '@K 99,999.99'  ;
  407.    POPUP {|n|DC_PopCalc(n)} ;
  408.    TABSTOP ;
  409.    MESSAGE 'Current appraised value of article' INTO oMsgBox2 ;
  410.    PARENT oTab2Static SAYRIGHTBOTTOM ;
  411.    SAYTITLE 'SAY Appraised Value' ;
  412.    GETTITLE 'GET Appraised Value' ;
  413.    GETID 'APPRAISED_VALUE' ;
  414.    HELPCODE 'APPRAISED_VALUE'
  415.  
  416. @ 1,45,5,65 DCGROUP oCheckGroup PARENT oTab2Static CAPTION "Status" ;
  417.    TITLE 'GROUP - Status' ;
  418.    HELPCODE 'STATUS_GROUP'
  419.  
  420. @ 1,2 DCCHECKBOX lOriginal PARENT oCheckGroup PROMPT 'Original Owner' ;
  421.    TITLE 'CHECK-BOX - Original Owner' TABSTOP ;
  422.    HELPCODE 'ORIGINAL_OWNER'
  423.  
  424. @ 2,2 DC3STATE nForSale PROMPT aForSale PARENT oCheckGroup ;
  425.    SIZE 12 ;
  426.    TABSTOP ;
  427.    MESSAGE 'Is this article FOR SALE?' INTO oMsgBox2 ;
  428.    TITLE '3-STATE - For Sale?' ;
  429.    HELPCODE 'FOR_SALE'
  430.  
  431. @ 5.5,45,12.5,65 DCGROUP oRadioGroup PARENT oTab2Static ;
  432.    CAPTION "Condition" ;
  433.    TOOLTIP 'What is the physical condition of this card?' ;
  434.    TITLE 'GROUP - Condition' ;
  435.    HELPCODE 'CONDITION_GROUP'
  436.  
  437. @ 1,2 DCRADIO cCondition PARENT oRadioGroup PROMPT 'M - Mint' ;
  438.    VALUE 'M' ;
  439.    TITLE 'RADIO BUTTON - Mint' ;
  440.    TABSTOP ;
  441.    TABGROUP XBP_BEGIN_GROUP ;
  442.    HELPCODE 'CONDITION_MINT'
  443.  
  444. @ 2,2 DCRADIO cCondition PARENT oRadioGroup PROMPT 'E - Excellent' ;
  445.    VALUE 'E'    ;
  446.    TITLE 'RADIO BUTTON - Excellent' ;
  447.    TABGROUP XBP_WITHIN_GROUP ;
  448.    HELPCODE 'CONDITION_EXCELLENT'
  449.  
  450. @ 3,2 DCRADIO cCondition PARENT oRadioGroup PROMPT 'G - Good' ;
  451.    VALUE 'G'   ;
  452.    TITLE 'RADIO BUTTON - Good' ;
  453.    TABGROUP XBP_WITHIN_GROUP ;
  454.    HELPCODE 'CONDITION_GOOD'
  455.  
  456. @ 4,2 DCRADIO cCondition PARENT oRadioGroup PROMPT 'F - Fair' ;
  457.    VALUE 'F'  ;
  458.    TITLE 'RADIO BUTTON - Fair' ;
  459.    TABGROUP XBP_WITHIN_GROUP ;
  460.    HELPCODE 'CONDITION_FAIR'
  461.  
  462. @ 5,2 DCRADIO cCondition PARENT oRadioGroup PROMPT 'P - Poor' ;
  463.    VALUE 'P' ;
  464.    TITLE 'RADIO BUTTON - Poor' ;
  465.    TABGROUP XBP_END_GROUP ;
  466.    HELPCODE 'CONDITION_POOR'
  467.  
  468. /* ---- Tab Page #3 ---- */
  469.  
  470. @ 0,0 DCTABPAGE oTabPage3 CAPTION '&Memo' ;
  471.    RELATIVE oTabPage2 ;
  472.    MESSAGE 'Memo Information' INTO oMsgBox1 ;
  473.    TITLE 'TAB-PAGE 3 (Memo)' ;
  474.    ACCELKEY xbeK_ALT_M ;
  475.    STATICAREA oTab3Static ;
  476.    GOTFOCUS {||SetAppFocus(oMemo)} ;
  477.    HELPCODE 'MEMO_PAGE'
  478.  
  479. @ 1,2 DCSAY cDesc SAYVAR cDesc SAYSIZE 35 ;
  480.    FONT "10.Helv Bold" PARENT oTab3Static ;
  481.    COLOR GRA_CLR_DARKBLUE, GRA_CLR_WHITE ;
  482.    TITLE 'SAY Description (Blue/White)'
  483.  
  484. @ 3,2 DCSAY 'Give us a little history about this item:' ;
  485.    PARENT oTab3Static SAYSIZE 45 ;
  486.    TITLE 'SAY History'
  487.  
  488. @ 4,2 DCMULTILINE cMemo PARENT oTab3Static SIZE 70,8 ;
  489.    TITLE 'MULTLINE History Memo' ;
  490.    TABSTOP ;
  491.    MAXLINES 5 MESSAGE 'Maximum of 5 Lines';
  492.    MAXCHARS 50 MESSAGE 'Maximum of 50 Characters';
  493.    LINELENGTH 30 MESSAGE 'Maximum Line length is 30 characters' ;
  494.    FONT "8.Alaska Crt" ;
  495.    OBJECT oMemo ;
  496.    EVAL { |o| o:RbDown  := { |x,y,z| oMenuMemo:PopUp ( z, x, 2 , ;
  497.               XBPMENU_PU_DEFAULT + XBPMENU_PU_MOUSE_RBDOWN  ) } } ;
  498.    ID 'MEMO' ;
  499.    HELPCODE 'MEMO'
  500.  
  501. DCSUBMENU oMenuMemo PROMPT "&Memo" PARENT oMemo
  502.  
  503. DCMENUITEM "~Delete" PARENT oMenuMemo ACTION {||oMemo:deleteMarked()} ;
  504.    MESSAGE 'Delete Item'
  505.  
  506. DCMENUITEM "~Cut" PARENT oMenuMemo ACTION {||oMemo:cutMarked()} ;
  507.    MESSAGE 'Cut Item'
  508.  
  509. DCMENUITEM "C~opy" PARENT oMenuMemo ACTION {||oMemo:copyMarked()} ;
  510.    MESSAGE 'Copy Item'
  511.  
  512. DCMENUITEM "~Paste" PARENT oMenuMemo ACTION {||oMemo:pasteMarked()} ;
  513.    MESSAGE 'Paste Item'
  514.  
  515. DCMENUITEM "~Undo" PARENT oMenuMemo ACTION {||oMemo:undo()} ;
  516.    MESSAGE 'Undo Item'
  517.  
  518. /* ---- Tab Page #4 ---- */
  519.  
  520. @ 0,0 DCTABPAGE oTabPage4 ;
  521.    CAPTION 'P&hotos' ;
  522.    RELATIVE oTabPage3 ;
  523.    MESSAGE 'Photos of the Collectible Item' INTO oMsgBox1 ;
  524.    TITLE 'TAB-PAGE 4 (Photos)' ;
  525.    ACCELKEY xbeK_ALT_H ;
  526.    STATICAREA oTab4Static ;
  527.    GOTFOCUS {||SetAppFocus(DC_GetObject(GetList,'PHOTO_1'))}
  528.  
  529. @ 1,2 DCSAY cDesc SAYVAR cDesc SAYSIZE 35 ;
  530.    FONT "10.Helv Bold" PARENT oTab4Static ;
  531.    COLOR GRA_CLR_DARKBLUE, GRA_CLR_WHITE ;
  532.    TITLE 'SAY Description (Blue/White)' ;
  533.    CURSOR POINTER_BUSY_1
  534.  
  535. @ 4,2 DCSTATIC XBPSTATIC_TYPE_RAISEDBOX SIZE 33,9 ;
  536.    OBJECT oPhoto1 PARENT oTab4Static ;
  537.    TITLE 'STATIC (Photo 1)' ;
  538.    CURSOR POINTER_PEN_1
  539.  
  540. @ 4,37 DCSTATIC XBPSTATIC_TYPE_RAISEDBOX SIZE 33,9 ;
  541.    OBJECT oPhoto2 PARENT oTab4Static ;
  542.    TITLE 'STATIC (Photo 2)' ;
  543.    CURSOR POINTER_PEN_1
  544.  
  545. DCBITMAP cBitMap1 PARENT oPhoto1 AUTOSCALE CENTER ;
  546.    TITLE 'BIT MAP (Photo 1)'
  547.  
  548. DCBITMAP cBitMap2 PARENT oPhoto2 AUTOSCALE CENTER ;
  549.    TITLE 'BIT MAP (Photo 2)'
  550.  
  551. @ 2.5,3  DCSAY 'Photo 1' GET cBitMap1 PARENT oTab4Static ;
  552.    SAYRIGHTBOTTOM SAYSIZE 10 ;
  553.    GETID 'PHOTO_1' ;
  554.    DATALINK {||DC_BitMapDraw(oPhoto1,cBitMap1)}
  555.  
  556. @ 2.5,38 DCSAY 'Photo 2' GET cBitMap2 PARENT oTab4Static ;
  557.    SAYRIGHTBOTTOM SAYSIZE 10 ;
  558.    DATALINK {||DC_BitMapDraw(oPhoto2,cBitMap2)}
  559.  
  560. /* ---- Tab Page #5 ---- */
  561.  
  562. @ 0,0 DCTABPAGE oTabPage5 CAPTION '&Browse' ;
  563.    RELATIVE oTabPage4 ;
  564.    MESSAGE 'Browse the Database' INTO oMsgBox1 ;
  565.    TITLE 'TAB-PAGE 5 (Browse)' ;
  566.    ACCELKEY xbeK_ALT_B ;
  567.    GOTFOCUS {||SetAppFocus(oBrowse)}
  568.  
  569. @ 2,2 DCSTATIC XBPSTATIC_TYPE_RECESSEDBOX SIZE 70.4,12 ;
  570.    OBJECT oBrowBox PARENT oTabPage5
  571.  
  572. @ .1,.5 DCBROWSE oBrowse PARENT oBrowBox ALIAS 'COLLECT' ;
  573.    SIZE 69.5,11.8  ;
  574.    FREEZELEFT { 1 } ;
  575.    PRESENTATION aPres ;
  576.    EVAL {|o|o:itemMarked := ;
  577.         {||XDemo1_LoadFields(aApp,DCGETREFRESH_TYPE_EXCLUDE,{GETLIST_BROWSE})} } ;
  578.    EDIT xbeBRW_ItemSelected MODE DCGUI_BROWSE_EDITACROSS ;
  579.    DELETE xbeK_DEL ;
  580.    INSERT xbeK_INS ;
  581.    HANDLER BrowseHandler REFERENCE aApp ;
  582.    COLOR {||IIF(RecNo()%2==0, ;
  583.                { GRA_CLR_BLACK, GRA_CLR_WHITE }, ;
  584.                { GRA_CLR_BLUE, GRA_CLR_WHITE } )}  ;
  585.    ID 'BROWSE'
  586.  
  587. DCBROWSECOL FIELD COLLECT->descrip ;
  588.   WIDTH 11 ;
  589.   HEADER "Description" PARENT oBrowse ;
  590.   ID 'BROWSE_DESCRIP' ;
  591.   VALID {|c|DC_ReadEmpty(c)} ;
  592.   MESSAGE 'This is the Description'
  593.  
  594. @ nil,nil DCCOMBOBOX COLLECT->type LIST aType SIZE nil,6 ;
  595.    TYPE XBPCOMBO_DROPDOWN ;
  596.    VALID { || IIF(Empty(COLLECT->type), ;
  597.               DC_WinAlert('Type Required'),nil), ;
  598.               !Empty(COLLECT->type) } ;
  599.    ID 'EDITOR_TYPE'
  600.  
  601. DCBROWSECOL FIELD COLLECT->type ;
  602.   WIDTH 7 ;
  603.   HEADER "Type" PARENT oBrowse ;
  604.   ID 'BROWSE_TYPE' ;
  605.   EDITOR 'EDITOR_TYPE' ;
  606.   MESSAGE 'This is the Type of item'
  607.  
  608. @ nil,nil DCCOMBOBOX COLLECT->sub_type LIST aSubType SIZE nil, 6 ;
  609.    TYPE XBPCOMBO_DROPDOWN ;
  610.    ID 'EDITOR_SUBTYPE'
  611.  
  612. DCBROWSECOL FIELD COLLECT->sub_type ;
  613.   WIDTH 8 ;
  614.   HEADER "SubType" PARENT oBrowse ;
  615.   ID 'BROWSE_SUBTYPE' ;
  616.   EDITOR 'EDITOR_SUBTYPE' ;
  617.   MESSAGE 'This is the Sub-Type of item'
  618.  
  619. @ nil,nil DCCOMBOBOX COLLECT->location LIST aLocation SIZE nil, 6 ;
  620.    TYPE XBPCOMBO_DROPDOWN ;
  621.    ID 'EDITOR_LOCATION'
  622.  
  623. DCBROWSECOL FIELD COLLECT->location ;
  624.   HEADER "Location" ;
  625.   PARENT oBrowse ;
  626.   WIDTH 10 ;
  627.   ID 'BROWSE_LOCATION' ;
  628.   EDITOR 'EDITOR_LOCATION' ;
  629.   MESSAGE 'This is where the item is stored' ;
  630.      INTO oMsgBox2 ;
  631.  
  632. @ nil,nil DC3STATE bForSale PROMPT aForSale ID 'FOR_SALE'
  633.  
  634. DCBROWSECOL DATA {|a|a:={'No','Yes','Not Sure'},a[COLLECT->for_sale+1]} ;
  635.   HEADER "ForSale?" PARENT oBrowse ;
  636.   WIDTH 5 ;
  637.   COLOR {||aColors[COLLECT->for_sale+1]} ;
  638.   ID 'BROWSE_FORSALE' ;
  639.   EDITOR 'FOR_SALE' ;
  640.   MESSAGE 'Is this item For Sale?'
  641.  
  642. @ nil, nil DCGET xNIL  PICT '99/99/9999' ;
  643.    POPUP {|d|DC_PopDate(d,,,,,,2)} ;
  644.    GETID 'EDITOR_ORIGINAL_DATE_2' ;
  645.    VALID {|o|DC_ReadEmpty(o:Get:VarGet())}
  646.  
  647. DCBROWSECOL FIELD COLLECT->date_orig ;
  648.   HEADER "Orig Date" PARENT oBrowse ;
  649.   WIDTH 6 ;
  650.   ID 'BROWSE_DESCRIP' ;
  651.   MESSAGE 'This is the date the item fell on this earth' ;
  652.      INTO oMsgBox2 ;
  653.   EDITOR 'EDITOR_ORIGINAL_DATE_2'
  654.  
  655. @ nil,nil DCGET xNIL  PICT '99/99/9999' ;
  656.    POPUP {|d|DC_PopDate(d,,,,,,2)} ;
  657.    GETID 'EDITOR_ACQUIRED_DATE'
  658.  
  659. DCBROWSECOL FIELD COLLECT->date_acqu ;
  660.   HEADER "Acqu Date" PARENT oBrowse ;
  661.   WIDTH 6 ;
  662.   TOOLTIP 'This is the Date the Item was Acquired' ;
  663.   ID 'BROWSE_DATEACQU' ;
  664.   EDITOR 'EDITOR_ACQUIRED_DATE'
  665.  
  666. @ nil,nil DCGET xNIL PICT '9,999.99'  ;
  667.    POPUP {|n|DC_PopCalc(n)} ;
  668.    MESSAGE 'Price paid for article' INTO oMsgBox2 ;
  669.    GETID 'ORIG_PRICE'
  670.  
  671. DCBROWSECOL FIELD (cAlias)->orig_price ;
  672.   HEADER "Acqu Price" PARENT oBrowse ;
  673.   WIDTH 6 ;
  674.   TOOLTIP 'This is the Original Price' ;
  675.   PICTURE '9,999.99'
  676.  
  677. @ nil,nil DCGET COLLECT->appr_value PICT '@K 99,999.99'  ;
  678.    POPUP {|n|DC_PopCalc(n)} ;
  679.    GETID 'EDITOR_APPRAISED_VALUE'
  680.  
  681. DCBROWSECOL FIELD COLLECT->appr_value ;
  682.   HEADER "Appr Value" PARENT oBrowse ;
  683.   WIDTH 6 ;
  684.   ID 'BROWSE_APPRVALUE' ;
  685.   EDITOR 'EDITOR_APPRAISED_VALUE'
  686.  
  687. DCBROWSECOL FIELD COLLECT->condition ;
  688.   HEADER "Condition" PARENT oBrowse ;
  689.   WIDTH 1 ;
  690.   ID 'BROWSE_CONDITION'
  691.  
  692. /*
  693. DCBROWSECOL DATA {||IIF(COLLECT->original, ;
  694.                         BITMAP_CHECKBOX_CHECKED_S, ;
  695.                         BITMAP_CHECKBOX_UNCHECKED_S)} ;
  696.   TYPE XBPCOL_TYPE_BITMAP ;
  697.   HEADER "Orig Owner?" PARENT oBrowse ;
  698.   WIDTH 3
  699. */
  700.  
  701. DCBROWSECOL DATA {||IIF(COLLECT->original,'Yes','No')} ;
  702.   HEADER "Orig Owner?" PARENT oBrowse ;
  703.   WIDTH 3
  704.  
  705. @ nil,nil DCGET FIELD->comments GETID 'EDITOR_COMMENTS'
  706.  
  707. DCBROWSECOL FIELD COLLECT->comments ;
  708.   HEADER "Comments" PARENT oBrowse ;
  709.   WIDTH 25 ;
  710.   ID 'BROWSE_COMMENTS' ;
  711.   EDITOR 'EDITOR_COMMENTS'
  712.  
  713. @ nil,nil DCMULTILINE COLLECT->memo SIZE 20,5 ;
  714.   FONT "8.Alaska Crt" ;
  715.   ID 'EDITOR_MEMO'
  716.  
  717. DCBROWSECOL FIELD COLLECT->memo ;
  718.   HEADER "Memo" PARENT oBrowse ;
  719.   WIDTH 30 ;
  720.   MESSAGE 'Press the F10 key to Exit Memo Editor' INTO oMsgBox2 ;
  721.   EDITOR 'EDITOR_MEMO' EXITKEY xbeK_F10
  722.  
  723. /* ---- Tab Page #6 ---- */
  724.  
  725. @ 0,0 DCTABPAGE oTabPage6 ;
  726.    CAPTION 'So~urce' ;
  727.    RELATIVE oTabPage5 ;
  728.    MESSAGE 'Source code for this entire Dialog' INTO oMsgBox1 ;
  729.    TITLE 'TAB-PAGE 6 (Source)' ;
  730.    ACCELKEY xbeK_ALT_U
  731.  
  732. @ 1.2,1 DCMULTILINE cSource PARENT oTabPage6 SIZE 72,13.5 ;
  733.    FONT "8.Alaska Crt" EDITPROTECT {||.t.} ;
  734.    TITLE 'MULTILINE (Source)'
  735.  
  736. /* ---- Tool Bar ---- */
  737.  
  738. @ 1,76 DCTOOLBAR oToolBar ;
  739.    FANCY ;
  740.    SIZE 9,17.2 ;
  741.    TITLE 'TOOLBAR (Top)' ;
  742.    BUTTONSIZE 9,1.5
  743.  
  744. DCADDBUTTON TYPE XBPSTATIC_TYPE_RAISEDRECT ;
  745.             SIZE 9,.2 PARENT oToolBar
  746.  
  747. DCADDBUTTON CAPTION { BITMAP_TOP_1, BITMAP_TOP_2 }  ;
  748.             PARENT oToolBar ;
  749.             TOOLTIP 'Go to the Top of the File' ;
  750.             OBJECT oTopButton ;
  751.             ACTION {||XDemo1_TestChanged(aApp),dbGoTop(), ;
  752.                       XDemo1_LoadFields(aApp)} ;
  753.             WHEN {||RecNo() > 1}
  754.  
  755. DCADDBUTTON TYPE XBPSTATIC_TYPE_RAISEDRECT ;
  756.             SIZE 9,.2 PARENT oToolBar
  757.  
  758. DCADDBUTTON CAPTION { BITMAP_PREVIOUS_1, BITMAP_PREVIOUS_2 } ;
  759.             PARENT oToolBar ;
  760.             OBJECT oPrevButton ;
  761.             ACTION {||XDemo1_TestChanged(aApp),dbSkip(-1), ;
  762.                       XDemo1_LoadFields(aApp)} ;
  763.             WHEN {||RecNo() > 1 }
  764.  
  765. DCADDBUTTON TYPE XBPSTATIC_TYPE_RAISEDRECT ;
  766.             SIZE 9,.2 PARENT oToolBar
  767.  
  768. DCADDBUTTON CAPTION { BITMAP_NEXT_1, BITMAP_NEXT_2 } ;
  769.             PARENT oToolBar ;
  770.             TOOLTIP 'Skip to the Next Record' ;
  771.             OBJECT oNextButton ;
  772.             ACTION {||XDemo1_TestChanged(aApp),dbSkip(), ;
  773.                       XDemo1_LoadFields(aApp)} ;
  774.             WHEN {||RecNo() < LastRec()}
  775.  
  776. DCADDBUTTON TYPE XBPSTATIC_TYPE_RAISEDRECT ;
  777.             SIZE 9,.2 PARENT oToolBar
  778.  
  779. DCADDBUTTON CAPTION { BITMAP_BOTTOM_1, BITMAP_BOTTOM_2 } ;
  780.             PARENT oToolBar ;
  781.             TOOLTIP 'Go to the Bottom of the File' ;
  782.             OBJECT oBottButton ;
  783.             ACTION {||XDemo1_TestChanged(aApp),dbGoBottom(), ;
  784.                       XDemo1_LoadFields(aApp)} ;
  785.             WHEN {||RecNo() < LastRec()}
  786.  
  787. DCADDBUTTON TYPE XBPSTATIC_TYPE_RAISEDRECT ;
  788.             SIZE 9,.2 PARENT oToolBar
  789.  
  790. DCADDBUTTON CAPTION BITMAP_NEW_1 ;
  791.             PARENT oToolBar ;
  792.             ACCELKEY xbeK_ALT_N ;
  793.             TOOLTIP 'Add a New Item to the Collection' ;
  794.             ACTION {|x|XDemo1_TestChanged(aApp), ;
  795.                        x:=DC_MsgBox(,,{'Add a New Item?'},,,,.t.),;
  796.                        IIF(x,AddRec(5),nil),;
  797.                        dbUnlock(), ;
  798.                        XDemo1_LoadFields(aApp),;
  799.                        SetAppFocus(oTabPage1) }
  800.  
  801. DCADDBUTTON TYPE XBPSTATIC_TYPE_RAISEDRECT ;
  802.             SIZE 9,.2 PARENT oToolBar
  803.  
  804. DCADDBUTTON CAPTION {||{BITMAP_DELETE_1,BITMAP_DELETE_1}} ;
  805.             PARENT oToolBar ;
  806.             ACCELKEY xbeK_ALT_D ;
  807.             TOOLTIP 'Delete Selected Item from Collection' ;
  808.             ACTION {|x|SetAppFocus(oTabPage1),;
  809.                        x:=DC_MsgBox(,,{'Delete this Item?'},,,,.t.),;
  810.                        RecLock(5),;
  811.                        IIF(x,dbDelete(),nil),;
  812.                        dbUnlock(),;
  813.                        IIF(x,dbSkip(),nil), ;
  814.                        IIF(x,dbSkip(-1),nil), ;
  815.                        XDemo1_LoadFields(aApp) }
  816.  
  817. DCADDBUTTON TYPE XBPSTATIC_TYPE_RAISEDRECT ;
  818.             SIZE 9,.2 PARENT oToolBar
  819.  
  820. DCADDBUTTON CAPTION BITMAP_SAVE_1 ;
  821.             PARENT oToolBar ;
  822.             ACCELKEY xbeK_ALT_S ;
  823.             TOOLTIP 'Save Changes to the File' ;
  824.             ACTION {||XDemo1_SaveFields(aApp),;
  825.                       DC_GetRefresh(Getlist)}
  826.  
  827. DCADDBUTTON TYPE XBPSTATIC_TYPE_RAISEDRECT ;
  828.             SIZE 9,.2 PARENT oToolBar
  829.  
  830. DCADDBUTTON CAPTION BITMAP_PRINT_1 ;
  831.             PARENT oToolBar ;
  832.             TOOLTIP 'Send data to Printer;to a file or;preview on screen' ;
  833.             ACTION {|a,b,o|oMenuPrint:PopUp( o, o:currentPos(), 2 , ;
  834.                      XBPMENU_PU_DEFAULT + XBPMENU_PU_MOUSE_RBDOWN  ) }
  835.  
  836. DCADDBUTTON TYPE XBPSTATIC_TYPE_RAISEDRECT ;
  837.             SIZE 9,.2 PARENT oToolBar
  838.  
  839. DCADDBUTTON CAPTION BITMAP_UTIL_1 ;
  840.             PARENT oToolBar ;
  841.             TOOLTIP 'Pack the File;Permanently remove Deleted Records ' ;
  842.             ACTION {||Pack(aApp)}
  843.  
  844. DCADDBUTTON TYPE XBPSTATIC_TYPE_RAISEDRECT ;
  845.             SIZE 9,.2 PARENT oToolBar
  846.  
  847. DCADDBUTTON CAPTION BITMAP_EXIT_1 ;
  848.             PARENT oToolBar ;
  849.             TOOLTIP 'Exit the program' ;
  850.             ACTION {||DC_ReadGuiEvent(DCGUI_EXIT_OK,GetList)}
  851.  
  852. DCADDBUTTON TYPE XBPSTATIC_TYPE_RAISEDRECT ;
  853.             SIZE 9,.2 PARENT oToolBar
  854.  
  855.  
  856. /* ---- Message Box ---- */
  857.  
  858. @ 16,1 DCMESSAGEBOX OBJECT oMsgBox1 FONT cSayFont ;
  859.    SIZE 73 ;
  860.    TITLE 'MESSAGE BOX'  ;
  861.    COLOR GRA_CLR_DARKBLUE, GRA_CLR_PALEGRAY ;
  862.    TYPE XBPSTATIC_TYPE_RECESSEDBOX
  863.  
  864. @ 17,1 DCMESSAGEBOX OBJECT oMsgBox2 FONT cSayFont ;
  865.    SIZE 73 ;
  866.    COLOR GRA_CLR_DARKRED, GRA_CLR_PALEGRAY ;
  867.    TYPE XBPSTATIC_TYPE_RECESSEDBOX
  868.  
  869. /* ---- Print Pop-up Menu ---- */
  870.  
  871. DCSUBMENU oMenuPrint PROMPT "&Print" PARENT oMenuBar INDEX nMenuPrint
  872.  
  873.     DCMENUITEM "&Print List (@..SAY method)" INDEX nMenuList PARENT oMenuPrint ;
  874.       ACTION {||XDemo1_PrintList(.f.)}
  875.  
  876.     DCMENUITEM "&List Preview (@..SAY method)" INDEX nMenuList PARENT oMenuPrint ;
  877.       ACTION {||XDemo1_PrintList(.t.)}
  878.  
  879.     DCMENUITEM SEPARATOR PARENT oMenuPrint
  880.  
  881.     DCMENUITEM "Print Li&st (QOUT method)" INDEX nMenuList PARENT oMenuPrint ;
  882.       ACTION {||XDemo1_PrintListQ(.f.)}
  883.  
  884.     DCMENUITEM "List Previe&w (QOUT method)" INDEX nMenuList PARENT oMenuPrint ;
  885.       ACTION {||XDemo1_PrintListQ(.t.)}
  886.  
  887.     DCMENUITEM SEPARATOR PARENT oMenuPrint
  888.  
  889.     DCMENUITEM "Prin&t List (FORM method)" INDEX nMenuList PARENT oMenuPrint ;
  890.       ACTION {||XDemo1_PrintListF(.f.)}
  891.  
  892.     DCMENUITEM "List Pr&eview (FORM method)" INDEX nMenuList PARENT oMenuPrint ;
  893.       ACTION {||XDemo1_PrintListF(.t.)}
  894.  
  895.     DCMENUITEM SEPARATOR PARENT oMenuPrint
  896.  
  897.     DCMENUITEM "Print &Item to a SELECTED Printer" INDEX nMenuItem PARENT oMenuPrint ;
  898.       ACTION {||XDemo1_PrintItem(1)}
  899.  
  900.     DCMENUITEM "Print I&tem to DEFAULT Printer" INDEX nMenuItem PARENT oMenuPrint ;
  901.       ACTION {||XDemo1_PrintItem(4)}
  902.  
  903.     DCMENUITEM "Item Pre&view" INDEX nMenuItem PARENT oMenuPrint ;
  904.       ACTION {||XDemo1_PrintItem(2)}
  905.  
  906.     DCMENUITEM "Item to &File" INDEX nMenuItem PARENT oMenuPrint ;
  907.       ACTION {||XDemo1_PrintItem(3)}
  908.  
  909.  
  910. RETURN
  911.  
  912. /* ------------------- */
  913.  
  914. PROCEDURE XDemo1_LoadFields ( aApp, nRefreshMode, aRefreshList )
  915.  
  916. cDesc       := COLLECT->descrip
  917. cType       := COLLECT->type
  918. cSubType    := COLLECT->sub_type
  919. cLocation   := COLLECT->location
  920. dDateOrig   := COLLECT->date_orig
  921. cMemo       := COLLECT->memo
  922. dDateAcq    := COLLECT->date_acqu
  923. nOrigPrice  := COLLECT->orig_price
  924. nApprValue  := COLLECT->appr_value
  925. cComments   := COLLECT->comments
  926. lOriginal   := COLLECT->original
  927. nForSale    := COLLECT->for_sale
  928. cCondition  := COLLECT->condition
  929. cBitMap1    := COLLECT->bitmap1
  930. cBitMap2    := COLLECT->bitmap2
  931.  
  932. IF Eof()
  933.   dbSkip(-1)
  934. ENDIF
  935. IF nRefreshMode = nil .OR. nRefreshMode > -1
  936.   DC_GetRefresh(aGetList, nil, nRefreshMode, aRefreshList )
  937.   DC_GetOrigSet( aGetList )  // Store new values to ORIG field in Getlist
  938. ENDIF
  939.  
  940. nRecord := RecNo()
  941.  
  942. RETURN
  943.  
  944. /* ------------------ */
  945.  
  946. PROCEDURE XDemo1_SaveFields ( aApp )
  947.  
  948. IF Reclock(5)
  949.  
  950.   REPL COLLECT->descrip    WITH cDesc
  951.   REPL COLLECT->type       WITH cType
  952.   REPL COLLECT->sub_type   WITH cSubType
  953.   REPL COLLECT->location   WITH cLocation
  954.   REPL COLLECT->date_orig  WITH dDateOrig
  955.   REPL COLLECT->memo       WITH cMemo
  956.   REPL COLLECT->date_acqu  WITH dDateAcq
  957.   REPL COLLECT->orig_price WITH nOrigPrice
  958.   REPL COLLECT->appr_value WITH nApprValue
  959.   REPL COLLECT->comments   WITH cComments
  960.   REPL COLLECT->original   WITH lOriginal
  961.   REPL COLLECT->for_sale   WITH nForSale
  962.   REPL COLLECT->condition  WITH cCondition
  963.   REPL COLLECT->bitmap1    WITH cBitMap1
  964.   REPL COLLECT->bitmap2    WITH cBitMap2
  965.   UNLOCK
  966.  
  967.   DC_MsgBox(,,{'Record has been saved!'},,,,.f.,1)
  968.   DC_GetOrigSet( aGetList )  // Store new values to ORIG field in Getlist
  969.  
  970. ENDIF
  971.  
  972. RETURN
  973.  
  974. /* ------------------- */
  975.  
  976. PROCEDURE XDemo1_TestChanged ( aApp )
  977.  
  978. IF nRecord = COLLECT->(RecNo()) .AND. DC_GetOrigUpdated( aGetList )
  979.   IF DC_MsgBox(,,{'Data has been modified. Save Changes?'},,,,.t.)
  980.     XDemo1_SaveFields(aApp)
  981.   ENDIF
  982. ENDIF
  983. RETURN
  984.  
  985. /* ------------------- */
  986.  
  987. FUNCTION XDemo1_PrintItem ( nMode )
  988.  
  989. LOCAL aFor_Sale, oPrinter, i, nLineCount, cMemo, cMemoLine, cScrn, ;
  990.       nRecNo := RecNo()
  991.  
  992. SELE collect
  993.  
  994. GO TOP
  995.  
  996. aFor_Sale := { 'No','Yes','Not Sure' }
  997.  
  998. BEGIN SEQUENCE
  999.  
  1000. IF nMode = 1  // Standard Print
  1001.   DCPRINT ON SIZE 60,80 TO oPrinter FONT '12.Courier New'
  1002. ELSEIF nMode = 4  // Standard Print to Default Printer
  1003.   DCPRINT ON SIZE 60,80 TO oPrinter FONT '12.Courier New' USEDEFAULT
  1004. ELSEIF nMode = 2 // Preview
  1005.   DCPRINT ON SIZE 60,80 TO oPrinter FONT '12.Courier New' ;
  1006.    PREVIEW HIDE
  1007. ELSEIF nMode = 3 // Print to Text File
  1008.   DCPRINT ON SIZE 60,80 TO oPrinter TEXTONLY TOFILE
  1009. ENDIF
  1010.  
  1011. IF Valtype(oPrinter) # 'O' .OR. !oPrinter:lActive
  1012.   BREAK
  1013. ENDIF
  1014.  
  1015. DO WHILE !Eof() .AND. DC_PrinterOk(oPrinter)
  1016.  
  1017.    DCPRINT SIZE 66,80
  1018.  
  1019.    @ 2,2,20,35 DCPRINT BITMAP COLLECT->bitmap1 PRINTER oPrinter ;
  1020.       AUTOSCALE CENTER
  1021.  
  1022.    @ 2,37,20,70 DCPRINT BITMAP COLLECT->bitmap2 PRINTER oPrinter ;
  1023.       AUTOSCALE CENTER
  1024.  
  1025.    DCPRINT FONT '12.Courier New' PRINTER oPrinter
  1026.  
  1027.    @ 23, 5, 38, 65 DCPRINT BOX PRINTER oPrinter
  1028.  
  1029.    @ 24,7 DCPRINT SAY '    Description:' PRINTER oPrinter
  1030.    @ 25,7 DCPRINT SAY '           Type:' PRINTER oPrinter
  1031.    @ 26,7 DCPRINT SAY '       Sub-Type:' PRINTER oPrinter
  1032.    @ 27,7 DCPRINT SAY '      Condition:' PRINTER oPrinter
  1033.    @ 28,7 DCPRINT SAY '       Location:' PRINTER oPrinter
  1034.    @ 29,7 DCPRINT SAY '      For Sale?:' PRINTER oPrinter
  1035.    @ 30,7 DCPRINT SAY '  Original Date:' PRINTER oPrinter
  1036.    @ 31,7 DCPRINT SAY '  Acquired Date:' PRINTER oPrinter
  1037.    @ 32,7 DCPRINT SAY ' Original Price:' PRINTER oPrinter
  1038.    @ 33,7 DCPRINT SAY 'Appraised Value:' PRINTER oPrinter
  1039.    @ 34,7 DCPRINT SAY '       Comments:' PRINTER oPrinter
  1040.    @ 35,7 DCPRINT SAY '      Bit Map 1:' PRINTER oPrinter
  1041.    @ 36,7 DCPRINT SAY '      Bit Map 2:' PRINTER oPrinter
  1042.  
  1043.    DCPRINT FONT '14.Terminal' PRINTER oPrinter
  1044.  
  1045.    @ 24,25 DCPRINT SAY COLLECT->descrip   PRINTER oPrinter
  1046.    @ 25,25 DCPRINT SAY COLLECT->type      PRINTER oPrinter
  1047.    @ 26,25 DCPRINT SAY COLLECT->sub_type  PRINTER oPrinter
  1048.    @ 27,25 DCPRINT SAY COLLECT->condition PRINTER oPrinter
  1049.    @ 28,25 DCPRINT SAY COLLECT->location  PRINTER oPrinter
  1050.    @ 29,25 DCPRINT SAY aFor_Sale[COLLECT->for_sale+1]  PRINTER oPrinter
  1051.    @ 30,25 DCPRINT SAY COLLECT->date_orig PRINTER oPrinter
  1052.    @ 31,25 DCPRINT SAY COLLECT->date_acqu  PRINTER oPrinter
  1053.    @ 32,25 DCPRINT SAY COLLECT->orig_price PRINTER oPrinter
  1054.    @ 33,25 DCPRINT SAY COLLECT->appr_value PRINTER oPrinter
  1055.    @ 34,25 DCPRINT SAY COLLECT->comments  PRINTER oPrinter
  1056.    @ 35,25 DCPRINT SAY COLLECT->bitmap1   PRINTER oPrinter
  1057.    @ 36,25 DCPRINT SAY COLLECT->bitmap2   PRINTER oPrinter
  1058.  
  1059.    DCPRINT FONT '16.Arial'  PRINTER oPrinter
  1060.  
  1061.    DCPRINT SIZE 40,80
  1062.  
  1063.    cMemo := Alltrim(COLLECT->memo)
  1064.    nLineCount := MLCount(cMemo)
  1065.    FOR i := 1 TO nLineCount - 1
  1066.       cMemoLine := MemoLine( cMemo, nil, i )
  1067.       @ 25+i,7 DCPRINT SAY cMemoLine PRINTER oPrinter
  1068.    NEXT
  1069.  
  1070.    SKIP
  1071.  
  1072.    IF !Eof()
  1073.       DCPRINT EJECT
  1074.    ENDIF
  1075.  
  1076. ENDDO
  1077.  
  1078. DCPRINT OFF PRINTER oPrinter
  1079.  
  1080. GO nRecNo
  1081.  
  1082. END SEQUENCE
  1083.  
  1084. RETURN nil
  1085.  
  1086. /* ------------------- */
  1087.  
  1088. FUNCTION XDemo1_PrintList ( lPreview )
  1089.  
  1090. LOCAL nRow, nSaveRec, cScrn, aFor_Sale, cFontName, oPrinter, i, nStartRow
  1091.  
  1092. SELE collect
  1093. nSaveRec := RecNo()
  1094. GO TOP
  1095.  
  1096. aFor_Sale := { 'No','Yes','Not Sure' }
  1097.  
  1098. BEGIN SEQUENCE
  1099.  
  1100. IF lPreview
  1101.   DCPRINT ON SIZE 50,98 FONT '9.Terminal' TO oPrinter PREVIEW HIDE
  1102. ELSE
  1103.   DCPRINT ON SIZE 50,98 FONT '9.Terminal' TO oPrinter
  1104. ENDIF
  1105.  
  1106. IF Valtype(oPrinter) # 'O' .OR. !oPrinter:lActive
  1107.   BREAK
  1108. ENDIF
  1109.  
  1110. cFontName := oPrinter:GetFontCompoundName()
  1111.  
  1112. FOR i := 1 TO oPrinter:nCopies
  1113.  
  1114.   GO TOP
  1115.   nRow := 3
  1116.   oPrinter:nPage := 1
  1117.  
  1118.   DO WHILE !Eof() .AND. DC_PrinterOk()
  1119.  
  1120.     IF nRow <= 3
  1121.  
  1122.       DCPRINT FONT '14.Arial Bold'
  1123.  
  1124.       @ nRow, 5, nRow+1.5, 90 DCPRINT BOX
  1125.  
  1126.       @ nRow,10 DCPRINT SAY 'My Personal Collection Inventory'
  1127.       @ nRow,50 DCPRINT SAY 'Page ' + Alltrim(Str(oPrinter:nPage))
  1128.       @ nRow,70 DCPRINT SAY Date()
  1129.  
  1130.       nRow += 3
  1131.       nStartRow := nRow
  1132.       @ nRow+.5, 4, nRow+.5, 94 DCPRINT LINE
  1133.  
  1134.       DCPRINT FONT '12.Arial Bold'
  1135.  
  1136.       @ nRow+.5,5  DCPRINT SAY 'Description'
  1137.       @ nRow+.5,40 DCPRINT SAY 'Type'
  1138.       @ nRow+.5,55 DCPRINT SAY 'Sub-Type'
  1139.       @ nRow+.5,70 DCPRINT SAY 'Cond'
  1140.       @ nRow+.5,76 DCPRINT SAY 'For Sale?'
  1141.       @ nRow+.5,87 DCPRINT SAY 'Value'
  1142.       nRow += 2
  1143.  
  1144.       DCPRINT FONT cFontName
  1145.  
  1146.     ELSE
  1147.  
  1148.       @ nRow+.3, 4, nRow+.3, 94 DCPRINT LINE
  1149.  
  1150.       @ nRow,5  DCPRINT SAY COLLECT->descrip
  1151.       @ nRow,40 DCPRINT SAY COLLECT->type
  1152.       @ nRow,55 DCPRINT SAY COLLECT->sub_type
  1153.       @ nRow,70 DCPRINT SAY COLLECT->condition
  1154.       @ nRow,76 DCPRINT SAY aFor_Sale[COLLECT->for_sale+1]
  1155.       @ nRow,87 DCPRINT SAY Str(COLLECT->appr_value,7,2)
  1156.       nRow++
  1157.  
  1158.       SKIP
  1159.  
  1160.       IF nRow > ( oPrinter:nRows - 5 ) .OR. Eof()
  1161.         nRow += .5
  1162.         nStartRow += .5
  1163.         @ nRow, 4, nRow, 94 DCPRINT LINE
  1164.         @ nStartRow, 4, nRow, 4 DCPRINT LINE
  1165.         @ nStartRow,39, nRow,39 DCPRINT LINE
  1166.         @ nStartRow,54, nRow,54 DCPRINT LINE
  1167.         @ nStartRow,69, nRow,69 DCPRINT LINE
  1168.         @ nStartRow,75, nRow,75 DCPRINT LINE
  1169.         @ nStartRow,86, nRow,86 DCPRINT LINE
  1170.         @ nStartRow,94, nRow,94 DCPRINT LINE
  1171.         IF !Eof()
  1172.           DCPRINT EJECT
  1173.         ENDIF
  1174.         nRow := 3
  1175.       ENDIF
  1176.  
  1177.     ENDIF
  1178.  
  1179.   ENDDO
  1180.  
  1181. NEXT
  1182.  
  1183. END SEQUENCE
  1184.  
  1185. DCPRINT OFF
  1186.  
  1187. GO nSaveRec
  1188. RETURN nil
  1189.  
  1190. /* ------------------- */
  1191.  
  1192. FUNCTION XDemo1_PrintListQ ( lPreview )
  1193.  
  1194. LOCAL nRow, nSaveRec, cScrn, aFor_Sale, cFontName, oPrinter, i
  1195.  
  1196. SELE collect
  1197. nSaveRec := RecNo()
  1198. GO TOP
  1199.  
  1200. aFor_Sale := { 'No','Yes','Not Sure' }
  1201.  
  1202. BEGIN SEQUENCE
  1203.  
  1204. IF lPreview
  1205.   DCPRINT ON SIZE 50,90 FONT '9.Terminal' TO oPrinter PREVIEW HIDE
  1206. ELSE
  1207.   DCPRINT ON SIZE 50,90 FONT '9.Terminal' TO oPrinter
  1208. ENDIF
  1209.  
  1210. IF Valtype(oPrinter) # 'O' .OR. !oPrinter:lActive
  1211.   BREAK
  1212. ENDIF
  1213.  
  1214. cFontName := oPrinter:GetFontCompoundName()
  1215.  
  1216. FOR i := 1 TO oPrinter:nCopies
  1217.  
  1218.   GO TOP
  1219.   nRow := 3
  1220.   oPrinter:nPage := 1
  1221.   DCPRINT ?
  1222.   DCPRINT ?
  1223.   DO WHILE !Eof()
  1224.  
  1225.     IF nRow <= 3
  1226.  
  1227.       DCPRINT FONT '14.Arial Bold'
  1228.  
  1229.       DCPRINT ? 'My Personal Collection Inventory       '
  1230.       DCPRINT ?? 'Page ' + Alltrim(Str(oPrinter:nPage))
  1231.       DCPRINT ?? '    '
  1232.       DCPRINT ?? Date()
  1233.       DCPRINT ?
  1234.  
  1235.       nRow += 2
  1236.  
  1237.       DCPRINT FONT '12.Arial Bold'
  1238.  
  1239.       DCPRINT ? Pad('Description',35)
  1240.       DCPRINT ?? Pad('Type',15)
  1241.       DCPRINT ?? Pad('Sub-Type',15)
  1242.       DCPRINT ?? Pad('Cond',6)
  1243.       DCPRINT ?? Pad('For Sale?',11)
  1244.       DCPRINT ?? 'Value'
  1245.       DCPRINT ?
  1246.  
  1247.       nRow += 2
  1248.  
  1249.       DCPRINT FONT cFontName
  1250.  
  1251.     ELSE
  1252.  
  1253.       DCPRINT ? Pad(COLLECT->descrip,35)
  1254.       DCPRINT ?? Pad(COLLECT->type,15)
  1255.       DCPRINT ?? Pad(COLLECT->sub_type,15)
  1256.       DCPRINT ?? Pad(COLLECT->condition,6)
  1257.       DCPRINT ?? Pad(aFor_Sale[COLLECT->for_sale+1],11)
  1258.       DCPRINT ?? Str(COLLECT->appr_value,7,2)
  1259.       nRow++
  1260.  
  1261.       SKIP
  1262.  
  1263.       IF nRow > ( oPrinter:nRows - 5 )
  1264.         DCPRINT EJECT
  1265.         nRow := 3
  1266.       ENDIF
  1267.  
  1268.     ENDIF
  1269.  
  1270.   ENDDO
  1271.  
  1272. NEXT
  1273.  
  1274. END SEQUENCE
  1275.  
  1276. DCPRINT OFF
  1277.  
  1278. GO nSaveRec
  1279. RETURN nil
  1280.  
  1281. /* ------------------- */
  1282.  
  1283. FUNCTION XDemo1_PrintListF ( lPreview )
  1284.  
  1285. LOCAL nSaveRec
  1286.  
  1287. SELE collect
  1288. nSaveRec := RecNo()
  1289. GO TOP
  1290.  
  1291. IF lPreview
  1292.   DCREPORT FORM collect XBP FONT '10.Courier New' ;
  1293.         TITLEFONT '10.Helv Bold' HEADFONT '10.Courier New Bold' PREVIEW
  1294. ELSE
  1295.   DCREPORT FORM collect XBP FONT '10.Courier New' ;
  1296.         TITLEFONT '10.Helv Bold' HEADFONT '10.Courier New Bold'
  1297. ENDIF
  1298.  
  1299. GO nSaveRec
  1300. RETURN nil
  1301.  
  1302. /* -------------------- */
  1303.  
  1304. STATIC FUNCTION RecLock( nWaitTime )
  1305.  
  1306. LOCAL nWait
  1307.  
  1308. IF DBRLOCK()
  1309.   RETURN (.T.)   // locked
  1310. ENDIF
  1311. DO WHILE .T.
  1312.   nWait := nWaitTime
  1313.   DO WHILE (nWaitTime=0 .OR. nWait>0)
  1314.     IF DBRLOCK()     // locked
  1315.       RETURN (.T.)
  1316.     ENDIF
  1317.     INKEY(.5)     // wait 1/2 second
  1318.     nWait  :=  nWait - .5
  1319.   ENDDO
  1320. ENDDO
  1321. RETURN (.F.)      // not locked
  1322.  
  1323. /* -------------------- */
  1324.  
  1325. STATIC FUNCTION AddRec ( nWaitTime )
  1326.  
  1327. LOCAL nWait
  1328.  
  1329. APPEND BLANK
  1330. IF !NETERR()
  1331.    RETURN (.T.)
  1332. ENDIF
  1333. DO WHILE .T.
  1334.   nWait := nWaitTime
  1335.   DO WHILE (nWaitTime = 0 .OR. nWait > 0)
  1336.     APPEND BLANK
  1337.     IF .NOT. NETERR()
  1338.       RETURN .T.
  1339.     ENDIF
  1340.     nWait  :=  nWait - .5
  1341.   ENDDO
  1342. ENDDO
  1343. RETURN .F.
  1344.  
  1345. /* --------------------- */
  1346.  
  1347. STATIC FUNCTION FiLock( nWaitTime )
  1348.  
  1349. LOCAL nWait
  1350.  
  1351. IF FLOCK()
  1352.   RETURN (.T.)   // locked
  1353. ENDIF
  1354. DO WHILE .T.
  1355.   nWait := nWaitTime
  1356.   DO WHILE (nWaitTime=0 .OR. nWait>0)
  1357.     INKEY(.5)     // wait 1/2 second
  1358.     nWait  :=  nWait - .5
  1359.     IF FLOCK()
  1360.       RETURN (.T.)    // locked
  1361.     ENDIF
  1362.   ENDDO
  1363. ENDDO
  1364. RETURN .F.
  1365.  
  1366. /* ------------------- */
  1367.  
  1368. STATIC FUNCTION Pack ( aApp )
  1369.  
  1370. LOCAL lIsShared := dbInfo( DBO_SHARED )
  1371.  
  1372. IF lIsShared
  1373.   IF DC_MsgBox(,,{'The file must be opened exclusive to Pack.',;
  1374.                       'Close file and reopen exclusive?'},,,,.t.)
  1375.     dbCloseArea()
  1376.     USE collect EXCLUSIVE VIA DBFNTX
  1377.   ENDIF
  1378. ENDIF
  1379.  
  1380. lIsShared := dbInfo( DBO_SHARED )
  1381.  
  1382. IF !lIsShared
  1383.   dbPack()
  1384.   dbGoTop()
  1385.   XDemo1_LoadFields( aApp )
  1386. ENDIF
  1387.  
  1388. RETURN nil
  1389.  
  1390. /* ------------------------- */
  1391.  
  1392. STATIC FUNCTION _SetCaption( nButton, aApp )
  1393.  
  1394. LOCAL nBitMap, oButton
  1395.  
  1396. IF nButton = 1
  1397.   nBitMap := IIF(COLLECT->(RecNo())>1,BITMAP_TOP_1,BITMAP_TOP_2)
  1398.   oButton := oTopButton
  1399. ELSEIF nButton = 2
  1400.   oButton := oPrevButton
  1401.   nBitMap := IIF(COLLECT->(RecNo())>1,BITMAP_PREVIOUS_1,BITMAP_PREVIOUS_2)
  1402. ELSEIF nButton = 3
  1403.   oButton := oNextButton
  1404.   nBitMap := IIF(COLLECT->(RecNo()) < COLLECT->(RecCount()), ;
  1405.              BITMAP_NEXT_1,BITMAP_NEXT_2)
  1406. ELSEIF nButton = 4
  1407.   oButton := oBottButton
  1408.   nBitMap := IIF(COLLECT->(RecNo()) # COLLECT->(RecCount()), ;
  1409.              BITMAP_BOTTOM_1,BITMAP_BOTTOM_2)
  1410. ENDIF
  1411. IF oButton:caption # nBitMap
  1412.   oButton:setCaption(nBitMap)
  1413. ENDIF
  1414. RETURN .t.
  1415.  
  1416. /* --------------------- */
  1417.  
  1418. STATIC FUNCTION ;
  1419.   BrowseHandler ( nEvent, mp1, mp2, oXbp, oDialog, GetList, aApp )
  1420.  
  1421. RETURN DCGUI_NONE
  1422.  
  1423. * -----------------------
  1424.  
  1425. STATIC FUNCTION DisplayHelp( cHelpCode )
  1426.  
  1427. LOCAL aHelp, nFound
  1428.  
  1429. aHelp :=  { { 'COLLECTION','This is the COLLECTION TabPage' }, ;
  1430.             { 'DESCRIPTION','Enter a Description of the Item' }, ;
  1431.             { 'TYPE','Enter the Type of the Item' }, ;
  1432.             { 'SUB_TYPE','Enter the Sub-Type of the Item' }, ;
  1433.             { 'LOCATION','Enter the Location of the Item' } }
  1434.  
  1435. nFound := AScan( aHelp, {|a|a[1]==cHelpCode} )
  1436. IF nFound > 0
  1437.   DC_MsgBox(aHelp[nFound])
  1438. ELSE
  1439.   DC_WinAlert( 'Sorry!  No Help Available for this object' )
  1440. ENDIF
  1441.  
  1442. RETURN nil
  1443.  
  1444.  
  1445.