Page 1 of 1

How to bring mdichild to foreground

Posted: Tue Oct 24, 2006 10:49 pm
by James Bott
Doews anyone have any idea how to bring a mdichild window to the foreground (make it active)? I have tried setForegroundWindow(), setFocus(), and setActiveWindow() and none seem to work.

In the following example, pressing any of the buttons should bring the clients window to the foreground--at least it appears that it should from the documentation. I must be doing something wrong.

Oh, I also tried showWindow() and that didn't work either.

James

Code: Select all

#include "fivewin.ch"

function main()
   local oWnd, oBar

   define window oWnd MDI

   define buttonbar oBar of oWnd

   define button of oBar ;
      action setForegroundWindow( oWnd:oWndClient:aWnd[1]:hWnd )
   define button of oBar ;
      action setFocus( oWnd:oWndClient:aWnd[1]:hWnd )
   define button of oBar ;
      action setActiveWindow( oWnd:oWndClient:aWnd[1]:hWnd )

   activate window oWnd on init (clients(), matters() )

return nil

function clients()
   local oWnd
   define window oWnd title "Clients" mdichild of wndMain()
   activate window oWnd
return nil

function matters()
   local oWnd
   define window oWnd title "Matters" mdichild of wndMain()
   activate window oWnd
return nil

Posted: Tue Oct 24, 2006 11:07 pm
by James Bott
I found the answer:

wndMain():oWndClient:aWnd[1]:setFocus()

James