Jump to content

Flickering when changing Tabs


 Share

Recommended Posts

Hi guys,

I have a script where I have tabs with several listviews on each tab and when I switch between tabs, contents within the tabs control flicker, which doesnt look very good.

Is there any way to reduce/remove the flicker when switching tabs?

I'm using AutoIt native tab control.

Thanks!

Link to comment
Share on other sites

Could you provide a small reproducer first. Thanks.

UDF List:

 
_AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_ArrayFilter/_ArrayReduce_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_ConvertLHWebColor()/_ConvertSHWebColor()_DesktopDimensions()_DisplayPassword()_DotNet_Load()/_DotNet_Unload()_Fibonacci()_FileCompare()_FileCompareContents()_FileNameByHandle()_FilePrefix/SRE()_FindInFile()_GetBackgroundColor()/_SetBackgroundColor()_GetConrolID()_GetCtrlClass()_GetDirectoryFormat()_GetDriveMediaType()_GetFilename()/_GetFilenameExt()_GetHardwareID()_GetIP()_GetIP_Country()_GetOSLanguage()_GetSavedSource()_GetStringSize()_GetSystemPaths()_GetURLImage()_GIFImage()_GoogleWeather()_GUICtrlCreateGroup()_GUICtrlListBox_CreateArray()_GUICtrlListView_CreateArray()_GUICtrlListView_SaveCSV()_GUICtrlListView_SaveHTML()_GUICtrlListView_SaveTxt()_GUICtrlListView_SaveXML()_GUICtrlMenu_Recent()_GUICtrlMenu_SetItemImage()_GUICtrlTreeView_CreateArray()_GUIDisable()_GUIImageList_SetIconFromHandle()_GUIRegisterMsg()_GUISetIcon()_Icon_Clear()/_Icon_Set()_IdleTime()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_IsSystemDrive()_IsUPX()_IsValidType()_IsWebColor()_Language()_Log()_MicrosoftInternetConnectivity()_MSDNDataType()_PathFull/GetRelative/Split()_PathSplitEx()_PrintFromArray()_ProgressSetMarquee()_ReDim()_RockPaperScissors()/_RockPaperScissorsLizardSpock()_ScrollingCredits_SelfDelete()_SelfRename()_SelfUpdate()_SendTo()_ShellAll()_ShellFile()_ShellFolder()_SingletonHWID()_SingletonPID()_Startup()_StringCompact()_StringIsValid()_StringRegExpMetaCharacters()_StringReplaceWholeWord()_StringStripChars()_Temperature()_TrialPeriod()_UKToUSDate()/_USToUKDate()_WinAPI_Create_CTL_CODE()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()Au3 script parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingDirToHTML5FileInstallrFileReadLastChars()GeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()Int_Parse() & Int_TryParse()IsISBN()LockFile()Mapping CtrlIDsOOP in AutoItParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandProtect GlobalsQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...

Updated: 22/04/2018

Link to comment
Share on other sites

Hi, here's the reproducing script:

#include-once
#include <GUIConstantsEX.au3>
#Include <GuiListView.au3>
#include <WindowsConstants.au3>
#include <GuiTab.au3>
#include <EditConstants.au3>

Global $hGUI, $iLastTab = 0, $pt_lv_spec[1], $pt_lv_supp[1], $pt_lv_rel[1], $pt_lv_res[1], $pt_grp_label[1], $pt_lb_desc[1], $pt_ed_desc[1], $pt_ed_notes[1], _
        $pt_lb_extra[1], $pt_lb_listp[1], $pt_listp[1], $pt_lb_avail[1], $pt_avail[1], $pt_lb_spec[1], $pt_lv_spec[1], $pt_lb_supp[1], $pt_lv_supp[1], $pt_lb_rel[1], _
        $pt_lb_notes[1], $pt_ed_extra[1], $tabs, $pt_lb_res[1], $pt_lv_res[1], $pt_lb_elite[1], $pt_lb_select[1], $pt_lb_reseller[1], $pt_cb_elite[1], _
        $pt_cb_select[1], $pt_cb_reseller[1], $pt_lb_type[1], $pt_type[1], $ahListView[5]

#Region ### START Koda GUI section ###
$hGUI = GUICreate("Test Gui", 1301, 800, @DesktopWidth/2 - 1301/2, @DesktopHeight/2 - 800/2)
$hButton = GUICtrlCreateButton("Add Tab", 210, 23, 50, 21)
$cCloseX = GUICtrlCreateLabel("X", 0, 0, 0, 0)
GUICtrlSetState(-1,$GUI_HIDE)
$cTab = GUICtrlCreateTab(8, 56, 1284, 736)
GUICtrlCreateTabItem("")
#EndRegion ### END Koda GUI section ###

GUISetState(@SW_SHOW, $hGUI)

AddTab()

While 1
    $msg = GUIGetMsg()

    Switch $msg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $cCloseX
            $iTabID = GUICtrlRead($cTab, 1)
            GUICtrlDelete($iTabID)
            ChangeTabs()
        Case $hButton
            AddTab()
    EndSwitch

    $iCurrTab = _GUICtrlTab_GetCurFocus($cTab) ; Check which Tab is active
    If $iCurrTab <> $iLastTab Then ; If the Tab has changed
        Switch $iCurrTab ; Show/Hide controls as required
            Case 0
                ChangeTabs()
            Case Else
                ChangeTabs()
        EndSwitch
        $iLastTab = $iCurrTab ; Store the value for future comparisons
    EndIf
WEnd

Func AddTab()

    If Not IsArray($tabs) Then
        Dim $tabs[1][2]
    Else
        ReDim $tabs[Ubound($tabs) + 1][2]
    EndIf

    If Ubound($tabs) = 1 Then
        $tabs[Ubound($tabs) - 1][0] = GUICtrlCreateTabItem("Tab 1")
        $Label1 = GUICtrlCreateLabel("Welcome message:", 40, 100, 150, 17)
        $Edit1 = GUICtrlCreateEdit("", 40, 120, 680, 220, BitOR($ES_AUTOVSCROLL, $ES_WANTRETURN))
        $Label2 = GUICtrlCreateLabel("Version Changes:", 40, 370, 150, 17)
        $Edit2 = GUICtrlCreateEdit("", 40, 390, 680, 220, BitOR($ES_AUTOVSCROLL, $ES_WANTRETURN))
        $Label3 = GUICtrlCreateLabel("Current Features:", 780, 100, 150, 17)
        $Edit3 = GUICtrlCreateEdit("", 780, 120, 470, 490, BitOR($ES_AUTOVSCROLL, $ES_WANTRETURN))
        GUICtrlCreateTabItem("")
    Else
        ReDim $pt_grp_label[Ubound($tabs)]
        ReDim $pt_lb_desc[Ubound($tabs)]
        ReDim $pt_ed_desc[Ubound($tabs)]
        ReDim $pt_lb_notes[Ubound($tabs)]
        ReDim $pt_ed_notes[Ubound($tabs)]
        ReDim $pt_lb_extra[Ubound($tabs)]
        ReDim $pt_ed_extra[Ubound($tabs)]
        ReDim $pt_lb_listp[Ubound($tabs)]
        ReDim $pt_listp[Ubound($tabs)]
        ReDim $pt_lb_spec[Ubound($tabs)]
        ReDim $pt_lv_spec[Ubound($tabs)]
        ReDim $pt_lb_supp[Ubound($tabs)]
        ReDim $pt_lv_supp[Ubound($tabs)]
        ReDim $pt_lb_rel[Ubound($tabs)]
        ReDim $pt_lv_rel[Ubound($tabs)]
        ReDim $pt_lb_res[Ubound($tabs)]
        ReDim $pt_lv_res[Ubound($tabs)]
        ReDim $pt_lb_elite[Ubound($tabs)]
        ReDim $pt_lb_select[Ubound($tabs)]
        ReDim $pt_lb_reseller[Ubound($tabs)]
        ReDim $pt_cb_elite[Ubound($tabs)]
        ReDim $pt_cb_select[Ubound($tabs)]
        ReDim $pt_cb_reseller[Ubound($tabs)]
        ReDim $pt_lb_type[Ubound($tabs)]
        ReDim $pt_type[Ubound($tabs)]

        $tabs[Ubound($tabs) - 1][0] = GUICtrlCreateTabItem("Tab" & Ubound($tabs) - 1 & "     ")

        $c = Ubound($tabs) - 1
        $tabs[Ubound($tabs) - 1][1] = $c

        $pt_lb_listp[$c] = GUICtrlCreateLabel("List Price (USD):", 25, 275, 80, 20)
        $pt_listp[$c] = GUICtrlCreateLabel("XXXXX", 105, 275, 80, 20) ;list price

        $pt_lb_type[$c] = GUICtrlCreateLabel("Product type:", 25, 295, 85, 20)
        $pt_type[$c] = GUICtrlCreateLabel("TYPE", 90, 295, 200, 20) ;product type

        $pt_lb_elite[$c] = GUICtrlCreateLabel("Gold", 192, 275, 36, 20)
        $pt_cb_elite[$c] = GUICtrlCreateCheckbox("", 175, 273, 17, 17)
        GUICtrlSetState(-1,$GUI_CHECKED)

        $pt_lb_select[$c] = GUICtrlCreateLabel("Silver", 237, 275, 36, 20)
        $pt_cb_select[$c] = GUICtrlCreateCheckbox("", 220, 273, 17, 17)
        GUICtrlSetState(-1,$GUI_CHECKED)

        $pt_lb_reseller[$c] = GUICtrlCreateLabel("Bronze", 292, 275, 50, 20)
        $pt_cb_reseller[$c] = GUICtrlCreateCheckbox("", 275, 273, 17, 17)
        GUICtrlSetState(-1,$GUI_CHECKED)

        $pt_grp_label[$c] = GUICtrlCreateGroup("Product Information", 335, 80, 410, 240)
        $pt_lb_desc[$c] = GUICtrlCreateLabel("Description:", 345, 100, 100, 20)
        GUICtrlSetFont(-1, 8, 800, 0, "Arial")
        $pt_ed_desc[$c] = GUICtrlCreateEdit("Description here", 345, 115, 390, 50, BitOR($ES_AUTOVSCROLL, $ES_WANTRETURN, $WS_VSCROLL)) ;description
        $pt_lb_notes[$c] = GUICtrlCreateLabel("Notes:", 345, 170, 100, 20)
        GUICtrlSetFont(-1, 8, 800, 0, "Arial")
        $pt_ed_notes[$c] = GUICtrlCreateEdit("Notes here", 345, 185, 390, 50, BitOR($ES_AUTOVSCROLL, $ES_WANTRETURN, $WS_VSCROLL)) ;notes
        $pt_lb_extra[$c] = GUICtrlCreateLabel("Extra details/notes:", 345, 240, 100, 20)
        GUICtrlSetFont(-1, 8, 800, 0, "Arial")
        $pt_ed_extra[$c] = GUICtrlCreateEdit("Extra details here", 345, 255, 390, 50, BitOR($ES_AUTOVSCROLL, $ES_WANTRETURN, $WS_VSCROLL)) ;extra

        ;;Specs List View
        $pt_lb_spec[$c] = GUICtrlCreateLabel("Specifications:", 25, 317, 73, 17)
        GUICtrlSetFont(-1, 8, 800, 0, "Arial")
        $pt_lv_spec[$c] = GUICtrlCreateListView("", 25, 335, 720, 255)
        _GUICtrlListView_AddColumn($pt_lv_spec[$c], "Feature", 100)
        _GUICtrlListView_AddColumn($pt_lv_spec[$c], "Detail", 100)
        Dim $pspec_array[11][2]
        For $i = 0 to 10
            $pspec_array[$i][0] = "Feature " & $i
            $pspec_array[$i][1] = "Detail " & $i
        Next
        _GUICtrlListView_AddArray($pt_lv_spec[$c], $pspec_array)
        _GUICtrlListView_SetColumnWidth($pt_lv_spec[$c], 0, 150)
        _GUICtrlListView_SetColumnWidth($pt_lv_spec[$c], 1, $LVSCW_AUTOSIZE_USEHEADER)
        GUICtrlSendMsg($pt_lv_spec[$c], $LVM_SETEXTENDEDLISTVIEWSTYLE, $LVS_EX_GRIDLINES, $LVS_EX_GRIDLINES)
        GUICtrlSendMsg($pt_lv_spec[$c], $LVM_SETEXTENDEDLISTVIEWSTYLE, $LVS_EX_INFOTIP, $LVS_EX_INFOTIP)
        ;;==>Specs List View

        ;;Support Options List View
        $pt_lb_supp[$c] = GUICtrlCreateLabel("Related Options:", 25, 597, 150, 17)
        GUICtrlSetFont(-1, 8, 800, 0, "Arial")
        $pt_lv_supp[$c] = GUICtrlCreateListView("", 25, 615, 720, 170)
        _GUICtrlListView_AddColumn($pt_lv_supp[$c], "Part No", 100)
        _GUICtrlListView_AddColumn($pt_lv_supp[$c], "Description", 100)
        Dim $psupp_array[21][2]
        For $i = 0 to 20
            $psupp_array[$i][0] = "Part " & $i
            $psupp_array[$i][1] = "Description " & $i
        Next
        _GUICtrlListView_AddArray($pt_lv_supp[$c], $psupp_array)
        _GUICtrlListView_SetColumnWidth($pt_lv_supp[$c], 0, $LVSCW_AUTOSIZE_USEHEADER)
        _GUICtrlListView_SetColumnWidth($pt_lv_supp[$c], 1, $LVSCW_AUTOSIZE_USEHEADER)
        GUICtrlSendMsg($pt_lv_supp[$c], $LVM_SETEXTENDEDLISTVIEWSTYLE, $LVS_EX_GRIDLINES, $LVS_EX_GRIDLINES)
        GUICtrlSendMsg($pt_lv_supp[$c], $LVM_SETEXTENDEDLISTVIEWSTYLE, $LVS_EX_INFOTIP, $LVS_EX_INFOTIP)
        GUICtrlSetState($pt_lv_supp[$c],$GUI_ENABLE)
        ;;==>Support Options List View

        ;;Related Parts List View
        $pt_lb_rel[$c] = GUICtrlCreateLabel("Related parts:", 770, 80, 100, 17)
        GUICtrlSetFont(-1, 8, 800, 0, "Arial")
        $pt_lv_rel[$c] = GUICtrlCreateListView("", 770, 95, 500, 495)
        _GUICtrlListView_AddColumn($pt_lv_rel[$c], "Part No", 100)
        _GUICtrlListView_AddColumn($pt_lv_rel[$c], "Type", 100)
        _GUICtrlListView_AddColumn($pt_lv_rel[$c], "Description", 100)
        Dim $rel_prod_array[36][3]
        For $i = 0 to 35
            $rel_prod_array[$i][0] = "Part " & $i
            $rel_prod_array[$i][1] = "Type " & $i
            $rel_prod_array[$i][2] = "Description " & $i
        Next
        _GUICtrlListView_AddArray($pt_lv_rel[$c], $rel_prod_array)
        _GUICtrlListView_SetColumnWidth($pt_lv_rel[$c], 0, $LVSCW_AUTOSIZE_USEHEADER)
        _GUICtrlListView_SetColumnWidth($pt_lv_rel[$c], 1, 80)
        _GUICtrlListView_SetColumnWidth($pt_lv_rel[$c], 2, $LVSCW_AUTOSIZE_USEHEADER)
        GUICtrlSendMsg($pt_lv_rel[$c], $LVM_SETEXTENDEDLISTVIEWSTYLE, $LVS_EX_GRIDLINES, $LVS_EX_GRIDLINES)
        GUICtrlSendMsg($pt_lv_rel[$c], $LVM_SETEXTENDEDLISTVIEWSTYLE, $LVS_EX_INFOTIP, $LVS_EX_INFOTIP)
        GUICtrlSetState($pt_lv_rel[$c],$GUI_ENABLE)
        ;;==>Related Parts List View

        ;;Resources List View
        $pt_lb_res[$c] = GUICtrlCreateLabel("Resources:", 770, 597, 81, 17)
        GUICtrlSetFont(-1, 8, 800, 0, "Arial")
        $pt_lv_res[$c] = GUICtrlCreateListView("", 770, 615, 500, 170)
        GUICtrlSetState($pt_lv_res[$c],$GUI_DISABLE)
        _GUICtrlListView_AddColumn($pt_lv_res[$c], "Resource", 100)
        _GUICtrlListView_AddColumn($pt_lv_res[$c], "Description", 100)
        Dim $res_array[6][2]
        For $i = 0 to 5
            $res_array[$i][0] = "Resource " & $i
            $res_array[$i][1] = "Description " & $i
        Next
        _GUICtrlListView_AddArray($pt_lv_res[$c], $res_array)
        _GUICtrlListView_SetColumnWidth($pt_lv_res[$c], 1, $LVSCW_AUTOSIZE_USEHEADER)
        GUICtrlSendMsg($pt_lv_res[$c], $LVM_SETEXTENDEDLISTVIEWSTYLE, $LVS_EX_GRIDLINES, $LVS_EX_GRIDLINES)
        GUICtrlSendMsg($pt_lv_res[$c], $LVM_SETEXTENDEDLISTVIEWSTYLE, $LVS_EX_INFOTIP, $LVS_EX_INFOTIP)
        GUICtrlSetState($pt_lv_res[$c],$GUI_ENABLE)
        ;;==>Resources List View

        GUICtrlCreateTabItem("")

    EndIf
CleanUpTabData()
EndFunc

Func CleanUpTabData()
    $pspec_array = 0
    $rel_prod_array = 0
    $psupp_array = 0
    $res_array = 0
EndFunc

Func ChangeTabs()

Local $iMargin_X = 13, $iMargin_Y = 58
Local $iTab = GUICtrlRead($cTab)
Local $iTabID = GUICtrlRead($cTab, 1)
Local $TabsArrayRow = _ArraySearch($tabs, $iTabID, 0, 0, 0, 0, 0, 0)

    If $iTab <> 0 Then
        $aTab_Coord = _GUICtrlTab_GetItemRect($cTab, $iTab)
        $iOffset = $aTab_Coord[2] - $aTab_Coord[0] - 20
        GUICtrlSetPos($cCloseX, $iMargin_X + $aTab_Coord[0] + $iOffset, $iMargin_Y + $aTab_Coord[1], 11, 11)
        GUISetState(@SW_LOCK, $hGui)
        ControlShow($hGUI, "", $cCloseX)
        GUISetState(@SW_UNLOCK, $hGui)
        $ahListView[1] = ControlGetHandle('','',$pt_lv_spec[$tabs[$TabsArrayRow][1]]); Store the handle in the array
        $ahListView[2] = ControlGetHandle('','',$pt_lv_supp[$tabs[$TabsArrayRow][1]]); Store the handle in the array
        $ahListView[3] = ControlGetHandle('','',$pt_lv_rel[$tabs[$TabsArrayRow][1]]); Store the handle in the array
        $ahListView[4] = ControlGetHandle('','',$pt_lv_res[$tabs[$TabsArrayRow][1]]); Store the handle in the array
    Else
        ControlHide($hGUI, "", $cCloseX)
    EndIf

EndFunc
Edited by mpower
Link to comment
Share on other sites

Why aren't you using the native commands in AutoIt? e.g. GUICtrlCreateTab?

UDF List:

 
_AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_ArrayFilter/_ArrayReduce_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_ConvertLHWebColor()/_ConvertSHWebColor()_DesktopDimensions()_DisplayPassword()_DotNet_Load()/_DotNet_Unload()_Fibonacci()_FileCompare()_FileCompareContents()_FileNameByHandle()_FilePrefix/SRE()_FindInFile()_GetBackgroundColor()/_SetBackgroundColor()_GetConrolID()_GetCtrlClass()_GetDirectoryFormat()_GetDriveMediaType()_GetFilename()/_GetFilenameExt()_GetHardwareID()_GetIP()_GetIP_Country()_GetOSLanguage()_GetSavedSource()_GetStringSize()_GetSystemPaths()_GetURLImage()_GIFImage()_GoogleWeather()_GUICtrlCreateGroup()_GUICtrlListBox_CreateArray()_GUICtrlListView_CreateArray()_GUICtrlListView_SaveCSV()_GUICtrlListView_SaveHTML()_GUICtrlListView_SaveTxt()_GUICtrlListView_SaveXML()_GUICtrlMenu_Recent()_GUICtrlMenu_SetItemImage()_GUICtrlTreeView_CreateArray()_GUIDisable()_GUIImageList_SetIconFromHandle()_GUIRegisterMsg()_GUISetIcon()_Icon_Clear()/_Icon_Set()_IdleTime()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_IsSystemDrive()_IsUPX()_IsValidType()_IsWebColor()_Language()_Log()_MicrosoftInternetConnectivity()_MSDNDataType()_PathFull/GetRelative/Split()_PathSplitEx()_PrintFromArray()_ProgressSetMarquee()_ReDim()_RockPaperScissors()/_RockPaperScissorsLizardSpock()_ScrollingCredits_SelfDelete()_SelfRename()_SelfUpdate()_SendTo()_ShellAll()_ShellFile()_ShellFolder()_SingletonHWID()_SingletonPID()_Startup()_StringCompact()_StringIsValid()_StringRegExpMetaCharacters()_StringReplaceWholeWord()_StringStripChars()_Temperature()_TrialPeriod()_UKToUSDate()/_USToUKDate()_WinAPI_Create_CTL_CODE()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()Au3 script parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingDirToHTML5FileInstallrFileReadLastChars()GeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()Int_Parse() & Int_TryParse()IsISBN()LockFile()Mapping CtrlIDsOOP in AutoItParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandProtect GlobalsQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...

Updated: 22/04/2018

Link to comment
Share on other sites

Well, I know you requested someone with experience, but you got me instead.

Here's what worked for me (win xp)

At least for me, it removed the "big flicker" that was going on.

Func ChangeTabs()

    Local $iMargin_X = 13, $iMargin_Y = 58
    Local $iTab = GUICtrlRead($cTab)
    Local $iTabID = GUICtrlRead($cTab, 1)
    Local $TabsArrayRow = _ArraySearch($tabs, $iTabID, 0, 0, 0, 0, 0, 0)

    If $iTab <> 0 Then
        $aTab_Coord = _GUICtrlTab_GetItemRect($cTab, $iTab)
        $iOffset = $aTab_Coord[2] - $aTab_Coord[0] - 20
        GUICtrlSetPos($cCloseX, $iMargin_X + $aTab_Coord[0] + $iOffset, $iMargin_Y + $aTab_Coord[1], 11, 11)
        GUISetState(@SW_LOCK, $hGUI)
        ;ControlShow($hGUI, "", $cCloseX)>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>subbtract

        GUISetState(@SW_UNLOCK, $hGUI)
        $ahListView[1] = ControlGetHandle('', '', $pt_lv_spec[$tabs[$TabsArrayRow][1]]); Store the handle in the array
        $ahListView[2] = ControlGetHandle('', '', $pt_lv_supp[$tabs[$TabsArrayRow][1]]); Store the handle in the array
        $ahListView[3] = ControlGetHandle('', '', $pt_lv_rel[$tabs[$TabsArrayRow][1]]); Store the handle in the array
        $ahListView[4] = ControlGetHandle('', '', $pt_lv_res[$tabs[$TabsArrayRow][1]]); Store the handle in the array
    Else
        ControlHide($hGUI, "", $cCloseX)
    EndIf

    ControlShow($hGUI, "", $cCloseX);>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>re-locate

EndFunc   ;==>ChangeTabs
Edited by lorenkinzel
Link to comment
Share on other sites

thanks for trying but unfortunately that doesn't do anything on Win 7 :( it also means that the X will still show on all tabs including tab 1 which I don't want.

 

 

Well, I know you requested someone with experience, but you got me instead.

Here's what worked for me (win xp)

At least for me, it removed the "big flicker" that was going on.

Func ChangeTabs()

    Local $iMargin_X = 13, $iMargin_Y = 58
    Local $iTab = GUICtrlRead($cTab)
    Local $iTabID = GUICtrlRead($cTab, 1)
    Local $TabsArrayRow = _ArraySearch($tabs, $iTabID, 0, 0, 0, 0, 0, 0)

    If $iTab <> 0 Then
        $aTab_Coord = _GUICtrlTab_GetItemRect($cTab, $iTab)
        $iOffset = $aTab_Coord[2] - $aTab_Coord[0] - 20
        GUICtrlSetPos($cCloseX, $iMargin_X + $aTab_Coord[0] + $iOffset, $iMargin_Y + $aTab_Coord[1], 11, 11)
        GUISetState(@SW_LOCK, $hGUI)
        ;ControlShow($hGUI, "", $cCloseX)>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>subbtract

        GUISetState(@SW_UNLOCK, $hGUI)
        $ahListView[1] = ControlGetHandle('', '', $pt_lv_spec[$tabs[$TabsArrayRow][1]]); Store the handle in the array
        $ahListView[2] = ControlGetHandle('', '', $pt_lv_supp[$tabs[$TabsArrayRow][1]]); Store the handle in the array
        $ahListView[3] = ControlGetHandle('', '', $pt_lv_rel[$tabs[$TabsArrayRow][1]]); Store the handle in the array
        $ahListView[4] = ControlGetHandle('', '', $pt_lv_res[$tabs[$TabsArrayRow][1]]); Store the handle in the array
    Else
        ControlHide($hGUI, "", $cCloseX)
    EndIf

    ControlShow($hGUI, "", $cCloseX);>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>re-locate

EndFunc   ;==>ChangeTabs
Link to comment
Share on other sites

anyone else wanna have a crack? I've tried a lot of things but the flicker is still there.

I'm thinking maybe if its possible to detect a tab change as soon as a different tab is clicked the GUI could get locked and then unlocked once the new tab appears maybe that could work but that is beyond my capability with autoit.

is it just an inherent problem in the native autoit tab interface? should I just give up on it and settle for the flicker?

Link to comment
Share on other sites

For the sake of helping, could you strip it back to just a couple of tabs with a few controls, then post that re-producer. 

UDF List:

 
_AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_ArrayFilter/_ArrayReduce_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_ConvertLHWebColor()/_ConvertSHWebColor()_DesktopDimensions()_DisplayPassword()_DotNet_Load()/_DotNet_Unload()_Fibonacci()_FileCompare()_FileCompareContents()_FileNameByHandle()_FilePrefix/SRE()_FindInFile()_GetBackgroundColor()/_SetBackgroundColor()_GetConrolID()_GetCtrlClass()_GetDirectoryFormat()_GetDriveMediaType()_GetFilename()/_GetFilenameExt()_GetHardwareID()_GetIP()_GetIP_Country()_GetOSLanguage()_GetSavedSource()_GetStringSize()_GetSystemPaths()_GetURLImage()_GIFImage()_GoogleWeather()_GUICtrlCreateGroup()_GUICtrlListBox_CreateArray()_GUICtrlListView_CreateArray()_GUICtrlListView_SaveCSV()_GUICtrlListView_SaveHTML()_GUICtrlListView_SaveTxt()_GUICtrlListView_SaveXML()_GUICtrlMenu_Recent()_GUICtrlMenu_SetItemImage()_GUICtrlTreeView_CreateArray()_GUIDisable()_GUIImageList_SetIconFromHandle()_GUIRegisterMsg()_GUISetIcon()_Icon_Clear()/_Icon_Set()_IdleTime()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_IsSystemDrive()_IsUPX()_IsValidType()_IsWebColor()_Language()_Log()_MicrosoftInternetConnectivity()_MSDNDataType()_PathFull/GetRelative/Split()_PathSplitEx()_PrintFromArray()_ProgressSetMarquee()_ReDim()_RockPaperScissors()/_RockPaperScissorsLizardSpock()_ScrollingCredits_SelfDelete()_SelfRename()_SelfUpdate()_SendTo()_ShellAll()_ShellFile()_ShellFolder()_SingletonHWID()_SingletonPID()_Startup()_StringCompact()_StringIsValid()_StringRegExpMetaCharacters()_StringReplaceWholeWord()_StringStripChars()_Temperature()_TrialPeriod()_UKToUSDate()/_USToUKDate()_WinAPI_Create_CTL_CODE()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()Au3 script parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingDirToHTML5FileInstallrFileReadLastChars()GeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()Int_Parse() & Int_TryParse()IsISBN()LockFile()Mapping CtrlIDsOOP in AutoItParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandProtect GlobalsQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...

Updated: 22/04/2018

Link to comment
Share on other sites

I commented out this whole part in the while loop and it seemed to be quite a bit better, effectively removing your ChangeTabs() function. What is the purpose of you watching the tabs change? They change just fine without flicker for me Win 7 x64. There is no issue with tabs working in AutoIt in my experience.

 

$iCurrTab = _GUICtrlTab_GetCurFocus($cTab) ; Check which Tab is active
    If $iCurrTab <> $iLastTab Then ; If the Tab has changed
        Switch $iCurrTab ; Show/Hide controls as required
            Case 0
                ChangeTabs()
            Case Else
                ChangeTabs()
        EndSwitch
        $iLastTab = $iCurrTab ; Store the value for future comparisons
    EndIf
WEnd
Link to comment
Share on other sites

Thanks for the suggestion, I tried it to no avail :(. Removing that whole function did not reduce the flicker either. I suspect it might be due to the sheer volume of controls on the tab....

If I remove that function, I am unable to store listview handles on the active tab in an array, which I then use in WM_NOTIFY to detect clicks/double-clicks on individual listviews and perform further functions based on contents.

The function also serves the purpose of moving the close tab button to the active tab.

 

I commented out this whole part in the while loop and it seemed to be quite a bit better, effectively removing your ChangeTabs() function. What is the purpose of you watching the tabs change? They change just fine without flicker for me Win 7 x64. There is no issue with tabs working in AutoIt in my experience.

 

$iCurrTab = _GUICtrlTab_GetCurFocus($cTab) ; Check which Tab is active
    If $iCurrTab <> $iLastTab Then ; If the Tab has changed
        Switch $iCurrTab ; Show/Hide controls as required
            Case 0
                ChangeTabs()
            Case Else
                ChangeTabs()
        EndSwitch
        $iLastTab = $iCurrTab ; Store the value for future comparisons
    EndIf
WEnd

 

Edited by mpower
Link to comment
Share on other sites

Hi guinness, it is only a couple of tabs - you control the number of tabs by clicking "Add tab" or clicking the close button to delete tabs. 

There's only a handful of controls (~25) mostly labels and just 4 listviews.

 

For the sake of helping, could you strip it back to just a couple of tabs with a few controls, then post that re-producer. 

Link to comment
Share on other sites

  • 2 weeks later...

I do have the same issue, yet it is in scite...open a bunch of tabs - I have 19 different tabs, then change to one of the tabs. Do you see the flicker? Now go back to that tab again, does the flicker go away? It does for me, but if I click on another tab, I get the flicker again, but again going back to that same tab the flicker disappears. So, maybe it is a cache issue...not sure really. But it does not appear to be just your program/script. Maybe there is a way to add your data into memory and then get less flicker? I have done this over and over again in scite, and it is the same response each time. You might have to open all the tabs in scite and then close the app and reopen to get the response that I see. Not sure if this makes you feel any better or not? And I am not the expert on tabs, as I have never really programmed using them, but once, just to see how they work.

All by me:

"Sometimes you have to go back to where you started, to get to where you want to go." 

"Everybody catches up with everyone, eventually" 

"As you teach others, you are really teaching yourself."

From my dad

"Do not worry about yesterday, as the only thing that you can control is tomorrow."

 

WindowsError.gif

WIKI | Tabs; | Arrays; | Strings | Wiki Arrays | How to ask a Question | Forum Search | FAQ | Tutorials | Original FAQ | ONLINE HELP | UDF's Wiki | AutoIt PDF

AutoIt Snippets | Multple Guis | Interrupting a running function | Another Send

StringRegExp | StringRegExp Help | RegEXTester | REG TUTOR | Reg TUTOT 2

AutoItSetOption | Macros | AutoIt Snippets | Wrapper | Autoit  Docs

SCITE | SciteJump | BB | MyTopics | Programming | UDFs | AutoIt 123 | UDFs Form | UDF

Learning to script | Tutorials | Documentation | IE.AU3 | Games? | FreeSoftware | Path_Online | Core Language

Programming Tips

Excel Changes

ControlHover.UDF

GDI_Plus

Draw_On_Screen

GDI Basics

GDI_More_Basics

GDI Rotate

GDI Graph

GDI  CheckExistingItems

GDI Trajectory

Replace $ghGDIPDll with $__g_hGDIPDll

DLL 101?

Array via Object

GDI Swimlane

GDI Plus French 101 Site

GDI Examples UEZ

GDI Basic Clock

GDI Detection

Ternary operator

Link to comment
Share on other sites

I did ask to provide a re-producer, but no one did. So instead I created one myself.

#include <GUIConstantsEx.au3>

Example()

Func Example()
    Local $hGUI = GUICreate('Example by guinness', 500, 500)

    GUICtrlCreateTab(0, 0, 500, 500)
    For $i = 1 To 20
        GUICtrlCreateTabItem('Item_' & $i)
        For $j = 1 To Random(50, 200, 1)
            GUICtrlCreateLabel('Label_' & $j, Random(50, 400, 1), Random(50, 400, 1))
        Next
    Next
    GUICtrlCreateTabItem('')

    GUISetState(@SW_SHOW, $hGUI)

    While 1
        Switch GUIGetMsg()
            Case $GUI_EVENT_CLOSE
                ExitLoop
        EndSwitch
    WEnd

    GUIDelete($hGUI)
EndFunc   ;==>Example

UDF List:

 
_AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_ArrayFilter/_ArrayReduce_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_ConvertLHWebColor()/_ConvertSHWebColor()_DesktopDimensions()_DisplayPassword()_DotNet_Load()/_DotNet_Unload()_Fibonacci()_FileCompare()_FileCompareContents()_FileNameByHandle()_FilePrefix/SRE()_FindInFile()_GetBackgroundColor()/_SetBackgroundColor()_GetConrolID()_GetCtrlClass()_GetDirectoryFormat()_GetDriveMediaType()_GetFilename()/_GetFilenameExt()_GetHardwareID()_GetIP()_GetIP_Country()_GetOSLanguage()_GetSavedSource()_GetStringSize()_GetSystemPaths()_GetURLImage()_GIFImage()_GoogleWeather()_GUICtrlCreateGroup()_GUICtrlListBox_CreateArray()_GUICtrlListView_CreateArray()_GUICtrlListView_SaveCSV()_GUICtrlListView_SaveHTML()_GUICtrlListView_SaveTxt()_GUICtrlListView_SaveXML()_GUICtrlMenu_Recent()_GUICtrlMenu_SetItemImage()_GUICtrlTreeView_CreateArray()_GUIDisable()_GUIImageList_SetIconFromHandle()_GUIRegisterMsg()_GUISetIcon()_Icon_Clear()/_Icon_Set()_IdleTime()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_IsSystemDrive()_IsUPX()_IsValidType()_IsWebColor()_Language()_Log()_MicrosoftInternetConnectivity()_MSDNDataType()_PathFull/GetRelative/Split()_PathSplitEx()_PrintFromArray()_ProgressSetMarquee()_ReDim()_RockPaperScissors()/_RockPaperScissorsLizardSpock()_ScrollingCredits_SelfDelete()_SelfRename()_SelfUpdate()_SendTo()_ShellAll()_ShellFile()_ShellFolder()_SingletonHWID()_SingletonPID()_Startup()_StringCompact()_StringIsValid()_StringRegExpMetaCharacters()_StringReplaceWholeWord()_StringStripChars()_Temperature()_TrialPeriod()_UKToUSDate()/_USToUKDate()_WinAPI_Create_CTL_CODE()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()Au3 script parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingDirToHTML5FileInstallrFileReadLastChars()GeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()Int_Parse() & Int_TryParse()IsISBN()LockFile()Mapping CtrlIDsOOP in AutoItParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandProtect GlobalsQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...

Updated: 22/04/2018

Link to comment
Share on other sites

  • Moderators

teateaismyname,

Please post the code you are using - it helps us to see exectly what problem you are having. When you post code please use Code tags - see here how to do it. :)

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

See post #17 for an example of re-producible code. As providing one line doesn't really give us much idea of the rest.

Edited by guinness

UDF List:

 
_AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_ArrayFilter/_ArrayReduce_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_ConvertLHWebColor()/_ConvertSHWebColor()_DesktopDimensions()_DisplayPassword()_DotNet_Load()/_DotNet_Unload()_Fibonacci()_FileCompare()_FileCompareContents()_FileNameByHandle()_FilePrefix/SRE()_FindInFile()_GetBackgroundColor()/_SetBackgroundColor()_GetConrolID()_GetCtrlClass()_GetDirectoryFormat()_GetDriveMediaType()_GetFilename()/_GetFilenameExt()_GetHardwareID()_GetIP()_GetIP_Country()_GetOSLanguage()_GetSavedSource()_GetStringSize()_GetSystemPaths()_GetURLImage()_GIFImage()_GoogleWeather()_GUICtrlCreateGroup()_GUICtrlListBox_CreateArray()_GUICtrlListView_CreateArray()_GUICtrlListView_SaveCSV()_GUICtrlListView_SaveHTML()_GUICtrlListView_SaveTxt()_GUICtrlListView_SaveXML()_GUICtrlMenu_Recent()_GUICtrlMenu_SetItemImage()_GUICtrlTreeView_CreateArray()_GUIDisable()_GUIImageList_SetIconFromHandle()_GUIRegisterMsg()_GUISetIcon()_Icon_Clear()/_Icon_Set()_IdleTime()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_IsSystemDrive()_IsUPX()_IsValidType()_IsWebColor()_Language()_Log()_MicrosoftInternetConnectivity()_MSDNDataType()_PathFull/GetRelative/Split()_PathSplitEx()_PrintFromArray()_ProgressSetMarquee()_ReDim()_RockPaperScissors()/_RockPaperScissorsLizardSpock()_ScrollingCredits_SelfDelete()_SelfRename()_SelfUpdate()_SendTo()_ShellAll()_ShellFile()_ShellFolder()_SingletonHWID()_SingletonPID()_Startup()_StringCompact()_StringIsValid()_StringRegExpMetaCharacters()_StringReplaceWholeWord()_StringStripChars()_Temperature()_TrialPeriod()_UKToUSDate()/_USToUKDate()_WinAPI_Create_CTL_CODE()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()Au3 script parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingDirToHTML5FileInstallrFileReadLastChars()GeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()Int_Parse() & Int_TryParse()IsISBN()LockFile()Mapping CtrlIDsOOP in AutoItParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandProtect GlobalsQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...

Updated: 22/04/2018

Link to comment
Share on other sites

  • Moderators

teateaismyname,

This is a real SWAG* with so little information to go on, but if a label flickers when updating it is usually because you are updating it too often. What you need to do is check if the label needs updating before you do it:

If GUICtrlRead($lable2) <> $count Then
    GUICtrlSetData($lable2, $count)
EndIf

Does that solve your problem? :)

M23

* SWAG - Scientific Wild Ass Guess, better than a straight WAG, but not by much! ;)

Edited by Melba23
Typo

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...