  rem -- Simple VDS program with general tutorial type comments --
  rem -- A "rem" at the beginning causes VDS to ignore that line.
  rem -- Note: X is "position from left". Y is "position from top".

  rem -- This makes the program appear the same on different systems.
  OPTION SCALE, 96

  rem -- This line is necessary for programs to run in some European
  rem -- countries if you use decimal points in your code.
  OPTION DECIMALSEP, "."

  rem -- This sets the title on INFO, WARN, etc. boxes.
  TITLE By Mac

  rem -- This names the main window program and creates it at the
  rem -- first 2 coordinates: Y (-1), X (0). The next two set the
  rem -- "width"(300) and "height" (100) of the window. Using -1
  rem -- as either of the first two coordinates centers the window.
  DIALOG CREATE,Test prog,-1,0,300,100

  rem -- Between "DIALOG CREATE" (above) and "DIALOG SHOW" (below)
  rem -- is where "Dialog elements" are usually added.

  rem -- This adds a button named "Test1" at Y 5, and X 10 on
  rem -- the program window. It's width is 50 and height is 20.
  DIALOG ADD,BUTTON,Test1,5,10,50,20

  rem -- This adds an edit box named "Edit1" at Y 5 and X 80 on
  rem -- the program window. It's width is 140 and height is 20.
  DIALOG ADD,EDIT,Edit1,5,80,140,20

  rem -- This adds a button named "Test2" at Y 5, and X 240 on
  rem -- the program window. It's width is 50 and height is 20.
  rem -- We're setting it's text to "Try This", and making it
  rem -- the "default" (activates when you hit the ENTER key
  rem -- from an edit box). Note the button name is still "Test2".
  DIALOG ADD,BUTTON,Test2,5,240,50,20,"Try This",,DEFAULT

  rem -- This displays the window and elements you have created.
  DIALOG SHOW

  rem -- This is where the program returns to after user actions.
  rem -- It can have any name, just so procedures return here.
:EVLOOP
  rem -- This waits for a user action (button press, etc.).
  WAIT EVENT
  rem -- This goes to the "event" label that is generated by a
  rem -- user action. If it's a button, it will be "nameBUTTON".
  goto @event()

  rem -- Here's the label for events generated when the "Test1"
  rem -- button is pressed. Notice the colon ":" in front, this
  rem -- makes it a "label" that can be used by the "goto" command.
:Test1BUTTON
  rem -- This pops up an information window with the text used.
  INFO You pressed the Test1 button.
  rem -- This returns to the "EVLOOP" label.
  goto EVLOOP

  rem -- Here's the label for events generated when the "Test2"
  rem -- button is pressed (even though the text is "Try This").
  rem -- It's set as "default", so it also works on an ENTER key
  rem -- press if the cursor is in the edit box.
:Test2BUTTON
  rem -- Check for text in the Edit1 edit box.
  if @dlgtext(Edit1)
    rem -- Show an info window containing the text from Edit1.
    INFO @dlgtext(Edit1)
  else 
    rem -- If Edit1 is empty, show a WARN window.
    WARN Edit box is empty!
  end 
  rem -- This returns to the "EVLOOP" label.
  goto EVLOOP

  rem -- This is the event that is created when user clicks on
  rem -- the "x" in the upper right corner to close the program.
:CLOSE
  rem -- This exits the program.
  EXIT 
