Home » Developer & Programmer » Forms » How to Aling a Window
How to Aling a Window Sat, 08 March 2008 05:15
 *munnabhai* Messages: 157Registered: March 2008 Location: Riyadh Senior Member
Hi All,

Can anyone tell me how to align a Window @ Centre during runtime?

Regards

To Aling A Window [message #305145 is a reply to message #305086] Sun, 09 March 2008 04:22
 aliarshad77 Messages: 3Registered: March 2008 Location: Kingdom Of Saudi Arabia Junior Member
To Align Window At Center Of The Screen

Take Width and Height Of Your Canvas From Canvas Property
Go To Window Property
Set Same Width And Height (Means Canvas & Window Same Height-Width)

Now Calculate From Calculator
580 - Window_Width / 2
324 - Window_Height / 2
For Example :-
Windows Width=367 & Height=232

Then Calculate From Calulator
580-367/2 Result Width =86.5
324-232/2 Result Height=46

Now Set 86 (86.5) On X Position Of Window
And Set 46 On Y Position Of Window
Close Property & Run Your Form

All The Best.....

Re: How to Aling a Window [message #318807 is a reply to message #305086] Thu, 08 May 2008 01:11
 *munnabhai* Messages: 157Registered: March 2008 Location: Riyadh Senior Member
Dear Martin,

with this we have to give manually for all modules....i need a synchronise trigger what ever the resolution the form should be in center.

Regards

Re: How to Aling a Window [message #318813 is a reply to message #318807] Thu, 08 May 2008 01:24
 djmartin Messages: 10180Registered: March 2005 Location: Surges Bay TAS Australia Senior MemberAccount Moderator
Use the webutil or d2kwutil to get the screen sizes and then do the mathematics in a PLL library routine which is called by the When-New-Form-Instance trigger.

David
Re: How to Aling a Window [message #318816 is a reply to message #305086] Thu, 08 May 2008 01:33
 *munnabhai* Messages: 157Registered: March 2008 Location: Riyadh Senior Member
try the below code

PROCEDURE center_form (winid varchar2 ) IS
w number;
h number;
md_w number;
md_h number;
BEGIN
SET_WINDOW_PROPERTY(FORMS_MDI_WINDOW, WINDOW_STATE ,MAXIMIZE);
SET_WINDOW_PROPERTY(FORMS_MDI_WINDOW,TITLE,'XYZ');
md_w :=get_window_property(forms_mdi_window,width)-5;
md_h :=get_window_property(forms_mdi_window,height)-20;
w :=get_window_property(winid,width);
h :=get_window_property(winid,height);
set_window_property(winid,x_pos,(md_w-w)/2);
set_window_property(winid,y_pos,(md_h-h)/2);
END;

call the above procedure in When-New-Form-Instance trigger
sure 100% will work what ever the resulution of the screen the form will be @ the centre of the screen.

Waiting for replies...

Regards

Re: How to Aling a Window [message #419659 is a reply to message #318816] Mon, 24 August 2009 22:17
 sharjeelshafqat Messages: 33Registered: August 2009 Location: Pakistan Member
Use this syntax to set window in center or any place on screen where you wants

Just write your own windows name and replace with "WINDOW1".

_________________________________________________________

declare
v_w number;
v_h number;
BEGIN
v_w:=get_application_property(display_width);
v_h:=get_application_property(display_height);
set_window_property('WINDOW1',x_pos,v_w/3.5);
set_window_property('WINDOW1',y_pos,v_h/5);
END;

thanks
Sharjeel
Sr. Oracle Programmer
Sialkot, Pakistan
 Previous Topic: provide webutility Next Topic: Help on Logon
Goto Forum:

Current Time: Sat Aug 19 10:09:31 CDT 2017

Total time taken to generate the page: 0.08162 seconds