home *** CD-ROM | disk | FTP | other *** search
/ Programming Tool Box / SIMS_2.iso / vb_code1 / browse_2 / brwdone.frm (.txt) < prev    next >
Visual Basic Form  |  1995-02-26  |  18KB  |  394 lines

  1. BrwdOne
  2. Browse one database
  3. Courier New
  4. """""""/
  5. /ww"""""""/
  6. /ww"""""""/
  7. /ww"""""""/
  8. """""""/
  9. Form1%
  10. Text1
  11. Text1
  12. Text1
  13. Text1
  14. Text1
  15. Text1
  16. Text1
  17. RecSave
  18. Sa&ve changes
  19. RecDele
  20. Delete &record
  21. !    CommAbout
  22. E&xit
  23. RecAdd
  24. A&dd record
  25. CommHelp
  26. &Help
  27. RecEdit
  28. &Edit current
  29. FltExpr
  30. FltExp
  31. Pseudo-&Filter
  32. IndExpr
  33. IndExp
  34. Index &key scope
  35. IndexOrd
  36. MsgLbl
  37. Label2
  38. De&scription:
  39. Label2
  40. &Price:
  41. Label2
  42. I&tem part no:
  43. Label2
  44. Product t&ype:
  45. Label2
  46. Product &code:
  47. Label2
  48. Product &group:
  49. Label2
  50. &Index:
  51. Label1
  52. Record data
  53. MS Sans Serif
  54. CurrentCell
  55. Label3
  56. Sorted &by:
  57. Brw1_Change
  58. nRowCol
  59. BRW_CHANGE_COL
  60. UpdateDisplay
  61. CurrentCell
  62. Caption
  63. CurrCells
  64.     EmptyFile
  65. Brw1_GetLine
  66. cLine
  67. vxField#
  68. Brw1_GotFocusD
  69. RecSave
  70. Default
  71. Enabled}
  72. RecEdit
  73. MsgLbl
  74. Brw1_HitBottom^
  75. Brw1_HitTop
  76. CommAbout_Click
  77. About
  78. MODAL
  79. CommAbout_GotFocus
  80. CommHelp_Click
  81. BHelp?
  82. CommHelp_GotFocusF
  83. FltExp_Click
  84. FltExpZ
  85. IndExp
  86. RecAdd
  87. RecDele'
  88. FltExpr
  89. SelStart
  90.     SelLength
  91. Text"
  92.     FilterExp_
  93. FltExp_GotFocus
  94. FltExpr_GotFocus
  95.     Form_Loadj
  96. screen
  97. Width
  98. Height
  99. IndexOrder
  100. vxUseDbf
  101. cPath
  102. vxUseNtx
  103. vxSelectNtx
  104. vxFilter6
  105. vxCloseAll
  106. vxDeallocate5
  107. PatienceT
  108. ColsB
  109. ColWidthe
  110. ColAlign
  111. BRW_ALIGN_LEFT
  112. Header
  113. lInitializing
  114. IndexOrd\
  115.     ListIndex
  116. Form_Unload
  117. Cancel
  118. vxWindowDereg*
  119. BrwdOne
  120. IndexOrd_Click
  121. vxSelectDbfJ
  122. Action
  123. BRW_ACT_REFRESHBAR
  124. BRW_ACT_REFRESHALL
  125. IndExprf
  126. IndexOrd_GotFocus
  127. IndExp_Click
  128. IndexExpy
  129. IndExp_GotFocus3
  130. IndExpr_GotFocus
  131. RecAdd_Click
  132. Text1
  133. lAppend+
  134. RecAdd_GotFocus?
  135. RecDele_Click
  136. vxLockRecord"
  137. MB_OKCANCEL
  138. IDOK=
  139. vxDeleteRec
  140. vxUnlockP
  141. RecDele_GotFocusd
  142. RecEdit_Clicku
  143. RecEdit_GotFocus\
  144. RecSave_Click
  145. lLockedm
  146. vxAppendBlank
  147. vxReplLong,
  148. vxReplString
  149. vxReplDouble
  150. BRW_ACT_GOTOPB
  151. BRW_ACT_REFRESHLINE
  152. RecSave_GotFocus
  153. Text1_GotFocus
  154. Index
  155. FltError
  156. substr7
  157. CATNOb
  158. MB_ICONINFORMATION
  159. vxRecNo
  160. vxSeek
  161.     vxNtxExpr
  162. vxNtxCurrent
  163. Form_KeyDownQ
  164. KeyCode
  165. Shift
  166. Form_Activate
  167. nRecord
  168. Form_Deactivate
  169. lOpenDbf
  170. opened
  171. CATALOG
  172.     switching
  173. betweens
  174. windows
  175. nIndexOrder
  176. vxClose
  177. vxSetAlias
  178. vxTop
  179. Form_QueryUnload
  180. UnloadMode
  181. CatCnt
  182.  Append / Edit flagn
  183.  Initializing flag
  184.  to store the current index orderA
  185.  store the current record number whenw
  186.  switching between windows
  187.  will be True if this is the instance of the form 
  188.  that opened the CATALOG.DBF
  189. Brw1_Change
  190.  The event is fired whenever the user has changed theC
  191.  actual Col and/or Row, using the mouse or keyboard,
  192.  or in code/Immed Window setting the .Col/.Row properties)
  193.  The parameter nRowCol can have one of the following values:
  194.    BRW_CHANGE_COL  = 1 the column has changedl
  195.    BRW_CHANGE_ROW  = 2 the row has changed
  196.    BRW_CHANGE_BOTH = 3 both the row and the column have changed
  197.  The EmptyFile flag can be checked here to see if there are any
  198.  records matching the criteria.  This can be useful for disabling
  199.  actions such as delete a record or edit a record (if the file is
  200.  empty there is nothing to edit / delete.a
  201. Current cell: 
  202. No records match the filters
  203. Brw1_GetLine
  204.  Brw1 fires this event whenever a line is required for updatingi
  205.  the display.  The database is positioned on the record fort
  206.  which the cLine is required. The VB program must fill the cLine
  207.  parameter with the data to be displayed, that is for each column
  208.  defined a string of ColWidth(k) must be added to cLinea
  209.  (otherwise spaces will be displayed).
  210.  The data must be padded with spaces so that it adds up to the
  211.  column width.  You can assign any value, including VB variables
  212.  , etc., which is handy for calculated columns,d
  213.  displaying date fields as 'December 18, 1992'
  214.  or logical fields as 'Yes' or 'No ', or even flagging deleted
  215.  records (which will show if a filter to .NOT.DELETED() is not
  216.  set:r
  217.    If vxDeleted() Then cLine = "*" Else cLine = " "E
  218.    If vxDeleted() Then cLine = "Del " Else cLine = "
  219. SYSNO
  220.  column 0, width = 6
  221. GROUP
  222.  column 1, width = 4
  223.  column 2, ...
  224. CATNO
  225. DESCR
  226.  column 7, the last oneo
  227. Brw1_GotFocus
  228.  the standard GotFocus event, do some house keeping stuff)
  229. You are in BROWSE mode. press Help button for keyboard help
  230. Brw1_HitBottom
  231.  fired whenever the user hits the bottom of the file
  232. Brw1_HitTop
  233.  fired whenever the user hits the top of the filei
  234. CommAbout_Click
  235. CommAbout_GotFocus
  236. Close window
  237. CommHelp_Click
  238. CommHelp_GotFocus
  239. Help for the available keys in Browse
  240. FltExp_Click
  241. Pseudo-&Filter
  242. Save Pseudo-&Filter
  243. Input a standard xBase expression that evaluates to logical!
  244. You can try something like:
  245. 'LIST > 500' or 'substr(CATNO,1,2)="HJ"'
  246. Pseudo-&Filter
  247. FltExp_GotFocus
  248. Set a Pseudo-Filter expression
  249. FltExpr_GotFocus
  250. Enter the Pseudo-Filter, must be a valid xBase expression
  251. Form_Activate
  252.  restore status 
  253. Form_Deactivate
  254.  save record numberd
  255. Form_Load
  256.  center the form on displaym
  257.  assign the IndexOrder initial value
  258.  database is already openedx
  259.  open the database and indexes, set filter to !deleted()
  260. CATALOG
  261. CATSYS
  262. CATGRP
  263. CATNUM
  264. .NOT.DELETED()
  265. CATALOG
  266.  failed to open the file
  267. %{F4}
  268. Alt-F4
  269. Browse CATALOG.DBF
  270.  Display a small non-modal form to tell the use to wait)
  271.  while the main form is loading 
  272.  set the number of columns in displayl
  273.  set the widths of each column
  274.  now we can set the alignment of each column
  275.  (default is BRW_ALIGN_CENTER, can also be BRW_ALIGN_LEFT
  276.  or BRW_ALIGN_RIGHT )N
  277.  set the column header, it is one string made of a sum of
  278.  all the column headers, in this casei
  279.  12345678901234567890123456789012345678901... 
  280.  1234561234123412341234567890121234567890...
  281.  Sysno Grp CodeTypeList Price  Description
  282. Sysno 
  283. Catalog number 
  284. List price  
  285. Description
  286.  and at last we assign the database and active index handle
  287.  if needed we can set a Index Expresion and a Pseudo-Filter
  288.  to start with, for example to show only breakers:
  289.  Brw1.IndexExp = "BRKR"m
  290.  and namely only those having a non-zero price (for example):
  291.  Bwrd.FilterExp = "LIST>0"
  292.  Assign the IndexOrd dropdown list with the index namesm
  293.  To avoid the IndexOrd_Click() sub to be triggered, the lInitializinga
  294.  is set to TRUE, otherwise the sub would call the Brw1.SetFocus,
  295.  which is invalid in the Form_Load sub.d
  296. System number
  297. Group+Code+Type
  298. Part number
  299.  Set it back to FALSE when the init is donel
  300. Form_QueryUnload
  301. Close the browse windows in the reverse opening order (Last In - First Out)!
  302. Form_Unload
  303.  release the vxBase data if the file is opened in this instancec
  304. vxWindowDereg Me.hWnd
  305.  otherwise decrease the file usage count by onea
  306. IndexOrd_Click
  307.  used to change the index orderi
  308.  Changing the index order will afect not only the display but it
  309.  will also trigger clearing of the Brw1.IndexExp and
  310.  Brw1.FilterExp - the scope and the pseudo-filtera
  311. IndexOrd_GotFocus
  312. Change the current index order
  313. IndExp_Click
  314. Index &key scope
  315. Save Index &key scope
  316.  check if the index expression existsr
  317.  save current record
  318. The expression entered was not found for the current index key:
  319. Try something like 'BRKRMLDCHJQ'
  320. Index &key scope
  321. IndExp_GotFocus
  322. Change/Input the Index key Scope
  323. IndExpr_GotFocus
  324. Enter the Scope, according to the current Index Key
  325. RecAdd_Click
  326.  Append a new record, just blank the text controls, set the
  327.  global variable lAppend to TRUE and enable the Save button.
  328.  Then set focus to the first text controll
  329. Enter the data, then click Save Changes to save
  330. RecAdd_GotFocus
  331. Append a new record
  332. RecDele_Click
  333.  Delete a record, must lock the record before,
  334.  then get user confirmation.  The unlock is not required, any
  335.  movement in the file will unlock the record, but it's a good
  336.  practice.
  337. Confirm deletion of current record
  338. Cannot lock record for deletion!
  339. RecDele_GotFocus
  340. Delete current record
  341. RecEdit_Click
  342.  Edit the current record, the data is already there so just enable
  343.  the Save button and set focus to the first text control
  344. Enter the data, then click Save Changes to save
  345. RecEdit_GotFocus
  346. Edit current record
  347. RecSave_Click
  348.  Save record (either changed or new record), if new record try to
  349.  append blank, otherwise try to lock the record.
  350.  If succesfull ( lLocked will be TRUE ), replace data and send a
  351.  message to Brw1 to refresh current line (if in Edit mode) ord
  352.  to refresh the whole screen if appending.
  353.  NOTE: when appending a record to a file that is viewed using a
  354.  scope and eventually a pseudo-filter, and the new recordd
  355.  does not match the scope or the filter, then the position
  356.  in the file must be changed to be on one of the records
  357.  matching the scope and pseudo-filter expressions.
  358.  This can be easily achieved by sending a GoTop messagee
  359.  to the control, that is assign the Action propery too
  360.  BRW_ACT_GOTOP, see the BROWSE.WRI
  361.  The same care should be taken when editing fields that will change
  362.  the active index key (in this example Group, Code and Type), then
  363.  the VB program must check and repaint the whole control,p
  364.  by issuing a BRW_ACT_GOTOP = a go top request.e
  365. SYSNO
  366. GROUP
  367. CATNO
  368. DESCR
  369.  if there is a Scope
  370.  then force a GoTop 
  371. Cannot lock/append record for saving!
  372. RecSave_GotFocus
  373. Save the changes
  374. Text1_GotFocus
  375.  Enable the Save button if clicked on any of the text controls
  376. Enter the System no, field: CATALOG->SYSNO
  377. Enter the Product Group, field: CATALOG->GROUP
  378. Enter the Product Code, field: CATALOG->CODE
  379. Enter the Product Type, field: CATALOG->TYPE
  380. Enter the Product Catalog Number, field: CATALOG->CATNO
  381. Enter the Product List Price, field: CATALOG->LIST
  382. Enter the Product Description, field: CATALOG->DESCR
  383. UpdateDisplay
  384.  Function to update the data displayed in the text controls
  385.  to reflect the current record.  Note the last line calling
  386.  the current cell of the Brw1 control, that is the highlighted
  387.  cell, whatever that happens to be.o
  388. SYSNO
  389. GROUP
  390. CATNO
  391. DESCR
  392. Current cell: 
  393. Browse CATALOG.DBF (Record#
  394.