GSAK (Geocaching Swiss Army Knife)
Contents - Index

Form (function)

Form(sForm,sOptions) : String

Display a GUI form in a macro

sForm - The code that makes up the form to display
sOptions - Provided for future enhancements. Currently you should just enter as "".

Use the string return value of Form() to determine how the user exits the form. Possible values:

SystemExit - The user clicked on the Red X button at the top of the form
DelayExit - The form used a "Delay" property, and the delay timer reached zero without any user intervention
Control Name - The name of the control that caused the form to exit.  

This is probably best illustrated by a simple macro that uses the form function:

While True # Infinite loop to redisplay form as required
  $FormExit = form($form,"")
    Case $FormExit = "DelayExit"
      MsgOk msg="Form exit via Delay"
    Case $FormExit = "SystemExit"
      MsgOk msg="Form exit via red X button on form"
    Case $FormExit = "btnCancel"
      MsgOk msg="Form exit from the cancel button"
    Case $FormExit = "btnOk"
      msgOk msg="We clicked on the OK button, form will redisplay"
      # perform OK calcs here, then because we do not have a BREAK the form will redisplay

<Data> VarName=$form
# Form generated by GSAK form designer on Sat 01-Sep-2007 16:26:20

Name = Form1
  Type = Form
  Delay = 10
  Height = 137
  Width = 287

Name = btnOk
  Type = Button
  Height = 25
  Left = 32
  Top = 40
  Width = 75
  Caption = OK

Name = btnCancel
  Type = Button
  Height = 25
  Left = 152
  Top = 40
  Width = 75
  Caption = Cancel


Related: EditForm()

Alpha List         Category List

Copyright 2004-2015 CWE Computer Services  
Privacy Policy Contact