/*
** html_formular_button.ced
**
** $VER: html_formular_button.ced 1.7 (01.21.1999)
**
** Arexx script for HTML v3.2 formular button mark
**
** This script works with CygnusEd Professional v4.2
**
** Copyright © Eric BELLE
*/
/*
**------------------------------------------------------------------------------
** Initialisation
**------------------------------------------------------------------------------
*/
OPTIONS RESULTS /* Tell CygnusEd to return results. */
NL = '0A'X /* Alias for new line. */
KRETURN = RAWKEY 68 /* Shortcut to the return key. */
KTAB = RAWKEY 66 /* Shortcut to the tab key. */
STATUS TABSARESPACES /* Return TAB mode ("tab" or "space"). */
IF RESULT = 1 /* Test the TAB mode. */
THEN "TABS = SPACES" /* Switch TAB mode from "space" to "tab". */
ELSE NOP /* No operation. */
TAB SIZE 1 /* Set TAB size proportional to 2 spaces. */
/*
**------------------------------------------------------------------------------
** Button mode
**------------------------------------------------------------------------------
*/
ButtonChoice = "no"
Do While (ButtonChoice="no")
OKAY2 "Button type:" || NL ||,
"~~~~~~~~~~~" || NL ||,
" (s)ingle input | (v)alidate formular " || NL ||,
" (m)ultiple inputs | (r)eset formular "
IF (RESULT=0)
THEN EXIT 0
ELSE ButtonChoice="ok"
ButtonMode = "q"
DO WHILE ~(ButtonMode="s" | ButtonMode="m" | ButtonMode="v" | ButtonMode="r",
| ButtonMode="RESULT" | ButtonMode=" ")
GETSTRING "s" '"button type: s, m, v, r?"'
ButtonMode = RESULT
END
IF (ButtonMode="RESULT" | ButtonMode=" ")
THEN ButtonChoice = "no"
ELSE NOP
END
/*
**------------------------------------------------------------------------------
** Button number
**------------------------------------------------------------------------------
*/
IF (ButtonMode="s" | ButtonMode="m")
THEN DO
GETNUMBER 3 '"Button number?"' 1 32768
ButtonNumber = RESULT
IF (ButtonNumber=" ")
THEN EXIT 0
ELSE NOP
DO I=1 TO ButtonNumber
String = '"Button text n°' || I || '?"'
Default = '"Text n°' || I || '"'
GETSTRING Default String
ButtonText.I = RESULT
IF (ButtonText.I="RESULT" | ButtonText.I=" ")
THEN EXIT 0
ELSE NOP
String = '"Button value n°' || I || '?"'
Default = '"Value' || I || '"'
GETSTRING Default String
ButtonValue.I = RESULT
IF (ButtonValue.I="RESULT" | ButtonValue.I=" ")
THEN EXIT 0
ELSE NOP
END
END
ELSE NOP
/*
**------------------------------------------------------------------------------
** Html button marks
**------------------------------------------------------------------------------
*/
SELECT
WHEN (ButtonMode="v") THEN DO
GETSTRING "Send" '"Button text to validate the formular?"'
ValidButtonText = RESULT
IF (ValidButtonText="RESULT" | ValidButtonText=" ")
THEN EXIT 0
ELSE NOP
ButtonString = ''
END
WHEN (ButtonMode="r") THEN DO
GETSTRING "Reset" '"Button text to reset all formular inputs?"'
ResetButtonText = RESULT
IF (ResetButtonText="RESULT" | ResetButtonText=" ")
THEN EXIT 0
ELSE NOP
ButtonString = ''
END
WHEN (ButtonMode="s") THEN DO
GETSTRING "Name" '"Group name for all the buttons?"'
ButtonName = RESULT
IF (ButtonName="RESULT" | ButtonName=" ")
THEN EXIT 0
ELSE NOP
DO I=1 TO ButtonNumber
ButtonString.I = ' ' || ButtonText.I
END
END
WHEN (ButtonMode="m") THEN DO
GETSTRING "Name" '"Group name for all the buttons?"'
ButtonName = RESULT
IF (ButtonName="RESULT" | ButtonName=" ")
THEN EXIT 0
ELSE NOP
DO I=1 TO ButtonNumber
ButtonString.I = ' ' || ButtonText.I
END
END
OTHERWISE NOP
END
/*
**------------------------------------------------------------------------------
** Html button structure
**------------------------------------------------------------------------------
*/
SELECT
WHEN (ButtonMode="v" | ButtonMode="r") THEN TEXT ButtonString
WHEN (ButtonMode="s" | ButtonMode="m") THEN DO
DO I=1 TO buttonNumber
TEXT ButtonString.I
"AUTO-INDENT"
END
END
OTHERWISE NOP
END
/*
**------------------------------------------------------------------------------
** End of html_formular_button.ced Arexx script
**------------------------------------------------------------------------------
*/
EXIT 0