home *** CD-ROM | disk | FTP | other *** search
/ DOS Wares / doswares.zip / doswares / DATABASE / DBASE5 / CUA_SAMP.ZIP / HELLO.PRG < prev    next >
Encoding:
Text File  |  1994-06-24  |  1.9 KB  |  60 lines

  1. *
  2. * File HELLO.PRG
  3. *
  4. SET TALK OFF
  5.  
  6. DEFINE FORM Hello ;
  7. PROPERTY ;
  8.    EscExit .T., ;
  9.    Text "A simple dBASE form", ;
  10.    Width 40, Top 3, Left 10, Height 15, ;
  11.    Minimize .T., Maximize .T., ;
  12.    OnClose HelloCls
  13.  
  14.  
  15. DEFINE TEXT Text1 OF Hello ; 
  16.   PROPERTY ;
  17.     ColorNormal "B/W", ;
  18.     Text "Hello world!", ; 
  19.     Width 23, Top 3, Left 13
  20.  
  21. DEFINE PUSHBUTTON Button1 OF Hello ;
  22.   PROPERTY ;
  23.     OnClick Btn1Click, ;
  24.     StatusMessage "Click button to change text.", ;
  25.     Text "Click Me", ;
  26.     Width 12, Top 9, Left 12, Height 2
  27.  
  28. lVoid = Hello.Open()     && Open the form window.
  29.  
  30. ********************************************************************
  31. * Btn1Click--Button1 OnClick event handler
  32. * Change the message that displays on the form, the button label, 
  33. * the color of the button, and the button's status message, all to
  34. * indicate that the user can click the button to exit. Changing the
  35. * button's OnClick handler to Btn2Click changes its action to 
  36. * exiting the form window.
  37. ********************************************************************
  38. PROCEDURE Btn1Click      
  39.    form.Draw = .F.                    && Prevent form from showing each change.
  40.    form.Text1.ColorHighlight = "R+/B"
  41.    form.Text1.Text = "Goodbye world." && Change form window message.
  42.    form.Text1.Left = 12               && Center new text.
  43.    this.OnClick = "Btn2Click"         && Point to event handler that closes form.
  44.    this.StatusMessage = "Click button to exit."
  45.    this.Text = "Goodbye!"
  46.    this.ColorHighlight = "R+/B"
  47.    form.Draw = .T.                    && Draw all changes at once (reduces flicker).
  48. RETURN
  49.  
  50. PROCEDURE Btn2Click      && Event handler for Button2 OnClick event
  51.    ? CHR(7)              && Beep!
  52.    lVoid = form.Close()  && Close form window.
  53. RETURN
  54.  
  55. PROCEDURE HelloCls
  56.    lVOID = this.Release()
  57.    RELEASE Hello
  58.    SET TALK ON
  59. RETURN
  60.