Navigation:  Reference > Functions >

LoadModalForm()

Print this Topic Previous pageReturn to chapter overviewNext page

 

LOAD_MODAL_FORM(1)

 

PURPOSE

This function will load a form from the disk onto the screen in a modal state.

 

PARTS

 

1 f/c/eRequired - The name of the form to load, must include complete path.

 

RETURN TYPE - I

The function will return the modal result.  This depends on what you use to close the form.  Generally this will be determined by the button the user clicks to close the form.  For more information about modal result please refer to TButton.

 

COMMENTS

Every form loaded in Windows is either in a modal or non-modal state.  If it's in a modal state that means it is the only form the user can interact with for that application.  This means everything else stops until the user is finished with this form.  For that reason you want to be judicious in your usage of this type of form.  It is generally best for logon screens, dialog type screens, etc.  Don't use this for general entry screens unless you want to make sure the user finishes with this screen before they continue with anything else.

 

NOTE:  If you have specified that forms are to be encrypted (FormsEncrypted) then those loaded using this function must also be encrypted.  If they aren't they will not be loaded properly.

 

Modal result constants are in the COMPILERCONSTANTS.TXT file.  They are:

 

mrNone=0

mrOk=1

mrCancel=2

mrAbort=3

mrRetry=4

mrIgnore=5

mrYes=6

mrNo=7

mrAll=8

 

NOTE:  You cannot QUIT the program when you are in a modal form.  You must exit the modal form first.

 

NOTE:  The LOAD_MODAL_FORM() function automatically saves the traps and sets them all to Ignore.  When the modal form is closed the traps are restored.  This will make sure that you don't have a TRAP ESC set or something similar that would try to QUIT the program before the modal form is closed.

 

Example

Here is a sample of how to use load and unload a modal form.

 

btndupe.click: //This was the button fron the mail form

define screen type I // define a field to use the form

  screen = LOAD_MODAL_FORM('screen') //Load the screen

    ret

 

start: // code to start the form

   //set the variables

   ret

 

// button event to process the form

button1.click:

// Do somthing and unload your screen.  

      SET_OBJECT GET_FORM_NAME() PROPERTY 'modal_result' VALUE MrCancel // After we process get rid of the form in code.

      ret

 

Note : You can also unload a modal screen by seting a button to MrCancel

 

See Also

LOAD_FORM , ENABLE_ALL , RELEASE_FORM, ACTIVATE_FORM

 


Page url: http://www.cassoftware.com/tas/manual/loadmodalform().htm