Saturday, January 8, 2022

How to Oracle Forms Windows Center in 6i,10G, 11G, 12C

 

How to Oracle Forms Windows Center in 6i,10G, 11G, 12C

Step 1:

To begin, go to "Program unit" and create a procedure called "SHOW WINDOW CENTERED."

How to Oracle Forms Windows Center in 6i,10G, 11G, 12C

Step 2:

The second step is to copy and paste all of the code. It is mentioned in the next section.

How to Oracle Forms Windows Center in 6i,10G, 11G, 12C

  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.

How to Oracle Forms Windows Center in 6i,10G, 11G, 12C

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

 

How to Oracle Forms Windows Center in 6i,10G, 11G, 12C

set_window_property(FORMS_MDI_WINDOW,TITLE,'WINDOW CENTER');

SHOW_WINDOW_CENTERED('WINDOW1');

 OUTPUT:

How to Oracle Forms Windows Center in 6i,10G, 11G, 12C

I hope it's helpful for you. If you have any queries, don't hesitate to contact me.

Name : Muhammad Sahal Qasim
E-mail : s.m.sahal789@gmail.com
Thank you.

0 comments:

Post a Comment

If you have any doubts, please let me know. I will help you.