This is an example for a Login-Window before the main application starts.

Before the main window opens the user must login in. As long as the typed password does not match with the password stored in the table the login-window does not close and displays the according message. 

The window of the login procedure is a simple procedure, the window is set to be "system modal". It contains a file-dropdown and an entry for the local variable, a 'Login'-button and a 'Cancel'-button.

When clicked on 'Login' and the LOC:Password matches with the USE:Password GLO:LoggedIn becomes TRUE.

If the user cancels the window gets closed. Because GLO:LoggedIn is still FALSE a HALT() is triggered and the application finishes before the main window has opened yet.

The global variable GLO:LoggedIn is defined in the dictionary.



CheckPassword ROUTINE

    GLO:LoggedIn = FALSE

    GET(Userlist, USE:Key_Name)
    IF ~ERRORCODE()
        IF CLIP(USE:Password) = CLIP(LOC:Password) THEN
            GLO:LoggedIn = TRUE
            POST(Event:CloseWindow)
        ELSE
            UNHIDE(?LoginMessage)
        END
    END
    EXIT

CheckPassword ROUTINE

    GLO:LoggedIn = FALSE
    ! before any comparison the is set to FALSE

    GET(Userlist, USE:Key_Name)
    IF ~ERRORCODE()
        ! The user MUST perform a search against the userlist, otherwise
        ! the USE:Password is empty.
        ! '' is equal to '' so it would match accidently....

        IF CLIP(USE:Password) = CLIP(LOC:Password) THEN
            GLO:LoggedIn = TRUE
            POST(Event:CloseWindow)
        ELSE
            UNHIDE(?LoginMessage)
            ! The message has been there on the screen but hidden.
            ! This avoids us ?LoginMessage{PROP:Text} = 'Login incorrect'
            ! We do not get paid for writing code. 
            ! We get a bonus for each line avoided <g>
        END
    END
    EXIT


BTW: the userlist is a dropdown because we know our users to be lazy but its not always a good idea to have the users name pre-selected. 

Thats all.....