New topic: 

Window - Bring To Front

<http://forums.realsoftware.com/viewtopic.php?t=45290>

         Page 1 of 1
   [ 1 post ]                 Previous topic | Next topic          Author  
Message        sinner          Post subject: Window - Bring To FrontPosted: Sat 
Sep 08, 2012 7:42 am                                 
Joined: Sat May 27, 2006 3:27 pm
Posts: 458                hello
Here is lil code from WFS to make your window stay on top of other windows 
centered !

hope this helps

1. I your App make a method Called BringToCenter

Sub BringToCenter( w as Window, assigns set as Boolean )
  #if TargetWin32
  Const SWP_NOSIZE = &H1
  Const SWP_NOMOVE = &H2
  Const HWND_TOPMOST = -1
  Const HWND_NOTOPMOST = -2
  
  Declare Function SetWindowPos Lib "user32" (hwnd as Integer, hWndInstertAfter 
as Integer, _
  x as Integer, y as Integer, cx as Integer, cy as Integer, flags as Integer) 
as Integer
  
  dim after as Integer
  if set then
  after = HWND_TOPMOST
  else
  after = HWND_NOTOPMOST
  end
  Call SetWindowPos( w.handle, after, 0, 0, 0, 0, SWP_NOMOVE + SWP_NOSIZE
  
  w.Left=(Screen(0).AvailableWidth -w.Width)/2
  w.Top=(Screen(0).AvailableHeight -w.Height)/2
  #endif


2. Call it like this in windows open event

App.BringTOCenter( Self ) = True   
                             Top             Display posts from previous: All 
posts1 day7 days2 weeks1 month3 months6 months1 year Sort by AuthorPost 
timeSubject AscendingDescending          Page 1 of 1
   [ 1 post ]      
-- 
Over 1500 classes with 29000 functions in one REALbasic plug-in collection. 
The Monkeybread Software Realbasic Plugin v9.3. 
http://www.monkeybreadsoftware.de/realbasic/plugins.shtml

[email protected]

Reply via email to