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

  1. /*
  2.  ╓───────────────────────────────────────────────────────╖
  3.  ║  Program..: XDEMO2.PRG                                ║
  4.  ║  Author...: Roger J. Donnay                           ║
  5.  ║  Notice...: (c) DONNAY Software Designs 1987-2001     ║
  6.  ║  Date.....: Sep 15, 2001                              ║
  7.  ║  Notes....: eXPress Demo Program # 2                  ║
  8.  ╙───────────────────────────────────────────────────────╜
  9.  
  10.  This sample program demonstrates "application" features of
  11.  eXPress++ like DCAPPEDIT, DCAPPBROWSE and DCAPPFIELD.
  12.  
  13. */
  14.  
  15. #include "dcapp.ch"
  16. #include "dcbitmap.ch"
  17. #include "appevent.ch"
  18.  
  19. #define  oTabPage1     aLocals[1]
  20. #define  oTabPage2     aLocals[2]
  21. #define  oTabPage3     aLocals[3]
  22. #define  oTabPage4     aLocals[4]
  23. #define  oTabPage5     aLocals[5]
  24. #define  oTabPage6     aLocals[6]
  25. #define  oTabPage7     aLocals[7]
  26. #define  oAppEdit1     aLocals[8]
  27. #define  oAppEdit2     aLocals[9]
  28. #define  oAppEdit3     aLocals[10]
  29. #define  oAppEdit4     aLocals[11]
  30. #define  oAppEdit5     aLocals[12]
  31. #define  oAppBrow1     aLocals[13]
  32. #define  oStatic1      aLocals[14]
  33. #define  oStatic2      aLocals[15]
  34. #define  oStatic3      aLocals[16]
  35. #define  oStatic4      aLocals[17]
  36. #define  oStatic5      aLocals[18]
  37. #define  oStatic6      aLocals[19]
  38. #define  oToolBar      aLocals[20]
  39. #define  cSource       aLocals[21]
  40. #define  oDlg          aLocals[22]
  41. #define  oDlgWindow    aLocals[23]
  42. #define  cTitle        aLocals[24]
  43. #define  lMDIApp       aLocals[25]
  44.  
  45.  
  46. FUNCTION XDemo_2 ( oDialog )
  47.  
  48. LOCAL oCrt, oOldCrt, GetList, GetOptions, aLocals[25], aApplication
  49.  
  50. SET DEFA TO
  51. SET PATH TO ..\DATA
  52.  
  53. IF Select('COLLECT') = 0
  54.   USE COLLECT VIA DBFNTX NEW SHARED
  55. ELSE
  56.   dbSelectArea('COLLECT')
  57. ENDIF
  58.  
  59. DEFAULT aApplication := _BuildApp( aLocals, oDialog )
  60.  
  61. GetOptions := aApplication[1]
  62. Getlist    := aApplication[2]
  63.  
  64. DCREAD GUI ;
  65.    OPTIONS GetOptions ;
  66.    TITLE 'Demo of Application Browse/Edit' ;
  67.    APPWINDOW oDialog ;
  68.    FIT
  69.  
  70. CLOSE DATABASES
  71.  
  72. RETURN nil
  73.  
  74. * ----------------------
  75.  
  76. STATIC FUNCTION _BuildApp( aLocals, oDialog )
  77.  
  78. LOCAL Getlist := {}, GetOptions, aCoords
  79.  
  80. cTitle := 'Demo Application of AppEdit/AppBrowse'
  81.  
  82. /* ---- Tab Page #1 ---- */
  83.  
  84. @  0,0 DCTABPAGE oTabPage1 CAPTION 'Plain' ;
  85.    SIZE 80,19.5 PREOFFSET 0 POSTOFFSET 86 ;
  86.    COLOR GRA_CLR_BLUE, GRA_CLR_RED
  87.  
  88. @  1.5,1 DCSTATIC XBPSTATIC_TYPE_RAISEDBOX SIZE 78,17.5 ;
  89.    OBJECT oStatic1 PARENT oTabPage1
  90.  
  91. DCAPPEDIT INTO oAppEdit1 STYLE PLAIN POSITION 0,0 PARENT oStatic1
  92.  
  93. /* ---- Tab Page #2 ---- */
  94.  
  95. @  0,0 DCTABPAGE oTabPage2 CAPTION '3D' ;
  96.    RELATIVE oTabPage1 ;
  97.    COLOR GRA_CLR_RED
  98.  
  99. @  1.5,1 DCSTATIC XBPSTATIC_TYPE_RAISEDBOX SIZE 78,17.5 ;
  100.    OBJECT oStatic2 PARENT oTabPage2
  101.  
  102. DCAPPEDIT INTO oAppEdit2 STYLE 3D POSITION 0,0 PARENT oStatic2
  103.  
  104. DCAPPFIELD COLLECT->descrip INTO oAppEdit2  CAPTION 'Description' ;
  105.    COLOR GRA_CLR_BLUE
  106.  
  107. DCAPPFIELD COLLECT->type INTO oAppEdit2  CAPTION 'Type'       ;
  108.    COLOR GRA_CLR_BLUE
  109.  
  110. DCAPPFIELD COLLECT->sub_type INTO oAppEdit2  CAPTION 'Sub-Type' ;
  111.   COLOR GRA_CLR_BLUE
  112.  
  113. DCAPPFIELD COLLECT->location INTO oAppEdit2  CAPTION 'Location' ;
  114.   COLOR GRA_CLR_BLUE
  115.  
  116. DCAPPFIELD COLLECT->date_orig INTO oAppEdit2  CAPTION 'Date of Origin' ;
  117.   COLOR GRA_CLR_BLUE
  118.  
  119. DCAPPFIELD COLLECT->date_acqu INTO oAppEdit2  CAPTION 'Acquired Date' ;
  120.   COLOR GRA_CLR_BLUE
  121.  
  122. DCAPPFIELD COLLECT->appr_value INTO oAppEdit2  CAPTION 'Appraised Value' ;
  123.   COLOR GRA_CLR_BLUE
  124.  
  125. DCAPPFIELD COLLECT->for_sale INTO oAppEdit2  CAPTION 'For Sale?' ;
  126.   COLOR GRA_CLR_BLUE
  127.  
  128. DCAPPFIELD COLLECT->condition INTO oAppEdit2  CAPTION 'Condition' ;
  129.   COLOR GRA_CLR_BLUE
  130.  
  131. DCAPPFIELD COLLECT->bitmap1 INTO oAppEdit2  CAPTION 'Bit Map File #1' ;
  132.   COLOR GRA_CLR_BLUE
  133.  
  134. DCAPPFIELD COLLECT->bitmap2 INTO oAppEdit2  CAPTION 'Bit Map File #2' ;
  135.   COLOR GRA_CLR_BLUE
  136.  
  137. DCAPPFIELD COLLECT->comments INTO oAppEdit2  CAPTION 'Comments' ;
  138.   COLOR GRA_CLR_BLUE
  139.  
  140. DCAPPFIELD COLLECT->memo INTO oAppEdit2  CAPTION 'How was this item acquired?' ;
  141.   COLOR GRA_CLR_BLUE ;
  142.   WIDTH 300
  143.  
  144. /* ---- Tab Page #3 ---- */
  145.  
  146. @  0,0 DCTABPAGE oTabPage3 CAPTION 'Fancy' ;
  147.    RELATIVE oTabPage2 ;
  148.    COLOR GRA_CLR_YELLOW
  149.  
  150. @  1.5,1 DCSTATIC XBPSTATIC_TYPE_RAISEDBOX SIZE 78,17.5 ;
  151.    OBJECT oStatic3 PARENT oTabPage3
  152.  
  153. DCAPPEDIT INTO oAppEdit3 STYLE FANCY POSITION 0,0 PARENT oStatic3
  154.  
  155. /* ---- Tab Page #4 ---- */
  156.  
  157. @  0,0 DCTABPAGE oTabPage4 CAPTION '3D 1' ;
  158.    RELATIVE oTabPage3 ;
  159.    COLOR GRA_CLR_CYAN
  160.  
  161. @  1.5,1 DCSTATIC XBPSTATIC_TYPE_RAISEDBOX SIZE 78,17.5 ;
  162.    OBJECT oStatic4 PARENT oTabPage4
  163.  
  164. DCAPPEDIT INTO oAppEdit4 POSITION 0,0 PARENT oStatic4 ;
  165.    STYLE APPSTYLE_ACTIONICONS+APPSTYLE_RAISED+APPSTYLE_ACTIONTOP
  166.  
  167. /* ---- Tab Page #5 ---- */
  168.  
  169. @  0,0 DCTABPAGE oTabPage5 CAPTION 'Fancy 2' ;
  170.    RELATIVE oTabPage4 ;
  171.    COLOR GRA_CLR_GREEN
  172.  
  173. @  1.5,1 DCSTATIC XBPSTATIC_TYPE_RAISEDBOX SIZE 78,17.5 ;
  174.    OBJECT oStatic5 PARENT oTabPage5
  175.  
  176. DCAPPEDIT INTO oAppEdit5 STYLE FANCY POSITION 0,0 ;
  177.    FIELDS COLLECT->descrip, COLLECT->type, COLLECT->sub_type, ;
  178.           COLLECT->date_orig, COLLECT->date_acqu, COLLECT->orig_price, ;
  179.           COLLECT->appr_value, COLLECT->condition ;
  180.    BITMAP BITMAP_WIZARD FIT ;
  181.    PARENT oStatic5 TITLE "My Collection"
  182.  
  183. /* ---- Tab Page #6 ---- */
  184.  
  185. @  0,0 DCTABPAGE oTabPage6 CAPTION 'Browse' ;
  186.    RELATIVE oTabPage5 ;
  187.    COLOR GRA_CLR_WHITE ;
  188.    GOTFOCUS {||dbSkip(0)}
  189.  
  190. @  1.5,1 DCSTATIC XBPSTATIC_TYPE_RAISEDBOX SIZE 78,17.5 ;
  191.    OBJECT oStatic6 PARENT oTabPage6
  192.  
  193. DCAPPBROWSE INTO oAppBrow1 STYLE FANCY POSITION 0,0 ;
  194.    PARENT oStatic6 TITLE "My Collection"
  195.  
  196. DCAPPFIELD COLLECT->descrip INTO oAppBrow1  CAPTION 'Description' ;
  197.   COLOR GRA_CLR_BLUE, GRA_CLR_WHITE
  198.  
  199. DCAPPFIELD COLLECT->type INTO oAppBrow1  CAPTION 'Item Type' ;
  200.   COLOR GRA_CLR_BLUE, GRA_CLR_WHITE
  201.  
  202. DCAPPFIELD COLLECT->sub_type INTO oAppBrow1  CAPTION 'Sub-Type' ;
  203.   COLOR GRA_CLR_BLUE, GRA_CLR_WHITE
  204.  
  205.  
  206. /* ---- Tab Page #7---- */
  207.  
  208. @  0,0 DCTABPAGE oTabPage7 CAPTION 'Source' ;
  209.    RELATIVE oTabPage6
  210.  
  211. cSource := MemoRead('XDEMO2.PRG')
  212. IF Empty(cSource)
  213.   cSource := MemoRead('..\PRG\XDEMO2.PRG')
  214. ENDIF
  215. IF Empty(cSource)
  216.   cSource := 'XDEMO2.PRG cannot be found'
  217. ENDIF
  218. @  1.2,1 DCMULTILINE cSource PARENT oTabPage7 SIZE 78,18.2 ;
  219.    FONT "8.Courier" EDITPROTECT {||.t.}
  220.  
  221. /* ---- Tool Bar ---- */
  222.  
  223. @ 1,81 DCPUSHBUTTON CAPTION '&Exit' ;
  224.             SIZE 7,1 ;
  225.             ACTION {||DC_ReadGuiEvent(DCGUI_EXIT_OK,GetList)}
  226.  
  227. DCGETOPTIONS ;
  228.    CASCADE
  229.  
  230. RETURN { GetOptions, GetList, aLocals }
  231.  
  232. /* ------------------------ */
  233.  
  234. STATIC FUNCTION _RefreshBrow(aLocals)
  235.  
  236. LOCAL aChildList := oStatic6:ChildList(), i
  237.  
  238. FOR i := 1 TO Len(aChildList)
  239.    IF aChildList[i]:ClassName() == 'XbpBrowse'
  240.       aChildList[i]:refreshAll()
  241.    ENDIF
  242. NEXT
  243.  
  244. RETURN nil
  245.