How to bring mdichild to foreground

Post Reply
User avatar
James Bott
Posts: 4654
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA
Contact:

How to bring mdichild to foreground

Post 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
User avatar
James Bott
Posts: 4654
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA
Contact:

Post by James Bott »

I found the answer:

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

James
Post Reply