SlowCoder74 Posted December 28, 2012 Share Posted December 28, 2012 Is there any way to display an icon for each tab sheet of a tab control, along with the tab sheet title? Link to comment Share on other sites More sharing options...
AutoBert Posted December 28, 2012 Share Posted December 28, 2012 Yes expandcollapse popup#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 More sharing options...
AZJIO Posted December 28, 2012 Share Posted December 28, 2012 expandcollapse popup#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 SlowCoder74 and meoit 2 My other projects or all Link to comment Share on other sites More sharing options...
SlowCoder74 Posted December 29, 2012 Author Share Posted December 29, 2012 expandcollapse popup#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 More sharing options...
guinness Posted December 29, 2012 Share Posted December 29, 2012 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 parsing • AutoIt Search • AutoIt3 Portable • AutoIt3WrapperToPragma • AutoItWinGetTitle()/AutoItWinSetTitle() • Coding • DirToHTML5 • FileInstallr • FileReadLastChars() • GeoIP database • GUI - Only Close Button • GUI Examples • GUICtrlDeleteImage() • GUICtrlGetBkColor() • GUICtrlGetStyle() • GUIEvents • GUIGetBkColor() • Int_Parse() & Int_TryParse() • IsISBN() • LockFile() • Mapping CtrlIDs • OOP in AutoIt • ParseHeadersToSciTE() • PasswordValid • PasteBin • Posts Per Day • PreExpand • Protect Globals • Queue() • Resource Update • ResourcesEx • SciTE Jump • Settings INI • SHELLHOOK • Shunting-Yard • Signature Creator • Stack() • Stopwatch() • StringAddLF()/StringStripLF() • StringEOLToCRLF() • VSCROLL • WM_COPYDATA • More Examples... Updated: 22/04/2018 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