Page 1 of 1

My parent window lost the focus

Posted: Wed Mar 17, 2004 5:06 pm
by Le Soldat Inconnu
Hello,

I have a problem with my parent window.
It lost the focus when i use the child window.

Code: Select all

WindowE = GetForegroundWindow_() 

OpenWindow(0, 200, 200, 500, 500, #PB_Window_SystemMenu | #PB_Window_MinimizeGadget | #PB_Window_MaximizeGadget | #PB_Window_SizeGadget | #WS_CLIPCHILDREN, "Options") 

SetParent_(WindowE, WindowID()) 
SetWindowLong_(WindowE, #GWL_EXSTYLE, GetWindowLong_(WindowE, #GWL_EXSTYLE) | #WS_EX_MDICHILD) 
; SetWindowLong_(WindowE, #GWL_STYLE, GetWindowLong_(WindowE, #GWL_STYLE) | #WS_CHILD) 


MoveWindow_(WindowE, 0, 0, 400, 400, 1) 

Repeat 
  Event = WaitWindowEvent() 
  
Until Event = #WM_CLOSE 

; SetWindowLong_(WindowE, #GWL_STYLE, GetWindowLong_(WindowE, #GWL_STYLE) ! #WS_CHILD) 
SetWindowLong_(WindowE, #GWL_EXSTYLE, GetWindowLong_(WindowE, #GWL_EXSTYLE) ! #WS_EX_MDICHILD) 
SetParent_(WindowE, 0)
I hope to make parent window which keep focus when i use child window. :wink:

Thanks for your help. And excuse me for mistakes :)

Posted: Wed Mar 17, 2004 7:19 pm
by Karbon
I'm pretty sure you can only have one window with focus at a time... Someone correct me!

Posted: Fri Mar 19, 2004 8:27 am
by Le Soldat Inconnu
For MDI application, 2 windows have the focus. but I seen in MDI prgram, we have a MDI area created. How can i make this MDI area ?
I seen this in "MyMDI.pb", it's an exemple of TailBite.

I find this : my parent window keep the focus but I have problem with refresh and menu

Code: Select all

WindowE = GetForegroundWindow_() 

OpenWindow(0, 200, 200, 500, 500, #PB_Window_SystemMenu | #PB_Window_MinimizeGadget | #PB_Window_MaximizeGadget | #PB_Window_SizeGadget | #WS_CLIPCHILDREN, "Options") 

SetParent_(WindowE, WindowID()) 
SetWindowLong_(WindowE, #GWL_EXSTYLE, GetWindowLong_(WindowE, #GWL_EXSTYLE) | #WS_EX_MDICHILD) 
SetWindowLong_(WindowE, #GWL_STYLE, GetWindowLong_(WindowE, #GWL_STYLE) | #WS_CHILD) 


MoveWindow_(WindowE, 0, 0, 400, 400, 1) 

Repeat 
  Event = WaitWindowEvent() 
  
Until Event = #WM_CLOSE 

SetWindowLong_(WindowE, #GWL_STYLE, GetWindowLong_(WindowE, #GWL_STYLE) ! #WS_CHILD) 
SetWindowLong_(WindowE, #GWL_EXSTYLE, GetWindowLong_(WindowE, #GWL_EXSTYLE) ! #WS_EX_MDICHILD) 
SetParent_(WindowE, 0)

Posted: Fri Mar 19, 2004 7:00 pm
by fsw
Try the new 3v89 beta version, there is a excellent MDI-Gadget example...
You can find it here:
viewtopic.php?t=9910

Posted: Mon Mar 22, 2004 6:29 pm
by Le Soldat Inconnu
Thanks