adamski Posted September 18, 2009 Share Posted September 18, 2009 (edited) Hello, I am trying to create a simple Tabbed Document Interface for the various windows of an irritating application. I have the basics working (using demo apps) but can't figure out how to force an application to redraw when switching tabs. Can anybody help in this area? I am open to any alternative solutions too. Thanks expandcollapse popup; Example of APPLICATIONS in TAB ctrl by aec and adamski #include <GUIConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <WinAPI.au3> Run("notepad") Run("explorer") Global $main_GUI,$ok_button,$cancel_button ;This window has 2 ok/cancel-buttons $main_GUI = GUICreate("APPLICATIONS in TAB",800,600,-1,-1, BitOr($WS_POPUP, $GUI_SS_DEFAULT_GUI,$WS_CLIPCHILDREN,$WS_SIZEBOX)) $ok_button = GUICtrlCreateButton("OK",40,560,70,20) $cancel_button = GUICtrlCreateButton("Cancel",150,560,70,20) ; Create the first child window that is implemented into the main GUI $child1 = GUICreate("",770,500,15,35,BitOr($WS_CHILD,$WS_TABSTOP),-1,$main_GUI) GUISetState() ; Create the second child window that is implemented into the main GUI $child2 = GUICreate("",770,500,15,35,BitOr($WS_CHILD,$WS_TABSTOP),-1,$main_GUI) ; Switch back the main GUI and create the tabs GUISwitch($main_GUI) $main_tab = GUICtrlCreateTab(10,10,780,532) $child1tab = GUICtrlCreateTabItem("Child1") $child2tab = GUICtrlCreateTabItem("Child2") GUICtrlCreateTabItem("") ; Set Application 1 to Child GUI 1 WinWaitActive("[CLASS:Notepad]") $Notepad = WinGetHandle("[CLASS:Notepad]") _SetParent($Notepad, $child1) WinSetState($Notepad, "", @SW_MAXIMIZE) ; Set Application 2 to Child GUI 2 WinWaitActive("My Documents") $Explorer = WinGetHandle("My Documents") _SetParent($Explorer, $child2) WinSetState($Explorer, "", @SW_MAXIMIZE) GUISetState() While 1 $msg = GUIGetMsg(1) Switch $msg[0] Case $GUI_EVENT_CLOSE, $cancel_button ExitLoop Case $main_tab Switch GUICtrlRead($main_tab) Case 0 GUISetState(@SW_HIDE,$child2) GUISetState(@SW_SHOW,$child1) Case 1 GUISetState(@SW_HIDE,$child1) GUISetState(@SW_SHOW,$child2) EndSwitch _WinAPI_RedrawWindow($main_GUI, 0, 0, $RDW_ALLCHILDREN) ; force redraw of GUI EndSwitch WEnd Func _SetParent($id_child, $h_parent) If Not IsHWnd($h_parent) Then $h_parent = HWnd($h_parent) If Not IsHWnd($id_child) Then $id_child = GUICtrlGetHandle($id_child) If DllCall("user32.dll", "hwnd", "SetParent", "hwnd", $id_child, "hwnd", $h_parent) <> 0 Then Return 1 Else seterror(1) Return 0 EndIf EndFunc Edited September 20, 2009 by adamski Link to comment Share on other sites More sharing options...
Yashied Posted September 18, 2009 Share Posted September 18, 2009 ... GUISetState() _WinAPI_RedrawWindow($child1, 0, 0, $RDW_INVALIDATE) While 1 ... My UDFs: iKey | FTP Uploader | Battery Checker | Boot Manager | Font Viewer | UDF Keyword Manager | Run Dialog Replacement | USBProtect | 3D Axis | Calculator | Sleep | iSwitcher | TM | NetHelper | File Types Manager | Control Viewer | SynFolders | DLL Helper Animated Tray Icons UDF Library | Hotkeys UDF Library | Hotkeys Input Control UDF Library | Caret Shape UDF Library | Context Help UDF Library | Most Recently Used List UDF Library | Icons UDF Library | FTP UDF Library | Script Communications UDF Library | Color Chooser UDF Library | Color Picker Control UDF Library | IPHelper (Vista/7) UDF Library | WinAPI Extended UDF Library | WinAPIVhd UDF Library | Icon Chooser UDF Library | Copy UDF Library | Restart UDF Library | Event Log UDF Library | NotifyBox UDF Library | Pop-up Windows UDF Library | TVExplorer UDF Library | GuiHotKey UDF Library | GuiSysLink UDF Library | Package UDF Library | Skin UDF Library | AITray UDF Library | RDC UDF Library Appropriate path | Button text color | Gaussian random numbers | Header's styles (Vista/7) | ICON resource enumeration | Menu & INI | Tabbed string size | Tab's skin | Pop-up circular menu | Progress Bar without animation (Vista/7) | Registry export | Registry path jumping | Unique hardware ID | Windows alignment More... Link to comment Share on other sites More sharing options...
adamski Posted September 18, 2009 Author Share Posted September 18, 2009 (edited) Thanks Yashied, but it still sometimes needs redrawing when switching back and forth between the tabs. Sometimes the tab is just gray until moseovered. Think I may have some of the widow states wrong. Edit: Think I've found the problem - just a focus issue Cheers Edited September 19, 2009 by adamski Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now