Step 1:
To begin, go to "Program unit"
and create a procedure called "SHOW WINDOW CENTERED."
Step 2:
The second step is to copy and paste all of the
code. It is mentioned in the next section.
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-50);
SHOW_WINDOW(win_id);
END;
Step 3:
Create the "WHEN-NEW-FORM-INSTANCE"
trigger at the Form level.
Step 4:
The four step is to copy and paste all of the code. It is mentioned in the next section.
· Change the window title is the first line in this code.
· Second line of this code call that procedure I created and pass the window name in my case the window name is “WINDOW1”
set_window_property(FORMS_MDI_WINDOW,TITLE,'WINDOW CENTER');
SHOW_WINDOW_CENTERED('WINDOW1');
OUTPUT:
I hope it's helpful for you. If you have any queries, don't hesitate to contact me.
0 comments:
Post a Comment
If you have any doubts, please let me know. I will help you.