Jump to content

Blinking Menuitem when pressing tab


Rodger
 Share

Recommended Posts

Hello,

I have the following code:

#include <GuiEdit.au3>

#include <GuiTab.au3>

#include <GUIComboBox.au3>

#include <WindowsConstants.au3>

#include <GUIConstants.au3>

#include <GUIConstantsEx.au3>

#Include <ScrollBarConstants.au3>

Local $GUI_PCM, $msg, $aParts[6] = [165, 635, 795 , 935 ,1050, -1]

$Version = "1.0"

$Build = "18-06-2010:01"

$GUI_PCM = GUICreate("ProcessControl Manager",1235,650,-1,-1,$WS_OVERLAPPEDWINDOW +$WS_CLIPCHILDREN + $WS_CLIPSIBLINGS)

GUISetStyle(BitOR($WS_MINIMIZEBOX, $WS_MAXIMIZEBOX, $WS_CAPTION, $WS_SIZEBOX, $WS_POPUP, $WS_SYSMENU))

; The Menu

; Menustructure "File"

$PCMFileMenu = GuiCtrlCreateMenu ("File")

$PCMFileMenuItem1 = GuiCtrlCreateMenuitem ("Close",$PCMFileMenu)

; Menustructure "Help"

$PCMHelpMenu = GuiCtrlCreateMenu ("Help")

$PCMHelpMenuMenuItem1 = GuiCtrlCreateMenuitem ("Info",$PCMHelpMenu)

; Process Scheduler ChildTabs

$ProcessSchedulerChildGui = GUICreate("",1205,455,15,75,BitOr($WS_CHILD,$WS_TABSTOP),-1,$GUI_PCM)

GUISetBkColor(0x257788); just for dimensing the child

$ProcessSchedulerChildTab = GUICtrlCreateTab(0,0,1205,455)

$ProcessSchedulerChildTabItemPS1 = GUICtrlCreateTabItem("PS1")

$ProcessSchedulerChildTabItemPS2 = GUICtrlCreateTabItem("PS2")

GUICtrlCreateTabItem("")

; This Child is initially shown

GUISetState()

; Process Monitoring ChildTabs

$ProcessMonitoringChildGui = GUICreate("",1205,455,15,75,BitOr($WS_CHILD,$WS_TABSTOP),-1,$GUI_PCM)

GUISetBkColor(0x257788); just for dimensing the child

$ProcessMonitoringChildTab = GUICtrlCreateTab(0,0,1205,455)

$ProcessMonitoringChildTabItemPM1 = GUICtrlCreateTabItem("PM1")

$ProcessMonitoringChildTabItemPM2 = GUICtrlCreateTabItem("PM2")

GUICtrlCreateTabItem("")

; The StatusBar

$hStatus = _GUICtrlStatusBar_Create ($GUI_PCM)

_GUICtrlStatusBar_SetParts ($hStatus, $aParts,-1)

_GUICtrlStatusBar_SetText ($hStatus,"Versie: " & $Version & " - Build: " & $Build,5)

;GUIRegisterMsg($WM_SIZE, "WM_SIZE")

GUISwitch($GUI_PCM)

; ParentTab

$ParentTab = GUICtrlCreateTab(10, 50, 1215, 485)

$ParentTabItemProcessScheduler = GUICtrlCreateTabItem("Process Scheduler")

$ParentTabItemProcessMonitoring = GUICtrlCreateTabItem("Process Monitoring")

GUICtrlCreateTabItem("")

GUISetState()

; Run the GUI until the dialog is closed

$msg = 0

While 1

$msg = GUIGetMsg()

Select

Case $msg = $PCMFileMenuItem1

GUIDelete($GUI_PCM)

Exit

Case $msg = $PCMHelpMenuMenuItem1

Case $msg = $ParentTab

$TabIndex = GUICtrlRead($ParentTab)

Select

Case $TabIndex = 0

GUISetState(@SW_HIDE, $ProcessMonitoringChildGui)

GUISetState(@SW_SHOW, $ProcessSchedulerChildGui)

Case $TabIndex = 1

GUISetState(@SW_HIDE, $ProcessSchedulerChildGui)

GUISetState(@SW_SHOW, $ProcessMonitoringChildGui)

EndSelect

Case $msg = $GUI_EVENT_CLOSE

GUIDelete($GUI_PCM)

Exit

EndSelect

WEnd

; Resize the EditBox and status bar when GUI size changes

Func WM_SIZE($hWnd, $iMsg, $iwParam, $ilParam)

_GUICtrlStatusBar_Resize ($hStatus)

Return $GUI_RUNDEFMSG

EndFunc ;==>WM_SIZE

Everytime I press one of the main Tabs, the menu-item "File" is blinking. How can I stop this blinking?

Thanks,

Rodger

Edited by Rodger
Link to comment
Share on other sites

Please use autoit tag for post your code !

I have found a way without blink :

Select
                Case $TabIndex = 0
                    GUISetState(@SW_HIDE, $ProcessMonitoringChildGui)
                    Sleep ( 250 )
                    GUISetState(@SW_SHOW, $ProcessSchedulerChildGui)
                Case $TabIndex = 1
                    GUISetState(@SW_HIDE, $ProcessSchedulerChildGui)
                    Sleep ( 250 )
                    GUISetState(@SW_SHOW, $ProcessMonitoringChildGui)
            EndSelect

a little Sleep ( 250 ) between states changes ! Posted Image

AutoIt 3.3.14.2 X86 - SciTE 3.6.0WIN 8.1 X64 - Other Example Scripts

Link to comment
Share on other sites

This seems to work for me:

;~      Case $ParentTab
;~          $TabIndex = GUICtrlRead($ParentTab)

;~          Switch $TabIndex
;~              Case 0
;~                  GUISetState(@SW_SHOW, $ProcessSchedulerChildGui)

;~              Case 1
;~                  GUISetState(@SW_SHOW, $ProcessMonitoringChildGui)
;~          EndSwitch
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...