PowerBuilder Function Window Center gf_window_center
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | //Function Name : gf_window_center //Argument Name : aw_wnd, Arg Type : window, Pass By : ReadOnly //Return Type : (None) Int li_screenheight, li_screenwidth, li_x = 1, li_y = 1 environment lenv_obj If IsNull(aw_wnd) Or Not IsValid(aw_wnd) Then Return If GetEnvironment( lenv_obj ) = -1 Then Return li_screenheight = PixelsToUnits ( lenv_obj.ScreenHeight, YPixelsToUnits! ) li_screenwidth = PixelsToUnits ( lenv_obj.ScreenWidth, XPixelsToUnits! ) If Not li_screenheight > 0 Or Not li_screenwidth > 0 Then Return If li_screenwidth > aw_wnd.Width Then li_x = ( li_screenwidth / 2 ) - ( aw_wnd.Width / 2 ) End If If li_screenheight > aw_wnd.Height Then li_y = ( li_screenheight / 2 ) - ( aw_wnd.Height / 2 ) End If aw_wnd.Move( li_x, li_y ) Return |
Good Luck!