nicdev007 Posted February 26, 2018 Share Posted February 26, 2018 Hello All, Hope you are doing well? I have a small issue with a GUI not redrawing properly, after I click a button to open a windows folder location. For simplicity I have made an example to explain (to avoid posting all my code). I have searched a lot of posts on redrawing the GUI but have not been able to resolve this, and I'm sure i'm forgetting something silly. The code creates a simple 3 tab GUI, with a button and Input box on Tab 1. The button opens a folder location (in this case C:\Windows\). The problem: Once the folder opens, the input box "loses" its box (if that makes sense)-> See the image attached. Your help is greatly appreciated as always Best regards Nicdev expandcollapse popup#include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <TabConstants.au3> #include <WindowsConstants.au3> #include <AutoItConstants.au3> #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("Tabbed Notebook Dialog", 419, 311, 299, 218) $PageControl1 = GUICtrlCreateTab(8, 8, 396, 256) $TabSheet1 = GUICtrlCreateTabItem("TabSheet1") $Button4 = GUICtrlCreateButton("Open", 40, 56, 65, 33) GUICtrlSetFont(-1, 8, 400, 0, "Arial") $Input1 = GUICtrlCreateInput("Input1", 256, 56, 97, 22) GUICtrlSetFont(-1, 8, 400, 0, "Arial") $Label1 = GUICtrlCreateLabel("Label1", 208, 56, 36, 18) GUICtrlSetFont(-1, 8, 400, 0, "Arial") $TabSheet2 = GUICtrlCreateTabItem("TabSheet2") $Button5 = GUICtrlCreateButton("Button5", 168, 88, 57, 33) GUICtrlSetFont(-1, 8, 400, 0, "Arial") $TabSheet3 = GUICtrlCreateTabItem("TabSheet3") $Button6 = GUICtrlCreateButton("Button6", 256, 64, 73, 33) GUICtrlSetFont(-1, 8, 400, 0, "Arial") GUICtrlCreateTabItem("") $Button1 = GUICtrlCreateButton("&OK", 166, 272, 75, 25) $Button2 = GUICtrlCreateButton("&Cancel", 246, 272, 75, 25) $Button3 = GUICtrlCreateButton("&Help", 328, 272, 75, 25) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Button4 ShellExecute("C:\Windows\","","",$SHEX_OPEN) EndSwitch WEnd Life is too short to worry about the things you don't have or cannot do ... So if you don't know how to do it - Learn it! Don't be afraid to ask for help ... Link to comment Share on other sites More sharing options...
KickStarter15 Posted February 27, 2018 Share Posted February 27, 2018 (edited) 18 hours ago, nicdev007 said: The problem: Once the folder opens, the input box "loses" its box (if that makes sense)-> See the image attached. First look at your code, there is no problem with it. I also tried you code to see if true but as you can see, there is no issue found. How about adding border in your inputbox to show it clearly, maybe it's the contrast of your GUI that makes it loses. Edited February 27, 2018 by KickStarter15 Programming is "To make it so simple that there are obviously no deficiencies" or "To make it so complicated that there are no obvious deficiencies" by C.A.R. Hoare. Link to comment Share on other sites More sharing options...
nicdev007 Posted March 1, 2018 Author Share Posted March 1, 2018 Hello KickStarter15, Thanks for your feedback and test. Strange thing is I tested again and have the same results as I had before. Even with the box around the inputbox. The one parameter to be sure of is that the folder must not already be open before you click the button (meaning make sure all explorer windows are closed when doing the test). Test start: Click on the button (Folder opens) and the Input box loses it's frame... Moving my mouse pointer over the Input bow makes it re-appear! Any ideas or comments greatly appreciated! For information I have tested it on a Win7 and Win 10 machine and the results are the same. BNR Nicdev Life is too short to worry about the things you don't have or cannot do ... So if you don't know how to do it - Learn it! Don't be afraid to ask for help ... Link to comment Share on other sites More sharing options...
KickStarter15 Posted March 2, 2018 Share Posted March 2, 2018 How about this: expandcollapse popup#include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <TabConstants.au3> #include <WindowsConstants.au3> #include <AutoItConstants.au3> #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("Tabbed Notebook Dialog", 419, 311, 299, 218) $PageControl1 = GUICtrlCreateTab(8, 8, 396, 256) $TabSheet1 = GUICtrlCreateTabItem("TabSheet1") $Button4 = GUICtrlCreateButton("Open", 40, 56, 65, 33) GUICtrlSetFont(-1, 8, 400, 0, "Arial") $Input1 = GUICtrlCreateInput("Input1", 256, 56, 97, 22, 0, -1) GUICtrlSetFont(-1, 8, 400, 0, "Arial") $Label1 = GUICtrlCreateLabel("Label1", 208, 56, 36, 18) GUICtrlSetFont(-1, 8, 400, 0, "Arial") $TabSheet2 = GUICtrlCreateTabItem("TabSheet2") $Button5 = GUICtrlCreateButton("Button5", 168, 88, 57, 33) GUICtrlSetFont(-1, 8, 400, 0, "Arial") $TabSheet3 = GUICtrlCreateTabItem("TabSheet3") $Button6 = GUICtrlCreateButton("Button6", 256, 64, 73, 33) GUICtrlSetFont(-1, 8, 400, 0, "Arial") GUICtrlCreateTabItem("") $Button1 = GUICtrlCreateButton("&OK", 166, 272, 75, 25) $Button2 = GUICtrlCreateButton("&Cancel", 246, 272, 75, 25) $Button3 = GUICtrlCreateButton("&Help", 328, 272, 75, 25) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Button4 ShellExecute("C:\Windows\","","",$SHEX_OPEN) Case $Button2 Exit EndSwitch WEnd Adding extended style for your input box to declare it's visibility. Not sure if that works. Programming is "To make it so simple that there are obviously no deficiencies" or "To make it so complicated that there are no obvious deficiencies" by C.A.R. Hoare. Link to comment Share on other sites More sharing options...
nicdev007 Posted March 2, 2018 Author Share Posted March 2, 2018 Thanks for the try but still the same ... Strangely when I remove the tabs (having just a normal GUI without tabs) it solves the problem (see code below). It looks like ShellExecute takes the focus away from the GUI tab, and does not redraw it correctly afterwards, but maybe I'm wrong. Any ideas? I'm completely lost here, and not for a lack of trying :-( expandcollapse popup#include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <TabConstants.au3> #include <WindowsConstants.au3> #include <AutoItConstants.au3> #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("Tabbed Notebook Dialog", 419, 311, 299, 218) ;$PageControl1 = GUICtrlCreateTab(8, 8, 396, 256) ;$TabSheet1 = GUICtrlCreateTabItem("TabSheet1") $Button4 = GUICtrlCreateButton("Open", 40, 56, 65, 33) GUICtrlSetFont(-1, 8, 400, 0, "Arial") $Input1 = GUICtrlCreateInput("Input1", 256, 56, 97, 22) GUICtrlSetFont(-1, 8, 400, 0, "Arial") GUICtrlSetStyle(-1, $WS_BORDER) $Label1 = GUICtrlCreateLabel("Label1", 208, 56, 36, 18) GUICtrlSetFont(-1, 8, 400, 0, "Arial") ;$TabSheet2 = GUICtrlCreateTabItem("TabSheet2") ;$Button5 = GUICtrlCreateButton("Button5", 168, 88, 57, 33) ;GUICtrlSetFont(-1, 8, 400, 0, "Arial") ;$TabSheet3 = GUICtrlCreateTabItem("TabSheet3") ;$Button6 = GUICtrlCreateButton("Button6", 256, 64, 73, 33) ;GUICtrlSetFont(-1, 8, 400, 0, "Arial") ;GUICtrlCreateTabItem("") $Button1 = GUICtrlCreateButton("&OK", 166, 272, 75, 25) $Button2 = GUICtrlCreateButton("&Cancel", 246, 272, 75, 25) $Button3 = GUICtrlCreateButton("&Help", 328, 272, 75, 25) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Button4 ShellExecute("C:\Windows\","","",$SHEX_OPEN) EndSwitch WEnd Life is too short to worry about the things you don't have or cannot do ... So if you don't know how to do it - Learn it! Don't be afraid to ask for help ... Link to comment Share on other sites More sharing options...
KickStarter15 Posted March 3, 2018 Share Posted March 3, 2018 20 hours ago, nicdev007 said: Strangely when I remove the tabs (having just a normal GUI without tabs) it solves the problem (see code below). It looks like ShellExecute takes the focus away from the GUI tab, and does not redraw it correctly afterwards, but maybe I'm wrong. Since there is no issue in my testing with your code. Why not try my below suggestion if it works. Case $Button4 $FolderPath = "C:\Windows\" Run("explorer.exe " & $FolderPath) Replace ShellExecute() with Run() function. Programming is "To make it so simple that there are obviously no deficiencies" or "To make it so complicated that there are no obvious deficiencies" by C.A.R. Hoare. Link to comment Share on other sites More sharing options...
Bilgus Posted March 3, 2018 Share Posted March 3, 2018 I too cannot reproduce your problem What if you force it to have a border? $Input1 = GUICtrlCreateInput("Input1", 256, 56, 97, 22,-1, 0x00000300);$WS_EX_OVERLAPPEDWINDOW Link to comment Share on other sites More sharing options...
nicdev007 Posted March 5, 2018 Author Share Posted March 5, 2018 Hi ther KickStarter15 and Bilgus, I tried both your suggestions, but it is still the same for me. Really strange you do not have the same on your side .... Just to show you what happens, here is a screencapture video. By elimination I downloaded again the latest Autoit from the website to be sure it is not an issue with the compiler, but after all I tried it is still the same. Any other suggestions? Keep in mind it is only when I have a GUI with tabs 5.avi Life is too short to worry about the things you don't have or cannot do ... So if you don't know how to do it - Learn it! Don't be afraid to ask for help ... Link to comment Share on other sites More sharing options...
Bilgus Posted March 5, 2018 Share Posted March 5, 2018 Ok so its clearly something weird with your PC what if you force a redraw? expandcollapse popup#include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <TabConstants.au3> #include <WindowsConstants.au3> #include <AutoItConstants.au3> #include <WinAPI.au3> #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("Tabbed Notebook Dialog", 419, 311, 299, 218) ;$PageControl1 = GUICtrlCreateTab(8, 8, 396, 256) ;$TabSheet1 = GUICtrlCreateTabItem("TabSheet1") $Button4 = GUICtrlCreateButton("Open", 40, 56, 65, 33) GUICtrlSetFont(-1, 8, 400, 0, "Arial") $Input1 = GUICtrlCreateInput("Input1", 256, 56, 97, 22) GUICtrlSetFont(-1, 8, 400, 0, "Arial") GUICtrlSetStyle(-1, $WS_BORDER) $Label1 = GUICtrlCreateLabel("Label1", 208, 56, 36, 18) GUICtrlSetFont(-1, 8, 400, 0, "Arial") ;$TabSheet2 = GUICtrlCreateTabItem("TabSheet2") ;$Button5 = GUICtrlCreateButton("Button5", 168, 88, 57, 33) ;GUICtrlSetFont(-1, 8, 400, 0, "Arial") ;$TabSheet3 = GUICtrlCreateTabItem("TabSheet3") ;$Button6 = GUICtrlCreateButton("Button6", 256, 64, 73, 33) ;GUICtrlSetFont(-1, 8, 400, 0, "Arial") ;GUICtrlCreateTabItem("") $Button1 = GUICtrlCreateButton("&OK", 166, 272, 75, 25) $Button2 = GUICtrlCreateButton("&Cancel", 246, 272, 75, 25) $Button3 = GUICtrlCreateButton("&Help", 328, 272, 75, 25) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Button4 ShellExecute("C:\Windows\","","",$SHEX_OPEN) _WinAPI_RedrawWindow(GUICtrlGetHandle($Input1), BitOr($RDW_INVALIDATE, $RDW_UPDATENOW)); ;OR this one ;_WinAPI_RedrawWindow($Form1, $RDW_UPDATENOW) ;Or ;_WinAPI_RedrawWindow($Form1, BitOr($RDW_INVALIDATE, $RDW_UPDATENOW)) EndSwitch WEnd Link to comment Share on other sites More sharing options...
Bilgus Posted March 5, 2018 Share Posted March 5, 2018 Might try this one as well.. _WinAPI_RedrawWindow(GUICtrlGetHandle($TabSheet1), BitOr($RDW_INVALIDATE, $RDW_UPDATENOW)); Link to comment Share on other sites More sharing options...
nicdev007 Posted March 5, 2018 Author Share Posted March 5, 2018 Hi Bilgus, Thanks for the insight, but to no avail. In the meantime I have learnt a lot about Tabcontrol handles, but nothing redraws that frame around the Input box. Here is the last code for information if someone else wants to try. I added some Console writes to show the return of _WinAPI_RedrawWindow to see if it fails. For info the Tabitem does not return a handle with GetHandle as suggested in the helpfile. That said even with the right handle it does not redraw the lost inputbox. expandcollapse popup#include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <TabConstants.au3> #include <WindowsConstants.au3> #include <AutoItConstants.au3> #include <WinAPI.au3> #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("Tabbed Notebook Dialog", 419, 311, 299, 218) $PageControl1 = GUICtrlCreateTab(8, 8, 396, 256) $TabSheet1 = GUICtrlCreateTabItem("TabSheet1") $Button4 = GUICtrlCreateButton("Open", 40, 56, 65, 33) GUICtrlSetFont(-1, 8, 400, 0, "Arial") $Input1 = GUICtrlCreateInput("Input1", 256, 56, 50, 22, -1, 0x00000300);$WS_EX_OVERLAPPEDWINDOW) GUICtrlSetFont(-1, 8, 400, 0, "Arial") $Label1 = GUICtrlCreateLabel("Label1", 208, 56, 36, 18) GUICtrlSetFont(-1, 8, 400, 0, "Arial") $TabSheet2 = GUICtrlCreateTabItem("TabSheet2") $Button5 = GUICtrlCreateButton("Button5", 168, 88, 57, 33) GUICtrlSetFont(-1, 8, 400, 0, "Arial") $TabSheet3 = GUICtrlCreateTabItem("TabSheet3") $Button6 = GUICtrlCreateButton("Button6", 256, 64, 73, 33) GUICtrlSetFont(-1, 8, 400, 0, "Arial") GUICtrlCreateTabItem("") $Button1 = GUICtrlCreateButton("&OK", 166, 272, 75, 25) $Button2 = GUICtrlCreateButton("&Cancel", 246, 272, 75, 25) $Button3 = GUICtrlCreateButton("&Help", 328, 272, 75, 25) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### ;~ ConsoleWrite("Handle form (" & $Form1 & ")" & @CRLF) ;~ ConsoleWrite("Handle Tab (" & GUICtrlGetHandle($PageControl1) & ")" & @CRLF) ;~ ConsoleWrite("Handle TabItem (" & GUICtrlGetHandle($TabSheet1) & ")" & @CRLF) ;~ ConsoleWrite("Handle Input (" & GUICtrlGetHandle($Input1) & ")" & @CRLF) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Button4 $FolderPath = "C:\Windows" ShellExecute($FolderPath,"","",$SHEX_OPEN) ;$iHandle = GUICtrlGetHandle($Input1) ;$bRedraw = _WinAPI_RedrawWindow($iHandle,0,0, BitOr($RDW_INVALIDATE, $RDW_UPDATENOW)); ;OR this one ;$iHandle = $Form1 ;$bRedraw = _WinAPI_RedrawWindow($iHandle,0,0, $RDW_UPDATENOW) ;Or ;$iHandle = $Form1 ;$bRedraw = _WinAPI_RedrawWindow($iHandle,0,0, BitOr($RDW_INVALIDATE, $RDW_UPDATENOW)) ;Or ;Get handle to TAB control $iHandle = ControlGetHandle($Form1, "", "SysTabControl321") $bRedraw = _WinAPI_RedrawWindow($iHandle,0,0, BitOr($RDW_INVALIDATE, $RDW_UPDATENOW)); ;$bRedraw = _WinAPI_RedrawWindow($iHandle,0,0, BitOr($RDW_INTERNALPAINT,$RDW_ALLCHILDREN)); ConsoleWrite("Redraw return value:-" & $bRedraw & " for Handle (" & $iHandle & ")" & @CRLF) EndSwitch WEnd Open to any suggestions... On my home PC i'm running Windows 7 family premium edition, and on my work PC Win 7 enterprise, both behave the same way. BR Nicdev Life is too short to worry about the things you don't have or cannot do ... So if you don't know how to do it - Learn it! Don't be afraid to ask for help ... Link to comment Share on other sites More sharing options...
Bilgus Posted March 5, 2018 Share Posted March 5, 2018 Hey this last example you posted erases the input box a little more throughly than the issue you were reporting but hey worse is still progress right? Link to comment Share on other sites More sharing options...
Bilgus Posted March 5, 2018 Share Posted March 5, 2018 ok got it to redraw by calling ControlShow ($Form1,"",$Input1) Case $Button4 $FolderPath = "C:\Windows" ShellExecute($FolderPath,"","",$SHEX_OPEN) ControlShow ($Form1,"",$Input1) You know this is starting to sound like an issue I was having getting up/dn arrows to show up in my edit box within a tabbed control what I finally ended up doing is only using the tabs from the tabctrl and unhiding controls based on what tab was selected See This Example: expandcollapse popup#include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <GuiTab.au3> #include <StaticConstants.au3> #include <TabConstants.au3> #include <WindowsConstants.au3> #include <AutoItConstants.au3> #include <WinAPI.au3> $Form1 = GUICreate("Tabbed Notebook Dialog", 419, 311, 299, 218) Global Enum $eC1_delete, $eC1_del_all, $eC1_update, $eC1_shift_dn, $eC1_shift_up, _ $eC1_closepath, $eC1_showimg, $eC1_lock, $eC1_undo, $eC1_redo, $aCtl1_LAST Global $g_ahCtl1[$aCtl1_LAST] ;------------------------------------------------------------------------------- Global Enum $eC2_zin, $eC2_zout, $eC2_dgroup, $eC2_decx, $eC2_incx, $eC2_decy, _ $eC2_incy, $eC2_edit_rot, $eC2_rot, $eC2_ud_rot, $eC2_rev, $eC2_toall, $aCtl2_LAST Global $g_ahCtl2[$aCtl2_LAST] Global Enum $eC3_open, $eC3_input1, $aCtl3_LAST Global $g_ahCtl3[$aCtl3_LAST] Global $g_hTab1 = GUICtrlCreateTab(8, 8, 396, 20) GUICtrlCreateLabel("", 8, 28, 396, 256) GUICtrlSetBkColor(-1, 0xFFFFFF) GUICtrlSetState(-1, $GUI_DISABLE) $TabSheet1 = GUICtrlCreateTabItem("TabSheet1") GUICtrlSetState(-1, $GUI_SHOW) ; will be display first $TabSheet1 = GUICtrlCreateTabItem("TabSheet2") $TabSheet3 = GUICtrlCreateTabItem("TabSheet3") GUICtrlCreateTabItem("") ; end tabitem definition Control_Create_Group1() Control_Create_Group2() Control_Create_Group3() Tab1_Select() GUISetState(@SW_SHOW) Global $g_nMsg = 0 While 1 $g_nMsg = GUIGetMsg() Switch $g_nMsg Case $GUI_EVENT_CLOSE Exit Case $g_hTab1 Tab1_Select() Case $g_ahCtl3[$eC3_open] $FolderPath = "C:\Windows" ShellExecute($FolderPath, "", "", $SHEX_OPEN) EndSwitch WEnd Func Tab1_Select() Local $iStateCtl1, $iStateCtl2, $iStateCtl3 Local $tabindex = GUICtrlRead($g_hTab1) ;ConsoleWrite("tab" & $tabindex + 1 & "_selected" & @CRLF) Select Case $tabindex = 0 $iStateCtl1 = $GUI_SHOW $iStateCtl2 = $GUI_HIDE $iStateCtl3 = $GUI_HIDE Case $tabindex = 1 $iStateCtl1 = $GUI_HIDE $iStateCtl2 = $GUI_SHOW $iStateCtl3 = $GUI_HIDE Case $tabindex = 2 $iStateCtl1 = $GUI_HIDE $iStateCtl2 = $GUI_HIDE $iStateCtl3 = $GUI_SHOW Case Else _GUICtrlTab_ActivateTab($g_hTab1, 0) Return EndSelect For $i = 0 To UBound($g_ahCtl1) - 1 GUICtrlSetState($g_ahCtl1[$i], $iStateCtl1) Next For $i = 0 To UBound($g_ahCtl2) - 1 GUICtrlSetState($g_ahCtl2[$i], $iStateCtl2) Next For $i = 0 To UBound($g_ahCtl3) - 1 GUICtrlSetState($g_ahCtl3[$i], $iStateCtl3) Next EndFunc ;==>Tab1_Select Func Control_Create_Group1() Local $iX = 30 Local $iY = 35 $g_ahCtl1[$eC1_delete] = GUICtrlCreateButton("Delete", $iX + 0, $iY + 0, 50, 20) $g_ahCtl1[$eC1_shift_dn] = GUICtrlCreateButton("+", $iX + 70, $iY + 0, 20, 20) $g_ahCtl1[$eC1_shift_up] = GUICtrlCreateButton("-", $iX + 95, $iY + 0, 20, 20) $g_ahCtl1[$eC1_del_all] = GUICtrlCreateButton("Delete All", $iX + 0, $iY + 25, 50, 20) $g_ahCtl1[$eC1_update] = GUICtrlCreateButton("Update", $iX + 70, $iY + 25, 50, 20) $g_ahCtl1[$eC1_undo] = GUICtrlCreateButton("Undo", $iX + 0, $iY + 50, 50, 20) $g_ahCtl1[$eC1_redo] = GUICtrlCreateButton("Redo", $iX + 70, $iY + 50, 50, 20) GUICtrlSetState($g_ahCtl1[$eC1_undo], $GUI_DISABLE) GUICtrlSetState($g_ahCtl1[$eC1_redo], $GUI_DISABLE) $g_ahCtl1[$eC1_closepath] = GUICtrlCreateCheckbox("Complete", $iX + 0, $iY + 70, 65, 25) $g_ahCtl1[$eC1_showimg] = GUICtrlCreateCheckbox("Image", $iX + 0, $iY + 90, 65, 25) $g_ahCtl1[$eC1_lock] = GUICtrlCreateCheckbox("Locked", $iX + 0, $iY + 110, 65, 25) EndFunc ;==>Control_Create_Group1 Func Control_Create_Group2() Local $iX = 30 Local $iY = 35 $g_ahCtl2[$eC2_rev] = GUICtrlCreateButton("Reverse", $iX + 0, $iY + 0, 50, 20) $g_ahCtl2[$eC2_edit_rot] = GUICtrlCreateInput("0", $iX + 0, $iY + 25, 40, 20) $g_ahCtl2[$eC2_ud_rot] = GUICtrlCreateUpdown(-1) GUICtrlSetLimit($eC2_ud_rot, 360, -360) $g_ahCtl2[$eC2_rot] = GUICtrlCreateButton("", $iX + 40, $iY + 25, 10, 20) $g_ahCtl2[$eC2_dgroup] = GUICtrlCreateGroup("Coords", 5 + $iX + 70, $iY + 0, 55, 70) $g_ahCtl2[$eC2_decy] = GUICtrlCreateButton("-", 24 + $iX + 70, 16 + $iY + 0, 17, 17) $g_ahCtl2[$eC2_incy] = GUICtrlCreateButton("+", 24 + $iX + 70, 48 + $iY + 0, 17, 17) $g_ahCtl2[$eC2_decx] = GUICtrlCreateButton("-", 8 + $iX + 70, 32 + $iY + 0, 17, 17) $g_ahCtl2[$eC2_incx] = GUICtrlCreateButton("+", 40 + $iX + 70, 32 + $iY + 0, 17, 17) GUICtrlCreateGroup("", -99, -99, 1, 1) $g_ahCtl2[$eC2_zout] = GUICtrlCreateButton("Zoom -", $iX + 0, $iY + 75, 50, 20) $g_ahCtl2[$eC2_zin] = GUICtrlCreateButton("Zoom +", $iX + 75, $iY + 75, 50, 20) $g_ahCtl2[$eC2_toall] = GUICtrlCreateCheckbox("Apply to all", $iX + 0, $iY + 100, 80, 25) EndFunc ;==>Control_Create_Group2 Func Control_Create_Group3() Local $iX = 30 Local $iY = 35 $g_ahCtl3[$eC3_open] = GUICtrlCreateButton("Open", $iX + 0, $iY + 0, 50, 20) $g_ahCtl3[$eC3_input1] = GUICtrlCreateInput("Input1", $iX + 0, $iY + 25, 40, 20) EndFunc ;==>Control_Create_Group3 Link to comment Share on other sites More sharing options...
Bilgus Posted March 5, 2018 Share Posted March 5, 2018 Cleaning it up a bit from the example I realized you might be able to use the tabcontrol as is and just dynamically hide show the controls as the previous example Not a big difference but makes it a bit better looking expandcollapse popup#include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> ;#include <GuiTab.au3> #include <StaticConstants.au3> ;#include <TabConstants.au3> #include <WindowsConstants.au3> #include <AutoItConstants.au3> $Form1 = GUICreate("Tabbed Notebook Dialog", 419, 311, 299, 218) Global Enum $eC1_delete, $eC1_del_all, $eC1_update, $eC1_shift_dn, $eC1_shift_up, _ $eC1_closepath, $eC1_showimg, $eC1_lock, $eC1_undo, $eC1_redo, $aCtl1_LAST Global $g_ahCtl1[$aCtl1_LAST] ;------------------------------------------------------------------------------- Global Enum $eC2_zin, $eC2_zout, $eC2_dgroup, $eC2_decx, $eC2_incx, $eC2_decy, _ $eC2_incy, $eC2_edit_rot, $eC2_rot, $eC2_ud_rot, $eC2_rev, $eC2_toall, $aCtl2_LAST Global $g_ahCtl2[$aCtl2_LAST] Global Enum $eC3_open, $eC3_input1, $aCtl3_LAST Global $g_ahCtl3[$aCtl3_LAST] Global $g_hTab1 = GUICtrlCreateTab(8, 8, 396, 256) ;GUICtrlCreateLabel("", 8, 28, 396, 256, $SS_WHITERECT) ;GUICtrlSetState(-1, $GUI_DISABLE) $TabSheet1 = GUICtrlCreateTabItem("TabSheet1") GUICtrlSetState(-1, $GUI_SHOW) ; will be display first $TabSheet1 = GUICtrlCreateTabItem("TabSheet2") $TabSheet3 = GUICtrlCreateTabItem("TabSheet3") GUICtrlCreateTabItem("") ; end tabitem definition Control_Create_TabGroup1(30, 35) Control_Create_TabGroup2(30, 35) Control_Create_TabGroup3(30, 35) Tab1_Select() GUISetState(@SW_SHOW) Global $g_nMsg = 0 While 1 $g_nMsg = GUIGetMsg() Switch $g_nMsg Case $GUI_EVENT_CLOSE Exit Case $g_hTab1 Tab1_Select() Case $g_ahCtl3[$eC3_open] $FolderPath = "C:\Windows" ShellExecute($FolderPath, "", "", $SHEX_OPEN) EndSwitch WEnd Func Tab1_Select() Local $tabindex = GUICtrlRead($g_hTab1) Local Const $aStates[2] = [$GUI_HIDE, $GUI_SHOW] ;ConsoleWrite("tab" & $tabindex + 1 & "_selected" & @CRLF) For $i = 0 To UBound($g_ahCtl1) - 1 GUICtrlSetState($g_ahCtl1[$i], $aStates[$tabindex = 0]) Next For $i = 0 To UBound($g_ahCtl2) - 1 GUICtrlSetState($g_ahCtl2[$i], $aStates[$tabindex = 1]) Next For $i = 0 To UBound($g_ahCtl3) - 1 GUICtrlSetState($g_ahCtl3[$i], $aStates[$tabindex = 2]) Next EndFunc ;==>Tab1_Select Func Control_Create_TabGroup1($iX, $iY) Static Local $IsInitialized = False If $IsInitialized Then Return $IsInitialized = True $g_ahCtl1[$eC1_delete] = GUICtrlCreateButton("Delete", $iX + 0, $iY + 0, 50, 20) $g_ahCtl1[$eC1_shift_dn] = GUICtrlCreateButton("+", $iX + 70, $iY + 0, 20, 20) $g_ahCtl1[$eC1_shift_up] = GUICtrlCreateButton("-", $iX + 95, $iY + 0, 20, 20) $g_ahCtl1[$eC1_del_all] = GUICtrlCreateButton("Delete All", $iX + 0, $iY + 25, 50, 20) $g_ahCtl1[$eC1_update] = GUICtrlCreateButton("Update", $iX + 70, $iY + 25, 50, 20) $g_ahCtl1[$eC1_undo] = GUICtrlCreateButton("Undo", $iX + 0, $iY + 50, 50, 20) $g_ahCtl1[$eC1_redo] = GUICtrlCreateButton("Redo", $iX + 70, $iY + 50, 50, 20) GUICtrlSetState($g_ahCtl1[$eC1_undo], $GUI_DISABLE) GUICtrlSetState($g_ahCtl1[$eC1_redo], $GUI_DISABLE) $g_ahCtl1[$eC1_closepath] = GUICtrlCreateCheckbox("Complete", $iX + 0, $iY + 70, 65, 25) $g_ahCtl1[$eC1_showimg] = GUICtrlCreateCheckbox("Image", $iX + 0, $iY + 90, 65, 25) $g_ahCtl1[$eC1_lock] = GUICtrlCreateCheckbox("Locked", $iX + 0, $iY + 110, 65, 25) EndFunc ;==>Control_Create_TabGroup1 Func Control_Create_TabGroup2($iX, $iY) Static Local $IsInitialized = False If $IsInitialized Then Return $IsInitialized = True $g_ahCtl2[$eC2_rev] = GUICtrlCreateButton("Reverse", $iX + 0, $iY + 0, 50, 20) $g_ahCtl2[$eC2_edit_rot] = GUICtrlCreateInput("0", $iX + 0, $iY + 25, 40, 20) $g_ahCtl2[$eC2_ud_rot] = GUICtrlCreateUpdown(-1) GUICtrlSetLimit($eC2_ud_rot, 360, -360) $g_ahCtl2[$eC2_rot] = GUICtrlCreateButton("", $iX + 40, $iY + 25, 10, 20) $g_ahCtl2[$eC2_dgroup] = GUICtrlCreateGroup("Coords", 5 + $iX + 70, $iY + 0, 55, 70) $g_ahCtl2[$eC2_decy] = GUICtrlCreateButton("-", 24 + $iX + 70, 16 + $iY + 0, 17, 17) $g_ahCtl2[$eC2_incy] = GUICtrlCreateButton("+", 24 + $iX + 70, 48 + $iY + 0, 17, 17) $g_ahCtl2[$eC2_decx] = GUICtrlCreateButton("-", 8 + $iX + 70, 32 + $iY + 0, 17, 17) $g_ahCtl2[$eC2_incx] = GUICtrlCreateButton("+", 40 + $iX + 70, 32 + $iY + 0, 17, 17) GUICtrlCreateGroup("", -99, -99, 1, 1) $g_ahCtl2[$eC2_zout] = GUICtrlCreateButton("Zoom -", $iX + 0, $iY + 75, 50, 20) $g_ahCtl2[$eC2_zin] = GUICtrlCreateButton("Zoom +", $iX + 75, $iY + 75, 50, 20) $g_ahCtl2[$eC2_toall] = GUICtrlCreateCheckbox("Apply to all", $iX + 0, $iY + 100, 80, 25) EndFunc ;==>Control_Create_TabGroup2 Func Control_Create_TabGroup3($iX, $iY) Static Local $IsInitialized = False If $IsInitialized Then Return $IsInitialized = True $g_ahCtl3[$eC3_open] = GUICtrlCreateButton("Open", $iX + 0, $iY + 0, 50, 20) $g_ahCtl3[$eC3_input1] = GUICtrlCreateInput("Input1", $iX + 0, $iY + 25, 40, 20) EndFunc ;==>Control_Create_TabGroup3 Link to comment Share on other sites More sharing options...
nicdev007 Posted March 6, 2018 Author Share Posted March 6, 2018 Quote Hey this last example you posted erases the input box a little more throughly than the issue you were reporting but hey worse is still progress right? So right: negative progress is still progress in some form :-) In any even even thought the problem is not solved yet, It has pushed me to learn a lot more! So that makes it positive progress. By the way thanks for the example you sent, it gives me an idea for another project I want to start soon. I like the way you used an array at creation time, that opens up a lot of possibilities. In fact the example I showed to explain the issue I am experiencing is just a sample code from Koda, my actual project is much larger than that, and GUI has around 12 input boxes among the 30 or so Controls, and they all disappear when the user clicks the "Open" button. The interface allows an engineer to enter information about the analysis he is doing in a structured (and controlled) way locally, and saving eventually to the main database when he is done. I tested this morning on a PC of one such engineer running Windows 10 and the result is the same, the input box disappears. while testing your last code here, I noticed that the input box on the last tab also disappears on my side. For sure it must have something to do with the loss of focus, when the button is clicked, but why it happens for me and not for you remains a mystery... If the folder location (C:\Windows\) is already open in an explorer window, then the input box does not lose it's border. If the folder location is not open yet, then the input box loses it's border, and only gets redrawn once I change tabs or hover my mouse over it. This behavior is the same for you example and mine. Thanks for all your help so far. Life is too short to worry about the things you don't have or cannot do ... So if you don't know how to do it - Learn it! Don't be afraid to ask for help ... Link to comment Share on other sites More sharing options...
Bilgus Posted March 6, 2018 Share Posted March 6, 2018 Well now that is curious What about the example just previous taht uses a label instead of the whole tabctrl?? Link to comment Share on other sites More sharing options...
Bilgus Posted March 6, 2018 Share Posted March 6, 2018 (edited) Or just replace with this in the current one.. Global $g_hTab1 = GUICtrlCreateTab(8, 8, 396, 25) GUICtrlCreateLabel("", 8, 28, 396, 256) or even just the tab control tabs Global $g_hTab1 = GUICtrlCreateTab(8, 8, 396, 25) ;GUICtrlCreateLabel("", 8, 28, 396, 256) Edited March 6, 2018 by Bilgus Link to comment Share on other sites More sharing options...
nicdev007 Posted March 6, 2018 Author Share Posted March 6, 2018 Quote Well now that is curious What about the example just previous taht uses a label instead of the whole tabctrl?? I tested with both and the results are the same... curious indeed... I did some more testing and if I open a file (instead of a folder) the input box border does not disappear. I tried several folders and several files the result is the same. It's like the return back from windows explorer, after opening the folder location, is not correct or something, but that's a leap ... Life is too short to worry about the things you don't have or cannot do ... So if you don't know how to do it - Learn it! Don't be afraid to ask for help ... Link to comment Share on other sites More sharing options...
Bilgus Posted March 6, 2018 Share Posted March 6, 2018 (edited) My guess is something to do with shellexecute or it might very well be something in the tabcontrols messing up the on paint event Or hottracking try messing witht the style attribute of the tab control like set it to $TCS_FOCUSNEVER or even the extendedstyle attributes like set it to $WS_EX_COMPOSITED etc. Edited March 6, 2018 by Bilgus Link to comment Share on other sites More sharing options...
nicdev007 Posted March 6, 2018 Author Share Posted March 6, 2018 Quote My guess is something to do with shellexecute or it might very well be something in the tabcontrols messing up the on paint event I agree with you on this, but how to pinpoint it is really a tough one. I tried to check with AU3info if anything changes in the GUI or the control but got no further. In the mean time i'll dig some more into the bowels of the beast to see what pops. Hopefully we can stumble across something to point in the right direction. I'll try some tests later to try and recover the attributes if I can and then see where it leads and what changes. Thanks for your help so far!! Regards Nicdev Life is too short to worry about the things you don't have or cannot do ... So if you don't know how to do it - Learn it! Don't be afraid to ask for help ... 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