IDE Tips and Tricks
by Peter Rorlick [dBVIPS], co-founder of  Montreal Business Software. He has been developing xbase solutions since 1981.
HERE are some clever but simple tricks that can boost your productivity in the VdB7 integrated development environment (IDE)...

1 Press Ctrl-Enter in the Command window or Source Editor when the cursor is on a file name....this opens the file in the Source Editor.


2  Have a little Quick-Query program on hand to create and return query objects:
  // 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

3  For viewing or editing rowsets from the Command window, use this little program:
/*
  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, cTag

local 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
endif

f.text := oRowset.parent.sql

if type('cTag') == 'C'  // if the tag was specified...
  oRowset.indexName := cTag
  f.text += ' (indexName = '+cTag+')'
endif

oRowset.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 = ""
   endwith

   this.GRID1 = new GRID(this)
   with (this.GRID1)
      anchor = 6  // Container
      bgColor = '0X80FFFF'
      cellHeight = .8
   endwith

endclass


4  When multiple files are open in tabbed view in the Source Editor:
Press Alt-F F <number> to select a specific tab (no need to take your fingers off the keyboard)
Alt-F F 2 toggles between the last two files loaded into the editor.

5  Create a SetUp.prg, to load commonly used procedure files and to set up some useful hot-keys:
  // 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..


6  In your VdB.INI, add this:
  [CommandSettings]
  COMMAND=SetUp()

That way, SetUp.prg will be run every time you load VdB7.


7  Ctrl-F9 toggles the visibility of the treeview in the source editor.

8  Want to find out if any other user or process has a particular table open?
In the Command window, type:

  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.


9  Most commands and functions can be abbreviated to 4 chars, e.g.:
  modi stru
  set proc to MyControls.cc addi

10  For experimentation from the Command window, use this little program:
/*
  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

11  For any sequence of commands (or even a single command) that you frequently type into the Command window, create a little PRG.  Example:

  // 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


12  Here's another handy little 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

13  Alt-V C will always bring the Command window into focus and in front.

14  Use Ctrl-Tab or Ctrl-F6 to cycle the focus among the currently open windows.

15  In the Form Designer:
  F12 opens/closes the Source Editor
  F11 opens/closes the Inspector

16  Work at the highest resolution that your eyes can withstand without squinting.
  1024 x 768 at the very minimum.
  1152 x 864 is my preference.  I have a 21" monitor.
  1280 x 1024 or higher is for masochists unless you have a huge monitor.

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.


17In the Form Designer, right-click on the Component Palette, choose Customize Tool Windows, and on the Component Palettes tab, choose “Image with text to the right”.

18  Use the Command window as much as possible, rather than the Navigator and the menus.  It's much faster, even if you're not a fast typist.

19  Copy and paste between the Command Window and the Source Editor whenever it's expedient to do so.

20  Use Ctrl-W to save-and-close in any of the design tools.

21  Press F2 to save-and-run from the Form Designer or the Source Editor.

22  In the Command window or Source Editor, double-click on a word (a command keyword, class name, or function) then hit F1 for help on that topic.

In the Inspector, click on a specific property or event or method, then hit F1 for help on that topic.


23  To find out what the properties, events, and methods of a particular class are, type this in the Command window:

  help class <className>

Or:

  x = new <className>()
  inspect(x)


24  If you want to find a specific class, method, function, or procedure very quickly in the Source Editor: Give focus to the treeview pane (by clicking on it, or by pressing Ctrl-F9 twice), then type the first few letters of the class/method/function name.  It works by incremental search if you type fairly quickly.  If you type slowly, it will find the next class/method/function that begins with the letter you typed.  Press Tab to set the focus back to the editing pane.

25  In the Source Editor, highlight a block of code, then press Tab or Shift-Tab to indent or outdent the block.