Home » Developer & Programmer » Forms » custom logon screen...help!!!! ASAP!!
custom logon screen...help!!!! ASAP!! [message #81442] Tue, 18 February 2003 06:58 Go to next message
mary
Messages: 19
Registered: November 1999
Junior Member
Help! Rush!!

If you cut/paste the below (easy to do) you create a custom logon screen. However, if the connection fails, it still goes to the test page. Perhaps a quork with logon and/or form_success?

PLEASE HELP!

1. Create a new forms module and change only the following properties:
Name: LOGON
Title: LOGON (v4.5)

2. Modify only the following properties for WINDOW0
(v4.0, Create this window):
Name: LOGON_WINDOW
Width: 126
Height: 108
Title: Logon
Style: Dialog
Modal: TRUE
Fixed Size: TRUE
Iconifiable: FALSE
Inherit Menu: FALSE
Zoomable: FALSE

3. Create a new canvas (v4.0, Modify CANVAS0) and modify only the following
properties:
Name: LOGON_CANVAS
Window: LOGON_WINDOW
Width: 126
Height: 108

4. Modify only the following properties for LOGON_WINDOW:
View: LOGON_CANVAS

5. Create a new block and modify only the following properties:
Block Name: LOGON_BLOCK

6. Create three text items on canvas LOGON_CANVAS for block LOGON_BLOCK
with properties as follows:
Name: USERNAME
X Position: 12
Y Position: 8
Width: 102
Height: 18

Name: PASSWORD
X Position: 12
Y Position: 31
Width: 102
Height: 18
Secure: TRUE

Name: CONNECT
X Position: 12
Y Position: 54
Width: 102
Height: 18

7. Create two push buttons on canvas LOGON_CANVAS for block LOGON_BLOCK
with properties as follows:
Name: LOGON
X Position: 12
Y Position: 84
Width: 52
Height: 18
Label: Logon
Mouse Navigate: FALSE
Default Button: TRUE

Name: CANCEL
X Position: 72
Y Position: 84
Width: 52
Height: 18
Label: Cancel
Mouse Navigate: FALSE

8. create a form called test and have it connect to any database (simple).

9. Code the following program units:

PROCEDURE leave(status BOOLEAN DEFAULT TRUE) IS
BEGIN
IF status THEN
:global.logged_on := 'TRUE';
ELSE
:global.logged_on := 'FALSE';
END IF;
EXIT_FORM;
END;

PROCEDURE initialize_form IS
un VARCHAR2(30) := GET_APPLICATION_PROPERTY(USERNAME);
pw VARCHAR2(30) := GET_APPLICATION_PROPERTY(PASSWORD);
cs VARCHAR2(30) := GET_APPLICATION_PROPERTY(CONNECT_STRING);
BEGIN
DEFAULT_VALUE('3', 'global.logon_tries');
DEFAULT_VALUE(un, 'global.username');
DEFAULT_VALUE(pw, 'global.password');
DEFAULT_VALUE(cs, 'global.connect_string');
:logon_block.username := :global.username;
:logon_block.password := :global.password;
:logon_block.connect := :global.connect_string;
END;

FUNCTION connect_to RETURN BOOLEAN IS
BEGIN
IF :logon_block.username IS NULL THEN
BELL;
END IF;
LOGON(:logon_block.username,
:logon_block.password||'@'||:logon_block.connect, FALSE);
IF FORM_SUCCESS THEN
RETURN TRUE;
open_form('test.fmx');
ELSE
RETURN FALSE;
END IF;
END;

10. Code the following triggers:

On-Logon (Form Level)
LOGON(:logon_block.username,
:logon_block.password||'@'||:logon_block.connect,
FALSE);

When-New-Form-Instance (Form Level)
initialize_form;

When-Button-Pressed (Item Level, on LOGON_BLOCK.CANCEL)
leave(FALSE);

When-Button-Pressed (Item Level, on LOGON_BLOCK.LOGON)
BEGIN
IF connect_to THEN
leave(TRUE);
END IF;
:global.logon_tries := TO_NUMBER(:global.logon_tries) - 1;
IF TO_NUMBER(:global.logon_tries) = '0' THEN
leave(FALSE);
END IF;
END;

When-Window-Activated (Form Level)
DECLARE
screen_height NUMBER;
screen_width NUMBER;
window_height NUMBER;
window_width NUMBER;
BEGIN
IF :SYSTEM.EVENT_WINDOW = 'LOGON_WINDOW' THEN
screen_height := GET_APPLICATION_PROPERTY(DISPLAY_HEIGHT);
screen_width := GET_APPLICATION_PROPERTY(DISPLAY_WIDTH);
window_height := GET_WINDOW_PROPERTY(:SYSTEM.EVENT_WINDOW, HEIGHT);
window_width := GET_WINDOW_PROPERTY(:SYSTEM.EVENT_WINDOW, WIDTH);
SET_WINDOW_PROPERTY('LOGON_WINDOW', X_POS,
(screen_width - window_width)/2);
SET_WINDOW_PROPERTY('LOGON_WINDOW', Y_POS,
screen_height/2 - window_height);
END IF;
END;

11. Generate and save this form.

12. Create a new form. This form is an example of how to use the
logon form that has just been created.

13. Create a default block, giving this form some items.

14. Code the On-Logon trigger as follows:

On-Logon (Form Level)
CALL_FORM('logon', NO_HIDE);
IF :global.logged_on != 'TRUE' THEN
RAISE FORM_TRIGGER_FAILURE;
END IF;
Re: custom logon screen...help!!!! ASAP!! [message #81450 is a reply to message #81442] Wed, 19 February 2003 03:03 Go to previous messageGo to next message
magnetic
Messages: 324
Registered: January 2003
Senior Member
i think there is a misunderstanding of what you want to achieve.since the on-logon trigger is setup in th e test form, calling form is the active one.
you should exit the form after the loggin is false
So the code RAISE FORM_TRIGGER_FAILURE;
should be replaced with exit_form;
Re: custom logon screen...help!!!! ASAP!! [message #81453 is a reply to message #81450] Wed, 19 February 2003 04:38 Go to previous message
mary
Messages: 19
Registered: November 1999
Junior Member
Hey,

Thanks for your reply! However, when I change that peace to:

CALL_FORM('C:OracleOracleDSMyOracleFormsTESTlogon.FMX', NO_HIDE);
IF :global.logged_on != 'TRUE' THEN
exit_form;

END IF;

I still get the same error.

Mary
Previous Topic: Updating Date..
Next Topic: Form 9i is not working
Goto Forum:
  


Current Time: Fri Apr 19 08:46:37 CDT 2024