It is still flickering !
The child window "opens" with its original size then resizes causing flickering !
I will try something later ...
MDIGadget "real world" example
Try this for no flickering...
Code: Select all
Procedure JanelaHistoricos()
SendMessage_(WindowID(#Window_0), #WM_SETREDRAW,0,0)
AddGadgetItem(#MDIGadget,#Historicos,"Históricos",0,#PB_Window_Invisible|#PB_Window_MinimizeGadget|#PB_Window_BorderLess)
ResizeWindow(#Historicos,#PB_Ignore,#PB_Ignore,400,200)
SendMessage_(WindowID(#Window_0), #WM_SETREDRAW,1,0)
HideWindow(#Historicos,0)
EndProcedure
What goes around comes around.
PB 5.21 LTS (x86) - Windows 8.1
PB 5.21 LTS (x86) - Windows 8.1
- netmaestro
- PureBasic Bullfrog
- Posts: 8451
- Joined: Wed Jul 06, 2005 5:42 am
- Location: Fort Nelson, BC, Canada
I currently have several applications that use MDI and all of them use a custom size and position for the created childs. The method I show here is pretty much exactly how my programs do it:
Code: Select all
Global hook, childw, childh
Procedure CbtProc(nCode, wParam, lParam)
Select nCode
Case #HCBT_CREATEWND
hWnd = wParam
*pcbt.CBT_CREATEWND = lParam
*pcs.CREATESTRUCT = *pcbt\lpcs
*pcs\cx = childw
*pcs\cy = childh
EndSelect
ProcedureReturn CallNextHookEx_(hook, nCode, wParam, lParam)
EndProcedure
OpenWindow(0,0,0,800,600,"Flicker-free custom MDI windows",#PB_Window_MinimizeGadget|#PB_Window_MaximizeGadget|#PB_Window_SystemMenu)
CreateGadgetList(WindowID(0))
CreateMenu(0, WindowID(0))
MenuTitle("File")
MenuItem(0, "MDI Window that does something")
MenuItem(99, "Exit")
MenuTitle("Window")
MDIGadget(0,0,0,0,0,1,100,#PB_MDI_AutoSize)
quit=#False
Repeat
EventID = WaitWindowEvent()
Select EventID
Case #PB_Event_Menu
Select EventMenu()
Case 0
If Not IsWindow(1)
childw = 512
childh = 512
hook = SetWindowsHookEx_(#WH_CBT, @CbtProc(), #Null, GetCurrentThreadId_())
AddGadgetItem(0,1,"Custom Sized MDI Child")
UnhookWindowsHookEx_(hook)
Else
SetActiveWindow(1)
EndIf
Case 99
quit=#True
EndSelect
Case #PB_Event_CloseWindow
Select EventWindow()
Case 0
quit=#True
Default
CloseWindow(EventWindow())
EndSelect
EndSelect
Until quit
BERESHEIT
Netmaestro your code is greate !
I added another menu item and checked that this is not working
and changed with this
and is working pretty well
thanks
I added another menu item and checked that this is not working
Code: Select all
SetActiveWindow(1)
Code: Select all
SetGadgetState(0,1)
thanks