FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour How to bring mdichild to foreground
Posts: 4840
Joined: Fri Nov 18, 2005 04:52 PM
How to bring mdichild to foreground
Posted: Tue Oct 24, 2006 10:49 PM
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

#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
FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
Posts: 4840
Joined: Fri Nov 18, 2005 04:52 PM
How to bring mdichild to foreground
Posted: Tue Oct 24, 2006 11:07 PM

I found the answer:

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

James

FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10

Continue the discussion