Jump to content

Simple Tab skin


Yashied
 Share

Recommended Posts

I can't switch to another tabsheet when "GUIOnEventMode" is ON

If I turn off it will work but I can't capture event on button click, can any1 help?

This is because you're mixing GUIGetMsg (which Yashied uses) and EventMode. You should only use one and not both. I suggest you familiarise yourself with these modes and look at the help file for more details.

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

This is because you're mixing GUIGetMsg (which Yashied uses) and EventMode. You should only use one and not both. I suggest you familiarise yourself with these modes and look at the help file for more details.

Thanks for your fast reply.

I just look at the Help file and I forget this line:

"If the GUIOnEventMode option is set to 1 then the return from GUIGetMsg is always 0 and the @error is set to 1."

Problem solved!

Link to comment
Share on other sites

  • 7 months later...

Hi, I've got a question : why the tabs are disabled?

While 1

$Info = GUIGetCursorInfo()
    If @error Then
        If $Over <> -1 Then
            GUICtrlSetImage($Pic[$Over], @ScriptDir & '\img_black.bmp')
        EndIf
        $Over = -1
    Else
        $Index = _Index($Info[4])
        If $Index <> $Over Then
            If $Over <> -1 Then
                GUICtrlSetImage($Pic[$Over], @ScriptDir & '\img_black.bmp')
            EndIf
            If ($Index <> -1) And ($Index <> $Item) Then
                GUICtrlSetImage($Pic[$Index], @ScriptDir & '\img_over.bmp')
                $Over = $Index
            Else
                $Over = -1
            EndIf
        EndIf
EndIf

    $aMsg = GUIGetMsg(1)
    If $Item = -1 Then
        $Msg = $Pic[0]
        $Item = 1
    EndIf
    Switch $aMsg[1]
        Case $hGUI1
            Switch $aMsg[0]
                Case 0
                    ContinueLoop
                Case $GUI_EVENT_CLOSE
                    ExitLoop
                Case $Pic[0] To $Pic[UBound($Pic) - 1]
                    If $Msg <> $Pic[$Item] Then
                        GUICtrlSetImage($Pic[$Item], @ScriptDir & '\img_black.bmp')
                        GUICtrlSetColor($Pic[$Item] + 1, 0xFFFFFF)
                        GUICtrlSetImage($Msg, @ScriptDir & '\img_white.bmp')
                        GUICtrlSetColor($Msg + 1, 0x313A42)
                        $Item = _Index($Msg)
                        GUICtrlSendMsg($Tab, $TCM_SETCURFOCUS, $Item, 0)
                        $Over = -1
                    EndIf
                Case $button_descr
                    GUICtrlSetState($button_descr, $GUI_DISABLE)
                    opisanie()
            EndSwitch
        Case $hGUI2
            Switch $aMsg[0]
                Case $GUI_EVENT_CLOSE
                    GUIDelete($hGUI2)
                    GUICtrlSetState($button_descr, $GUI_ENABLE)
                Case $book_16
                    MsgBox(0, "", "test")
            EndSwitch
    EndSwitch
WEnd

The function "opisanie" calls another GUI.

Edited by hiho
Link to comment
Share on other sites

  • 7 years later...

Why can't I change the tab names? I tried removing the for loop but no tabs will show on the GUI

#Include <Constants.au3>
#Include <GUIConstantsEx.au3>
#Include <StaticConstants.au3>
#Include <TabConstants.au3>
#Include <WindowsConstants.au3>

Dim $Pic[5]

$Form1 = GUICreate("MyGUI", 705, 369, 645, 124, BitOR($GUI_SS_DEFAULT_GUI, $WS_MAXIMIZEBOX, $WS_SIZEBOX, $WS_THICKFRAME, $WS_TABSTOP))
GUISetBkColor(0xFFFFFF)
GUICtrlCreatePic('img_bg.bmp', 0, 0, 705, 369)
GUICtrlSetResizing(-1, $GUI_DOCKLEFT+$GUI_DOCKRIGHT+$GUI_DOCKTOP+$GUI_DOCKBOTTOM)
GUICtrlSetState(-1, $GUI_DISABLE)

For $i = 0 To 4
    $Pic[$i] = GUICtrlCreatePic(@ScriptDir & '\img_black.bmp', 10, 24 + 50 * $i, 162, 49)
    GUICtrlCreateLabel('Tabsheet' & $i, 21, 40 + 50 * $i, 140, 18, $SS_CENTER)
    GUICtrlSetFont(-1, 11, 400, 0, 'Tahoma')
    GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
    GUICtrlSetcolor(-1, 0xFFFFFF)
Next

$Tab = GUICtrlCreateTab(172 + 4, 10 + 4, 523 - 8, 349 - 8)
GUICtrlSetState(-1, $GUI_DISABLE)
GUICtrlCreateTabItem('Dashboard')
GUICtrlCreateEdit('', 190, 28, 487, 313)
GUICtrlCreateTabItem('Workforce')
GUICtrlCreateButton('OK', 398, 319, 70, 23)
GUICtrlCreateTabItem('Tabsheet2')
GUICtrlCreateTabItem('Tabsheet3')
GUICtrlCreateTabItem('Tabsheet4')
GUICtrlCreateTabItem('')

GUISetState()

$Item = -1
$Over = -1

While 1
    $Info = GUIGetCursorInfo()
    If @error Then
        If $Over <> -1 Then
            GUICtrlSetImage($Pic[$Over], @ScriptDir & '\img_black.bmp')
        EndIf
        $Over = -1
    Else
        $Index = _Index($Info[4])
        If $Index <> $Over Then
            If $Over <> -1 Then
                GUICtrlSetImage($Pic[$Over], @ScriptDir & '\img_black.bmp')
            EndIf
            If ($Index <> -1) And ($Index <> $Item) Then
                GUICtrlSetImage($Pic[$Index], @ScriptDir & '\img_over.bmp')
                $Over = $Index
            Else
                $Over = -1
            EndIf
        EndIf
    EndIf
    $Msg = GUIGetMsg()
    If $Item = -1 Then
        $Msg = $Pic[0]
        $Item = 1
    EndIf
    Switch $Msg
        Case 0
            ContinueLoop
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Pic[0] To $Pic[UBound($Pic) - 1]
            If $Msg <> $Pic[$Item] Then
                GUICtrlSetImage($Pic[$Item], @ScriptDir & '\img_black.bmp')
                GUICtrlSetcolor($Pic[$Item] + 1, 0xFFFFFF)
                GUICtrlSetImage($Msg, @ScriptDir & '\img_white.bmp')
                GUICtrlSetcolor($Msg + 1, 0x313A42)
                $Item = _Index($Msg)
                GUICtrlSendMsg($Tab, $TCM_SETCURFOCUS, $Item, 0)
                $Over = -1
            EndIf
    EndSwitch
WEnd

Func _Index($CtrlID)
    For $i = 0 To UBound($Pic) - 1
        If ($CtrlID = $Pic[$i]) Or ($CtrlID = $Pic[$i] + 1) Then
            Return $i
        EndIf
    Next
    Return -1
EndFunc   ;==>_Index

 

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...