PROCEDURE SHOW_WINDOW_CENTERED ( win VARCHAR2 ) IS
win_id window;
win_x NUMBER;
win_y NUMBER;
win_w NUMBER;
win_h NUMBER;
display_w NUMBER;
display_h NUMBER;
height_offset NUMBER := 0;
BEGIN
IF Get_Application_Property(USER_INTERFACE)='MSWINDOWS' or
Get_Application_Property(USER_INTERFACE)='MSWINDOWS32'
THEN
height_offset := .5; -- inches;
END IF;
--
-- SHOW WINDOW CENTERED
--
-- This procedure will show a window centered
-- in the middle of the display.
--
win_id := FIND_WINDOW(win);
IF ID_NULL(win_id) THEN
RETURN;
END IF;
display_h := TO_NUMBER(GET_APPLICATION_PROPERTY(DISPLAY_HEIGHT));
display_w := TO_NUMBER(GET_APPLICATION_PROPERTY(DISPLAY_WIDTH));
win_x := GET_WINDOW_PROPERTY(win_id, X_POS);
win_y := GET_WINDOW_PROPERTY(win_id, Y_POS);
win_w := GET_WINDOW_PROPERTY(win_id, WIDTH);
win_h := GET_WINDOW_PROPERTY(win_id, HEIGHT);
IF ( win_w >= display_w ) THEN
win_x := 0;
ELSE
win_x := (display_w - win_w) / 2;
END IF;
IF ( win_h >= display_h ) THEN
win_y := 0;
ELSE
win_y := (display_h - height_offset - win_h) / 2;
END IF;
-- Set window's new position
SET_WINDOW_PROPERTY(win_id, X_POS, win_x);
SET_WINDOW_PROPERTY(win_id, Y_POS, win_y);
SHOW_WINDOW(win_id);
END;
win_id window;
win_x NUMBER;
win_y NUMBER;
win_w NUMBER;
win_h NUMBER;
display_w NUMBER;
display_h NUMBER;
height_offset NUMBER := 0;
BEGIN
IF Get_Application_Property(USER_INTERFACE)='MSWINDOWS' or
Get_Application_Property(USER_INTERFACE)='MSWINDOWS32'
THEN
height_offset := .5; -- inches;
END IF;
--
-- SHOW WINDOW CENTERED
--
-- This procedure will show a window centered
-- in the middle of the display.
--
win_id := FIND_WINDOW(win);
IF ID_NULL(win_id) THEN
RETURN;
END IF;
display_h := TO_NUMBER(GET_APPLICATION_PROPERTY(DISPLAY_HEIGHT));
display_w := TO_NUMBER(GET_APPLICATION_PROPERTY(DISPLAY_WIDTH));
win_x := GET_WINDOW_PROPERTY(win_id, X_POS);
win_y := GET_WINDOW_PROPERTY(win_id, Y_POS);
win_w := GET_WINDOW_PROPERTY(win_id, WIDTH);
win_h := GET_WINDOW_PROPERTY(win_id, HEIGHT);
IF ( win_w >= display_w ) THEN
win_x := 0;
ELSE
win_x := (display_w - win_w) / 2;
END IF;
IF ( win_h >= display_h ) THEN
win_y := 0;
ELSE
win_y := (display_h - height_offset - win_h) / 2;
END IF;
-- Set window's new position
SET_WINDOW_PROPERTY(win_id, X_POS, win_x);
SET_WINDOW_PROPERTY(win_id, Y_POS, win_y);
SHOW_WINDOW(win_id);
END;
Responses
0 Respones to "Oracle Forms - Window Centered"
Post a Comment
Comment