home *** CD-ROM | disk | FTP | other *** search
/ PC World Komputer 1998 April B / Pcwk4b98.iso / Borland / Dbase50w / SAMPLES1.PAK / SEARCH.WFM < prev    next >
Text File  |  1994-08-02  |  4KB  |  124 lines

  1. *****************************************************************************
  2. *  PROGRAM:      Search.wfm
  3. *
  4. *  WRITTEN BY:   Borland Samples Group
  5. *
  6. *  DATE:         5/93
  7. *
  8. *  UPDATED:      6/94
  9. *
  10. *  REVISION:     $Revision:   1.26  $
  11. *
  12. *  VERSION:      dBASE FOR WINDOWS 5.0
  13. *
  14. *  DESCRIPTION:  This form executes a simple search.  It will accept a value
  15. *                and search for it using the current index.  It allows the
  16. *                calling program to handle the results.  The entered value
  17. *                is attached to the OkButton, so the calling program can
  18. *                search for it in whatever way it needs.
  19. *
  20. *  PARAMETERS:   None
  21. *
  22. *  CALLS:        Buttons.cc         (for custom controls)
  23. *
  24. *  USAGE:        DO Search.wfm
  25. *                or
  26. *                (this is how Search is called from Orders.mnu and Customer.mnu)
  27. *                set procedure to Search.wfm additive
  28. *                local f
  29. *                f = new Search()
  30. *                f.mdi = .f.       && modal forms cannot be mdi
  31. *                selected = f.ReadModal()
  32. *                seek f.value
  33. *
  34. *******************************************************************************
  35. #include <Messdlg.h>
  36. set ldCheck off
  37. ** END HEADER -- do not remove this line*
  38. * Generated on 05/18/94
  39. *
  40. LOCAL f
  41. f = NEW SEARCHFORM()
  42. f.Open()
  43.  
  44. CLASS SEARCHFORM OF FORM
  45.    Set Procedure To BUTTONS.CC Additive
  46.    this.OnOpen = CLASS::ONOPEN
  47.    this.OnClose = CLASS::ONCLOSE
  48.    this.OnSelection = CLASS::ONSELECTION
  49.    this.MousePointer =          1
  50.    this.Text = "Search"
  51.    this.Width =         36.79
  52.    this.Top =          7.29
  53.    this.Left =         33.98
  54.    this.Height =          6.00
  55.    this.Minimize = .F.
  56.    this.Maximize = .F.
  57.    this.HelpFile = ""
  58.    this.HelpId = ""
  59.  
  60.    DEFINE RECTANGLE SEARCHRECT OF THIS;
  61.        PROPERTY;
  62.          ColorNormal "N/W",;
  63.          Text "&Search for:",;
  64.          Height          2.92,;
  65.          Width         34.31,;
  66.          Top          0.54,;
  67.          Left          1.32,;
  68.          Border .T.
  69.  
  70.    DEFINE ENTRYFIELD SEARCHENTRY OF THIS;
  71.        PROPERTY;
  72.          ColorNormal "B/W",;
  73.          Width         31.67,;
  74.          Top          1.60,;
  75.          Left          2.64,;
  76.          Height          1.32,;
  77.          Value "            ",;
  78.          FontSize         11.00,;
  79.          Border .T.,;
  80.          ColorHighLight "B+/W*"
  81.  
  82.    DEFINE OKBUTTON OKSEARCHBUTTON OF THIS;
  83.        PROPERTY;
  84.          Width         14.11,;
  85.          Top          3.98,;
  86.          Left          4.00,;
  87.          Height          1.50,;
  88.          Default .T.
  89.  
  90.    DEFINE CANCELBUTTON CANCELSEARCHBUTTON OF THIS;
  91.        PROPERTY;
  92.          OnClick .f.,;
  93.          Width         14.11,;
  94.          Top          3.98,;
  95.          Left         19.50,;
  96.          Height          1.50,;
  97.          Group .F.,;
  98.          Id 0
  99.  
  100.    ****************************************************************************
  101.    procedure OnOpen
  102.    ****************************************************************************
  103.    set procedure to Sampproc additive
  104.                                     && if Search was called from customer/
  105.    if type("this.keyName") <> "U"   && orders with the keyName property assigned
  106.       this.text = FormatStr("Search -- %1", this.keyName)
  107.       this.searchEntry.picture = this.formatting
  108.    endif
  109.    this.searchEntry.SetFocus()
  110.  
  111.    ****************************************************************************
  112.    procedure OnClose
  113.    ****************************************************************************
  114.    close procedure Buttons.cc, Sampproc.prg
  115.  
  116.    ****************************************************************************
  117.    procedure OnSelection(controlId)
  118.    ****************************************************************************
  119.    if controlId <> 0   && If Cancel wasn't selected
  120.       form.value = form.searchEntry.value
  121.    endif
  122.    form.Close()
  123. ENDCLASS
  124.