Using GET_APPLICATION_PROPERTY in Oracle D2k Forms

Description
Returns information about the current Form Builder application. You must call the built-in once for each
value you want to retrieve.
Usage Notes
To request a complete login, including an appended connect string, use the Username, Password, and
Connect_String properties. For instance, assume that the user has initiated an Microsoft Windows
Runform session specifying the following connect string:

ifrun60 my_form scott/tiger@corpDB1
Form Builder returns the following string as the result of a call to
GET_APPLICATION_PROPERTY(USERNAME):
scott
Form Builder returns the following string as the result of a call to
GET_APPLICATION_PROPERTY(PASSWORD):
tiger
Form Builder returns the following string as the result of a call to
GET_APPLICATION_PROPERTY(CONNECT_STRING):
corpDB1


GET_APPLICATION_PROPERTY examples
Example 1
/*
** Built-in: GET_APPLICATION_PROPERTY
** Example: Determine the name of the timer that just
** expired, and based on the username perform a
** task.
** trigger: When-Timer-Expired
*/
DECLARE
tm_name VARCHAR2(40);
BEGIN
tm_name := Get_Application_Property(TIMER_NAME);
IF tm_name = ’MY_ONCE_EVERY_FIVE_MINUTES_TIMER’ THEN
:control.onscreen_clock := SYSDATE;
ELSIF tm_name = ’MY_ONCE_PER_HOUR_TIMER’ THEN
Go_Block(’connected_users’);
Execute_Query;
END IF;
END;
Example 2
/*
** Built-in: GET_APPLICATION_PROPERTY
** Example: Capture the username and password of the
** currently logged-on user, for use in calling
** another Tool.
*/
PROCEDURE Get_Connect_Info( the_username IN OUT VARCHAR2,
the_password IN OUT VARCHAR2,
the_connect IN OUT VARCHAR2) IS
BEGIN
the_username := Get_Application_Property(USERNAME);
the_password := Get_Application_Property(PASSWORD);
the_connect := Get_Application_Property(CONNECT_STRING);
END;
Example 3
Making window0 in center of screen
DECLARE
    VWIDTH NUMBER := GET_APPLICATION_PROPERTY(DISPLAY_WIDTH);
    VHEIGHT NUMBER := GET_APPLICATION_PROPERTY(DISPLAY_HEIGHT);
    wwidth number := get_window_property('window0', width);
    wheight number := get_window_property('window0', height);
BEGIN    
    SET_WINDOW_PROPERTY(FORMS_MDI_WINDOW, WINDOW_STATE, MAXIMIZE);
    SET_WINDOW_PROPERTY('WINDOW0', x_pos, (vwidth - wwidth) / 2);
    SET_WINDOW_PROPERTY('WINDOW0', y_pos, (vheight - wheight-100) / 2 );
end;
原文地址:https://www.cnblogs.com/quanweiru/p/6220778.html