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,"")
  BeginCase
    Case $FormExit = "DelayExit"
      MsgOk msg="Form exit via Delay"
      break
    Case $FormExit = "SystemExit"
      MsgOk msg="Form exit via red X button on form"
      break
    Case $FormExit = "btnCancel"
      MsgOk msg="Form exit from the cancel button"
      break
    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
  EndCase
EndWhile

<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

<enddata>




Related: EditForm()

Alpha List         Category List

Copyright 2004-2014 CWE Computer Services  
Privacy Policy Contact