// QQ.PRG - returns a Query object.
// Examples of usage:
// r = qq('Customer','ByName').rowset
// q = qq('Customer')
param cTableName, cIndexName // 2nd param is optional
local q
q = new Query()
q.sql = 'select * from "' + cTableName + '"'
q.active = true
if type('cIndexName') == 'C'
q.rowset.IndexName = cIndexName
endif
return q
/*
RView.prg
By Peter Rorlick
Native-classes version for VdB 7.01
Usage: (from Command Window:) RView( cTable, [cTag] )
or: RView( oRowset )
or: RView( oQuery )
Returns a reference to the Query object.
*/
parameter cTable, cTaglocal f, oRowset
f = new ViewRwstForm()if type('cTable') == 'O'
// If the 1st param is an object, we'll assume that
// it's a rowset or a query.
if 'QUERY' $ cTable.className
if cTable.active = false
cTable.active := true
endif
oRowset = cTable.rowset
else // else we assume cTable is a rowset...
oRowset = cTable
endif
else
// Else we assume that it's a string containing
// the name of the DBF.
f.q = new Query()
f.q.sql := 'Select * from '+cTable
f.q.active := true
oRowset = f.q.rowset
endiff.text := oRowset.parent.sql
if type('cTag') == 'C' // if the tag was specified...
oRowset.indexName := cTag
f.text += ' (indexName = '+cTag+')'
endifoRowset.first()
f.rowset := oRowset
f.Grid1.datalink := oRowset
f.open()
return oRowset.parent // Return the Query object
**********
class ViewRwstForm of FORM
with (this)
height = 14
left = 34
top = 5
width = 70
text = ""
endwiththis.GRID1 = new GRID(this)
with (this.GRID1)
anchor = 6 // Container
bgColor = '0X80FFFF'
cellHeight = .8
endwithendclass
// SetUp.prg - Set up useful hot-keys, and open procedure files.
on key label Shift+F4 keyb "RView('')"+repl("{Left}",2)
on key label Shift+F5 keyb 'true'
on key label Shift+F6 keyb 'false'
* F8 = today's date in english
on key label f8 keyb cmonth(date())+' '+day(date())+', '+year(date())
* Alt-F6 = _app.
on key label Alt+F6 keyb "_app."
if not "runtime" $ lower( version(0) )
on key label f3 keyb 'Modify command '
on key label Shift+f3 keyb 'Modify form .wfm'+repl("{Left}",4)
* Ctrl-F1 = duplicate the current line in the editor
on key label Ctrl+F1 keyb "{Home}{Shift+DnArrow}{Ctrl+C}{Ctrl+V}{Ctrl+V}{UpArrow}"
* Ctrl-F2 = else
on key label Ctrl+F2 keyb "{End}{Enter}{Backspace}{Backspace}else{Enter} "
* Ctrl-F3 = endif
on key label Ctrl+F3 keyb "{End}{Enter}{Backspace}{Backspace}endif{Enter}"
* Alt-F3 = MsgBox('','')
on key label Alt+F3 keyb "MsgBox('','',48)" + replicate("{Left}",8)
* Alt-F5 = .wfm
on key label Alt+F5 keyb ".wfm"
* Alt-R = Comment the current line in the editor, with // .
on key label Alt-r keyboard "{home}// {dn}{home}"
* Alt-F9 = Add a comment at the end of the current line
on key label Alt+F9 keyb "{End}" + " // "
* Shift-F7 = Indent current line (and go to next line)
on key label Shift+F7 keyb "{Home}" + space(2) + "{Home}" + "{DnArrow}"
* Shift-F8 = Outdent current line (and go to next line)
on key label Shift+F8 keyb "{Home}" + "{Del}" + "{Del}" + "{DnArrow}"
endif
set proc to
set proc to MyControls.cc addi
set proc to xtraBtns.cc addi
set proc to seeker.cc addi
set proc to funclib.prg addi
set proc to date.cc addi
// and so on...
And save it to a “Frequently needed
stuff” folder. On my machine, I decided to call this folder
\VdB7\CC, and in the Files
tab of the DesktopProperties dialog, I set the Search path to point
to that folder. I keep all my commonly-used CC’s, PRG’s, WFM’s, and
CFM’s in that folder as well; that way, I can call them from any directory
without worrying about the path..
[CommandSettings]
COMMAND=SetUp()
That way,
SetUp.prg will be run
every time you load dBASE.
use MyTable
modi stru
If you got exclusive access to
the table, the text in the Table Designer will be black, otherwise it will
be gray.
modi stru
set proc to MyControls.cc addi
/*
F.prg
For testing form stuff from the Command window.
To run this, just type F() in the Command window...then have fun!
By Peter Rorlick
*/
local cr, cSQL
cr = chr(13)
cSQL = 'Select * from "' + _dbwinhome + 'Samples\sample.dbf"'
_app.bGridOnOpen = {;;
this.move(2,9.5,60,5) ;;
this.anchor:=1 ;;
oForm=this.parent ;;
oForm.q.active:=true ;;
oForm.rowset:=oForm.q.rowset ;;
this.datalink:=oForm.rowset }
set typeahead TO 500
keyb 'f = new form()' + cr +;
'f.onOpen = {; this.move(9,3,50,15) }' + cr +;
'f.ed = new editor(f)' + cr +;
'f.ed.top := 5' + cr +;
'f.ef = new entryfield(f)' + cr +;
'f.pb = new pushbutton(f)' + cr +;
'f.pb.left := 20' + cr +;
'f.tx = new text(f)' + cr +;
'f.tx.top := 3' + cr +;
'f.tx.text := "Hello"' + cr +;
'f.q = new query()' + cr +;
'f.q.sql := [' + cSQL + ']' + cr +;
'f.g = new grid(f)' + cr +;
'f.g.onOpen := _app.bGridOnOpen' + cr +;
'*inspect(f)' + cr +;
'f.open()' + cr
// E.PRG - opens some freqently edited files in the Source Editor
// Just type E() in the Command window to run this.
modify command C:\vdb7\cc\Base.cc
modify command C:\vdb7\cc\MyControls.cc
modify command Main.wfm
modify command C:\vdb7\cc\functionLibrary.prg
// i.prg
// Just type I() in the Command window to run this and edit VDB.INI
private c
c = 'modify command "' + _dbwinhome + 'bin\vdb.ini"'
&c
Then arrange the layout in the IDE to your liking, in an effort to minimize overlapping of the tool windows and palettes. The less things are on top of each other, the faster you’ll be able to work. In particular, you might want to arrange the layout of the palettes in the Form Designer something like this:
Once you’re happy with the layout,
and with the property settings of the Desktop, Navigator, and Source Editor,
you should exit from Visual dBASE and make a backup copy of VdB.INI.
That way, if anything ever gets messed up (or if you have to reinstall
VdB), you can just restore the backed-up copy of your VdB.INI.
In the Inspector, click on a specific
property or event or method, then hit F1 for help on that topic.
help class <className>or:
x = new <className>()
inspect(x)