home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Programming Tool Box
/
SIMS_2.iso
/
vb_code1
/
browse_2
/
brwdone.frm
(
.txt
)
< prev
next >
Wrap
Visual Basic Form
|
1995-02-26
|
18KB
|
394 lines
BrwdOne
Browse one database
Courier New
"""""""/
/ww"""""""/
/ww"""""""/
/ww"""""""/
"""""""/
Form1%
Text1
Text1
Text1
Text1
Text1
Text1
Text1
RecSave
Sa&ve changes
RecDele
Delete &record
! CommAbout
E&xit
RecAdd
A&dd record
CommHelp
&Help
RecEdit
&Edit current
FltExpr
FltExp
Pseudo-&Filter
IndExpr
IndExp
Index &key scope
IndexOrd
MsgLbl
Label2
De&scription:
Label2
&Price:
Label2
I&tem part no:
Label2
Product t&ype:
Label2
Product &code:
Label2
Product &group:
Label2
&Index:
Label1
Record data
MS Sans Serif
CurrentCell
Label3
Sorted &by:
Brw1_Change
nRowCol
BRW_CHANGE_COL
UpdateDisplay
CurrentCell
Caption
CurrCells
EmptyFile
Brw1_GetLine
cLine
vxField#
Brw1_GotFocusD
RecSave
Default
Enabled}
RecEdit
MsgLbl
Brw1_HitBottom^
Brw1_HitTop
CommAbout_Click
About
MODAL
CommAbout_GotFocus
CommHelp_Click
BHelp?
CommHelp_GotFocusF
FltExp_Click
FltExpZ
IndExp
RecAdd
RecDele'
FltExpr
SelStart
SelLength
Text"
FilterExp_
FltExp_GotFocus
FltExpr_GotFocus
Form_Loadj
screen
Width
Height
IndexOrder
vxUseDbf
cPath
vxUseNtx
vxSelectNtx
vxFilter6
vxCloseAll
vxDeallocate5
PatienceT
ColsB
ColWidthe
ColAlign
BRW_ALIGN_LEFT
Header
lInitializing
IndexOrd\
ListIndex
Form_Unload
Cancel
vxWindowDereg*
BrwdOne
IndexOrd_Click
vxSelectDbfJ
Action
BRW_ACT_REFRESHBAR
BRW_ACT_REFRESHALL
IndExprf
IndexOrd_GotFocus
IndExp_Click
IndexExpy
IndExp_GotFocus3
IndExpr_GotFocus
RecAdd_Click
Text1
lAppend+
RecAdd_GotFocus?
RecDele_Click
vxLockRecord"
MB_OKCANCEL
IDOK=
vxDeleteRec
vxUnlockP
RecDele_GotFocusd
RecEdit_Clicku
RecEdit_GotFocus\
RecSave_Click
lLockedm
vxAppendBlank
vxReplLong,
vxReplString
vxReplDouble
BRW_ACT_GOTOPB
BRW_ACT_REFRESHLINE
RecSave_GotFocus
Text1_GotFocus
Index
FltError
substr7
CATNOb
MB_ICONINFORMATION
vxRecNo
vxSeek
vxNtxExpr
vxNtxCurrent
Form_KeyDownQ
KeyCode
Shift
Form_Activate
nRecord
Form_Deactivate
lOpenDbf
opened
CATALOG
switching
betweens
windows
nIndexOrder
vxClose
vxSetAlias
vxTop
Form_QueryUnload
UnloadMode
CatCnt
Append / Edit flagn
Initializing flag
to store the current index orderA
store the current record number whenw
switching between windows
will be True if this is the instance of the form
that opened the CATALOG.DBF
Brw1_Change
The event is fired whenever the user has changed theC
actual Col and/or Row, using the mouse or keyboard,
or in code/Immed Window setting the .Col/.Row properties)
The parameter nRowCol can have one of the following values:
BRW_CHANGE_COL = 1 the column has changedl
BRW_CHANGE_ROW = 2 the row has changed
BRW_CHANGE_BOTH = 3 both the row and the column have changed
The EmptyFile flag can be checked here to see if there are any
records matching the criteria. This can be useful for disabling
actions such as delete a record or edit a record (if the file is
empty there is nothing to edit / delete.a
Current cell:
No records match the filters
Brw1_GetLine
Brw1 fires this event whenever a line is required for updatingi
the display. The database is positioned on the record fort
which the cLine is required. The VB program must fill the cLine
parameter with the data to be displayed, that is for each column
defined a string of ColWidth(k) must be added to cLinea
(otherwise spaces will be displayed).
The data must be padded with spaces so that it adds up to the
column width. You can assign any value, including VB variables
, etc., which is handy for calculated columns,d
displaying date fields as 'December 18, 1992'
or logical fields as 'Yes' or 'No ', or even flagging deleted
records (which will show if a filter to .NOT.DELETED() is not
set:r
If vxDeleted() Then cLine = "*" Else cLine = " "E
If vxDeleted() Then cLine = "Del " Else cLine = "
SYSNO
column 0, width = 6
GROUP
column 1, width = 4
column 2, ...
CATNO
DESCR
column 7, the last oneo
Brw1_GotFocus
the standard GotFocus event, do some house keeping stuff)
You are in BROWSE mode. press Help button for keyboard help
Brw1_HitBottom
fired whenever the user hits the bottom of the file
Brw1_HitTop
fired whenever the user hits the top of the filei
CommAbout_Click
CommAbout_GotFocus
Close window
CommHelp_Click
CommHelp_GotFocus
Help for the available keys in Browse
FltExp_Click
Pseudo-&Filter
Save Pseudo-&Filter
Input a standard xBase expression that evaluates to logical!
You can try something like:
'LIST > 500' or 'substr(CATNO,1,2)="HJ"'
Pseudo-&Filter
FltExp_GotFocus
Set a Pseudo-Filter expression
FltExpr_GotFocus
Enter the Pseudo-Filter, must be a valid xBase expression
Form_Activate
restore status
Form_Deactivate
save record numberd
Form_Load
center the form on displaym
assign the IndexOrder initial value
database is already openedx
open the database and indexes, set filter to !deleted()
CATALOG
CATSYS
CATGRP
CATNUM
.NOT.DELETED()
CATALOG
failed to open the file
%{F4}
Alt-F4
Browse CATALOG.DBF
Display a small non-modal form to tell the use to wait)
while the main form is loading
set the number of columns in displayl
set the widths of each column
now we can set the alignment of each column
(default is BRW_ALIGN_CENTER, can also be BRW_ALIGN_LEFT
or BRW_ALIGN_RIGHT )N
set the column header, it is one string made of a sum of
all the column headers, in this casei
12345678901234567890123456789012345678901...
1234561234123412341234567890121234567890...
Sysno Grp CodeTypeList Price Description
Sysno
Catalog number
List price
Description
and at last we assign the database and active index handle
if needed we can set a Index Expresion and a Pseudo-Filter
to start with, for example to show only breakers:
Brw1.IndexExp = "BRKR"m
and namely only those having a non-zero price (for example):
Bwrd.FilterExp = "LIST>0"
Assign the IndexOrd dropdown list with the index namesm
To avoid the IndexOrd_Click() sub to be triggered, the lInitializinga
is set to TRUE, otherwise the sub would call the Brw1.SetFocus,
which is invalid in the Form_Load sub.d
System number
Group+Code+Type
Part number
Set it back to FALSE when the init is donel
Form_QueryUnload
Close the browse windows in the reverse opening order (Last In - First Out)!
Form_Unload
release the vxBase data if the file is opened in this instancec
vxWindowDereg Me.hWnd
otherwise decrease the file usage count by onea
IndexOrd_Click
used to change the index orderi
Changing the index order will afect not only the display but it
will also trigger clearing of the Brw1.IndexExp and
Brw1.FilterExp - the scope and the pseudo-filtera
IndexOrd_GotFocus
Change the current index order
IndExp_Click
Index &key scope
Save Index &key scope
check if the index expression existsr
save current record
The expression entered was not found for the current index key:
Try something like 'BRKRMLDCHJQ'
Index &key scope
IndExp_GotFocus
Change/Input the Index key Scope
IndExpr_GotFocus
Enter the Scope, according to the current Index Key
RecAdd_Click
Append a new record, just blank the text controls, set the
global variable lAppend to TRUE and enable the Save button.
Then set focus to the first text controll
Enter the data, then click Save Changes to save
RecAdd_GotFocus
Append a new record
RecDele_Click
Delete a record, must lock the record before,
then get user confirmation. The unlock is not required, any
movement in the file will unlock the record, but it's a good
practice.
Confirm deletion of current record
Cannot lock record for deletion!
RecDele_GotFocus
Delete current record
RecEdit_Click
Edit the current record, the data is already there so just enable
the Save button and set focus to the first text control
Enter the data, then click Save Changes to save
RecEdit_GotFocus
Edit current record
RecSave_Click
Save record (either changed or new record), if new record try to
append blank, otherwise try to lock the record.
If succesfull ( lLocked will be TRUE ), replace data and send a
message to Brw1 to refresh current line (if in Edit mode) ord
to refresh the whole screen if appending.
NOTE: when appending a record to a file that is viewed using a
scope and eventually a pseudo-filter, and the new recordd
does not match the scope or the filter, then the position
in the file must be changed to be on one of the records
matching the scope and pseudo-filter expressions.
This can be easily achieved by sending a GoTop messagee
to the control, that is assign the Action propery too
BRW_ACT_GOTOP, see the BROWSE.WRI
The same care should be taken when editing fields that will change
the active index key (in this example Group, Code and Type), then
the VB program must check and repaint the whole control,p
by issuing a BRW_ACT_GOTOP = a go top request.e
SYSNO
GROUP
CATNO
DESCR
if there is a Scope
then force a GoTop
Cannot lock/append record for saving!
RecSave_GotFocus
Save the changes
Text1_GotFocus
Enable the Save button if clicked on any of the text controls
Enter the System no, field: CATALOG->SYSNO
Enter the Product Group, field: CATALOG->GROUP
Enter the Product Code, field: CATALOG->CODE
Enter the Product Type, field: CATALOG->TYPE
Enter the Product Catalog Number, field: CATALOG->CATNO
Enter the Product List Price, field: CATALOG->LIST
Enter the Product Description, field: CATALOG->DESCR
UpdateDisplay
Function to update the data displayed in the text controls
to reflect the current record. Note the last line calling
the current cell of the Brw1 control, that is the highlighted
cell, whatever that happens to be.o
SYSNO
GROUP
CATNO
DESCR
Current cell:
Browse CATALOG.DBF (Record#