home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
C!T ROM 2
/
ctrom_ii_b.zip
/
ctrom_ii_b
/
PROGRAM
/
BASIC
/
MKFORM
/
MAKEFORM.DEM
< prev
next >
Wrap
Text File
|
1994-04-06
|
4KB
|
106 lines
DEFINT A-Z
'This is your MAIN module
'$INCLUDE: 'MFM_COMM.BI' 'common stuff
'$INCLUDE: 'MERLIN.DCL' 'Merlin assembler library subset
'$INCLUDE: 'MAKEFORM.BI' 'your own form fields and constants
'Check the files that are loaded:
'If you use no scroll bars, load NO_SCRLB.BAS instead of SCROLLB.BAS
'If you use no list boxes, load NO_LISTB.BAS instead of LISTBOX.BAS
DECLARE SUB Cleanup ()
DECLARE SUB EditForm (Fld() AS ANY, Form$(), Frm AS ANY)
DECLARE SUB GetEvent ()
DECLARE SUB Startup (FormName$, FontName$, MouseChar%, Frm AS ANY, Fld() AS
ANY, Form$())
DECLARE SUB ShowForm (Fld() AS ANY, Frm AS ANY, SetPal)
'*********************************'
'Block 1: Housekeeping
'All program variables and constants go here:
'COMMON SHARED ....
'(RE)DIM SHARED ....
'Some COMMON variables are in MFM_COMM.BI - be sure to check that file!
'Initialise your MAIN LOCAL and COMMON variables here:
'*********************************'
'Block 2: Current program
'Variables to work with a FORM
DIM SHARED Frm AS FormType
REDIM SHARED Fld(0) AS FieldType
REDIM SHARED Form$(0, 0)
FormName$ = "MAKEFORM"
FontName$ = "HELV8X12.MFN"
MouseChar = 8
'The file Helv8x12.MFN and the file Mouse.MFN are
'supposed to be in this subdir too!
Startup FormName$, FontName$, MouseChar, Frm, Fld(), Form$()
'*********************************'
'Main loop:
ShowForm Fld(), Frm, FadeSpeed 'Show PCX file and load field defs
'FadeSpeed contains palette fade out speed in high byte,
'fade in speed in low byte. Set in MF_COMM.BI.
MouseOn
Frm.Flags = Frm.Flags OR 4 'initialise form
Frm.NextFld = 1 'begin at first field
ProgStage = pRunning 'program is running
DO: 'Get Click, MouseX, MouseY, KeyVal, KeyFlags, ClickMem, KeyMem
GetEvent
EditForm Fld(), Form$(), Frm
'Return EventNotUsed and Fld.HotK upon release of object.
'EventNotUsed = -1: haven't used it at all
'EventNotUsed = -2: want to use event again - GetEvent skips itself.
'Completed press on item with key or mouse
IF KeyVal = Fld(Frm.CurrFld).HotK THEN
'Normally Fld.HotK is always set (to 255 if not defined)
SELECT CASE Frm.CurrFld
'Enter CASE statements for all
'buttons, list boxes and mouse fields.
'Use the list of CONST from your own .BI file
'Scroll bars return their hotkey too upon changing the slide
CASE ELSE: END SELECT
END IF
'Going to a new field
IF Frm.NextFld <> Frm.CurrFld THEN
SELECT CASE Frm.CurrFld
'You may need to check something. Validation of
'numeric input and dates is done by EditForm.
'Field entries may also lead to updating other fields,
'which is done by calling PrintArray.
'CASE ...
CASE ELSE: END SELECT
END IF
'Same field running checks
IF Frm.NextFld = Frm.CurrFld THEN
SELECT CASE Frm.CurrFld
'You may want to update other fields when
'a scroll bar pointer is moved for example
'or update row/column status bar on screen, etc.
'Listbox scrollbars do everything themselves!
'CASE ...
CASE ELSE: END SELECT
END IF
LOOP UNTIL QuitProgram OR KeyVal = kbCtrlC OR KeyVal = kbEscape
'The KeyVal exits here are just for safety. Set QuitProgram = true
'when your Exit button is used and remove the rest later.
Cleanup
'That's all folks! Have fun!