Jump to content

Icons on tabs?


SlowCoder74
 Share

Recommended Posts

Yes

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiTab.au3>
#include <WinAPI.au3>
#include <GuiImageList.au3>

Opt('MustDeclareVars', 1)

$Debug_TAB = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
    Local $hGUI, $hImage, $hTab

    ; Create GUI
    $hGUI = GUICreate("Tab Control Set Image List", 400, 300)
    $hTab = GUICtrlCreateTab(2, 2, 396, 296)
    GUISetState()

    ; Create images
    $hImage = _GUIImageList_Create()
    _GUIImageList_Add($hImage,     _GUIImageList_AddIcon($hImage, @SystemDir & "\shell32.dll", 145,True))
    _GUIImageList_Add($hImage,     _GUIImageList_AddIcon($hImage, @SystemDir & "\shell32.dll", 60,True))
    _GUIImageList_Add($hImage,     _GUIImageList_AddIcon($hImage, @SystemDir & "\shell32.dll", 46,True))
    _GUICtrlTab_SetImageList($hTab, $hImage)

    ; Add tabs
    _GUICtrlTab_InsertItem($hTab, 0, "Tab 1", 0)
    _GUICtrlTab_InsertItem($hTab, 1, "Tab 2", 1)
    _GUICtrlTab_InsertItem($hTab, 2, "Tab 3", 2)

    ; Show image list handle
    MsgBox(4160, "Information", "Image list handle: 0x" & Hex(_GUICtrlTab_GetImageList($hTab)))

    ; Loop until user exits
    Do
    Until GUIGetMsg() = $GUI_EVENT_CLOSE
    GUIDelete()
EndFunc   ;==>_Main

Link to comment
Share on other sites

#include <GUIConstantsEx.au3>
#include <TabConstants.au3>

Local $tab, $iCombo, $msg, $Gui

$Gui = GUICreate("- (Tab) - GUI")

GUISetBkColor(0xB4E1D3)
GUISetFont(9, 300)

$tab = GUICtrlCreateTab(10, 10, 380, 200)

GUICtrlCreateTabItem("Path")
GUICtrlSetImage(-1, "shell32.dll", -4, 0)
GUICtrlCreateLabel("Path", 40, 43, 270, 17)
GUICtrlCreateButton("OK", 314, 60, 46, 25)
GUICtrlCreateInput("C:\WINDOWS\system32", 40, 60, 275, 25)

GUICtrlCreateTabItem("Style")
GUICtrlSetImage(-1, "shell32.dll", -6, 0)
GUICtrlSetState(-1, $GUI_SHOW)
GUICtrlCreateLabel("Sel. Style", 20, 54, 250, 17)
$iCombo = GUICtrlCreateCombo("", 20, 70, 310, 120)
GUICtrlSetData(-1, "$GUI_SS_DEFAULT_TAB|$TCS_FIXEDWIDTH|$TCS_FIXEDWIDTH+$TCS_FORCEICONLEFT|$TCS_FIXEDWIDTH+$TCS_FORCELABELLEFT|$TCS_BOTTOM", "$GUI_SS_DEFAULT_TAB")

GUICtrlCreateTabItem("?")
GUICtrlSetImage(-1, "shell32.dll", -222, 0)
GUICtrlCreateLabel("Des", 20, 40, 120, 17)
GUICtrlCreateButton("OK", 300, 150, 70, 30)

GUICtrlCreateTabItem("")

GUICtrlCreateLabel('$TCS_MULTILINE - ' & @CRLF & '$TCS_BUTTONS - ' & @CRLF & '$TCS_FLATBUTTONS+$TCS_BUTTONS - ', 20, 230, 370, 100)

GUISetState()

While 1
    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            ExitLoop
        Case $tab
            ; отображает кликнутую вкладку
            WinSetTitle($Gui, "", "- (Tab) - GUI, - " & GUICtrlRead($tab))
        Case $iCombo
            GUICtrlSetStyle($tab, BitOR($GUI_SS_DEFAULT_TAB, Execute(GUICtrlRead($iCombo))))
    EndSwitch
WEnd

Link to comment
Share on other sites

#include <GUIConstantsEx.au3>
#include <TabConstants.au3>

Local $tab, $iCombo, $msg, $Gui

$Gui = GUICreate("- (Tab) - GUI")

GUISetBkColor(0xB4E1D3)
GUISetFont(9, 300)

$tab = GUICtrlCreateTab(10, 10, 380, 200)

GUICtrlCreateTabItem("Path")
GUICtrlSetImage(-1, "shell32.dll", -4, 0)
GUICtrlCreateLabel("Path", 40, 43, 270, 17)
GUICtrlCreateButton("OK", 314, 60, 46, 25)
GUICtrlCreateInput("C:\WINDOWS\system32", 40, 60, 275, 25)

GUICtrlCreateTabItem("Style")
GUICtrlSetImage(-1, "shell32.dll", -6, 0)
GUICtrlSetState(-1, $GUI_SHOW)
GUICtrlCreateLabel("Sel. Style", 20, 54, 250, 17)
$iCombo = GUICtrlCreateCombo("", 20, 70, 310, 120)
GUICtrlSetData(-1, "$GUI_SS_DEFAULT_TAB|$TCS_FIXEDWIDTH|$TCS_FIXEDWIDTH+$TCS_FORCEICONLEFT|$TCS_FIXEDWIDTH+$TCS_FORCELABELLEFT|$TCS_BOTTOM", "$GUI_SS_DEFAULT_TAB")

GUICtrlCreateTabItem("?")
GUICtrlSetImage(-1, "shell32.dll", -222, 0)
GUICtrlCreateLabel("Des", 20, 40, 120, 17)
GUICtrlCreateButton("OK", 300, 150, 70, 30)

GUICtrlCreateTabItem("")

GUICtrlCreateLabel('$TCS_MULTILINE - ' & @CRLF & '$TCS_BUTTONS - ' & @CRLF & '$TCS_FLATBUTTONS+$TCS_BUTTONS - ', 20, 230, 370, 100)

GUISetState()

While 1
    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            ExitLoop
        Case $tab
            ; отображает кликнутую вкладку
            WinSetTitle($Gui, "", "- (Tab) - GUI, - " & GUICtrlRead($tab))
        Case $iCombo
            GUICtrlSetStyle($tab, BitOR($GUI_SS_DEFAULT_TAB, Execute(GUICtrlRead($iCombo))))
    EndSwitch
WEnd

This was the solution. Thank you!
Link to comment
Share on other sites

Nice example AZJIO. I like the dynamic changing of the tab style.

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

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