Using TQDBView for the first time

Starting from scratch is very simple.

  • Place a TQDBView on a form. Call it Q.

  • Place an ordinary panel (or similar container) on the form. Call it P.

  • Add ordinary controls (not data-aware ones) to the panel in whatever way you wish. Standard edit controls, rich edit boxes, radio groups, check boxes, combo boxes, list boxes, and images are all recognized. In this case just add two edit boxes, Edit1 and Edit2, and two labels, Label1 and Label2. The text in the edit boxes will be stored but the labels will not.

  • Set the FileName property of Q to create a new QDB file. This file will be automatically "branded" with the field structure defined by the controls on the panel.

  • Provide a handler for the OnKey event. The simplest handler would just set the Key parameter to one of the fields, e.g.:

   procedure TForm1.OnKeyHandler(Sender: TObject; var key: TKey);
   begin
    key:=Edit1.Text;
   end;


  • Add a TQDBNavigator component to the form and set its QDB property to point to the QDBView, i.e., Q..

  • Compile and run the new application. You can view and modify the QDB file by pressing the various navigator buttons.

  • For example, press the Insert button. You will see the edit boxes change color. Type some text into the boxes and press the Post button. Repeat this a few times.

  • You can move forward and backward in the usual way or you can press Edit to change some values.

That's all there is to the basic use of TQDBView. Have a look at the example programs (vanimals and vaddress) which show slightly more complex use of TQDBView. Compare these to the versions (animals and address) which use TQDB directly. The new versions are considerably simpler but slightly slower and the QDB files they produce are less compact. The trade-off is a common one.