My parent window lost the focus

Windows specific forum
User avatar
Le Soldat Inconnu
Enthusiast
Enthusiast
Posts: 306
Joined: Wed Jul 09, 2003 11:33 am
Location: France

My parent window lost the focus

Post 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 :)
LSI
Karbon
PureBasic Expert
PureBasic Expert
Posts: 2010
Joined: Mon Jun 02, 2003 1:42 am
Location: Ashland, KY
Contact:

Post by Karbon »

I'm pretty sure you can only have one window with focus at a time... Someone correct me!
-Mitchell
Check out kBilling for all your billing software needs!
http://www.k-billing.com
Code Signing / Authenticode Certificates (Get rid of those Unknown Publisher warnings!)
http://codesigning.ksoftware.net
User avatar
Le Soldat Inconnu
Enthusiast
Enthusiast
Posts: 306
Joined: Wed Jul 09, 2003 11:33 am
Location: France

Post 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)
LSI
User avatar
fsw
Addict
Addict
Posts: 1603
Joined: Tue Apr 29, 2003 9:18 pm
Location: North by Northwest

Post by fsw »

Try the new 3v89 beta version, there is a excellent MDI-Gadget example...
You can find it here:
viewtopic.php?t=9910
User avatar
Le Soldat Inconnu
Enthusiast
Enthusiast
Posts: 306
Joined: Wed Jul 09, 2003 11:33 am
Location: France

Post by Le Soldat Inconnu »

Thanks
LSI
Post Reply