Jump to content

Simple Tab skin


Yashied
 Share

Recommended Posts

This is just an example. Do with it what you want...

 

post_img_068.png

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

Dim $Pic[5]

GUICreate('MyGUI', 705, 369)
GUISetBkColor(0xFFFFFF)
GUICtrlCreatePic('img_bg.bmp', 0, 0, 705, 369)
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('Tabsheet0')
GUICtrlCreateEdit('', 190, 28, 487, 313)
GUICtrlCreateTabItem('Tabsheet1')
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

TabSkin.zip

Previous downloads: 774

TabSkin.zip

Edited by Yashied
Link to comment
Share on other sites

Very nice! I like it!

Programming today is a race between software engineers striving to
build bigger and better idiot-proof programs, and the Universe
trying to produce bigger and better idiots.
So far, the Universe is winning.

Link to comment
Share on other sites

I get the same as Yashied, seems your images aren't loading. :x You did download the ZIP File?

How could it have been so simple. Brilliant Example!

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

an example with horizontal tab?

You'd have to change the img_bg.bmp to show a horizontal layout and then perhaps the tab images too.

In the code you're looking for the For.. Next loop

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

Just change the X,Y coordinates and you're on your way!

James

Link to comment
Share on other sites

  • 6 months later...

For $i = 0 To 4
    $Pic[$i] = GUICtrlCreatePic(@ScriptDir & '\img_black.bmp', 10 + 50 * $i, 24 , 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

Hi sorry to be a pain

ive tried to change the X and Y and it doesnt seem to get me anywhere. Could you direct me more as to where im going wrong please?

thank you

Drunken Frat-Boy Monkey Garbage

Link to comment
Share on other sites

Yes... I am having problems too. I changed it to work with GIFs, and also changed it so it is similar to the tabs in Firefox. Then I implemented extended glass and now when I click the tabs, nothing happens, and when I hover over the second tab, nothing happens then either. Also happened to the backup script, which, was the one Yashied made.

What problem are you getting?

EDIT

Ok, I downloaded the tabskin file again and implemented your for script. The problem that you are having, is that you are making them too wide, but you are not spacing them that wide apart. Also, you have not moved the labels. Once that is done, you would want to resize the editbox. But I will go right ahead and do that for you. And if you wanted them on top, wait a few days (surely not much longer any more), as I am making a script which has extended title transparency (which you can comment out if you are using XP), horizontal tabs on top, and a file menu. My aim is to get it to look alike the ribbon from office 2010. Anyway, here is your code:

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

Dim $Pic[5]

GUICreate('MyGUI', 705, 369)
GUISetBkColor(0xFFFFFF)
GUICtrlCreatePic('img_bg.bmp', 0, 0, 705, 369)
GUICtrlSetState(-1, $GUI_DISABLE)

For $i = 0 To 4
    $Pic[$i] = GUICtrlCreatePic(@ScriptDir & '\img_black.bmp', 190 + 50 * $i, 20 , 50, 20)
    GUICtrlCreateLabel('Tab ' & $i, 190+50*$i, 21 , 50, 20, $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('Tabsheet0')
GUICtrlCreateEdit('', 190, 48, 487, 293)
GUICtrlCreateTabItem('Tabsheet1')
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

That is the whole file. I hope that is what you were trying to achieve. If not, then please let up know, maybe whip up a quick image in paint showing us the positionings and all of that sort of stuff, and I am sure everyone will be happy to help.

Edited by Mikeman27294
Link to comment
Share on other sites

Ok, here is my little problem. (I hope you dont mind me placing it here? Otherwise, just PM me or something and ask me to delete it and I will). With my program, I am trying to get a ribbon alike interface working. I have a file tab, but that is not created in the for loop, as it is not going to have the same image. The problem is, that when I am in the file tab, I cannot select the edit tab. The script also will not change the image of the file button on hover from the home tab, and does not appear to change when I enter the file menu. As for the buttons in each tab, dont mind them, they are just so that I can focus on the ribbon when I am changing tabs, and will see it move without needing to focus on it. Also, dont worry about the tab control, I have found that that part still works perfectly fine, even when the GUI Controls are outside it and it is outside the window. Here is the code.

#Region###STARTUP###
#include <Array.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <TabConstants.au3>
Local $Struct = DllStructCreate("int cxLeftWidth;int cxRightWidth;int cyTopHeight;int cyBottomHeight;")
Local $sStruct = DllStructCreate("dword;int;ptr;int")
Local $MyArea[4] = [0, 0, 31, 0]
Local $devyesno = MsgBox(4,Default,"Press yes to enable the Design tab, or no to disable it.")
Local $Filehover
If $devyesno = 6 Then
    Global $Tabnums=5
Else
    Global $Tabnums=4
EndIf
Dim $Pic[$Tabnums]
If $Tabnums=5 Then
    Dim $TabText[5]
    $TabText[4] = "Design"
    $TabText[3] = "Program"
    $TabText[2] = "View"
    $TabText[1] = "Edit"
    $TabText[0] = "Home"
ElseIf $Tabnums=4 Then
    Dim $TabText[4]
    $TabText[3] = "Program"
    $TabText[2] = "View"
    $TabText[1] = "Edit"
    $TabText[0] = "Home"
EndIf
$hGUI=GUICreate('MyGUI', 705, 369, 100, 100)
_Vista_ApplyGlassArea($hGUI)
Global $Winpos=WinGetPos("MyGUI")
Global $GlassArea = GUICtrlCreateLabel("", (UBound($Pic)+1)*90, 0, $Winpos[2]-(UBound($Pic)+1)*90, 32) ;area that will be filled with glass
GUICtrlSetBkColor(-1, 0x000000)
Global $DarkGreyArea = GUICtrlCreateGraphic(0, (UBound($Pic)+1)*90, $Winpos[2]-(UBound($Pic)+1)*90, 32) ;work area (to add controls in)
GUICtrlSetBkColor(-1, 0xC5C5C5) ;with light grey area
#region
$File=GUICtrlCreatePic(@ScriptDir & '\tab_filedefault.bmp', 0, 0, 90, 29)
GUICtrlCreateLabel("File", 0, 7, 90, 29, $SS_CENTER)
GUICtrlSetFont(-1, 11, 400, 0, 'Tahoma')
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
GUICtrlSetcolor(-1, 0xFFFFFF)
#EndRegion
For $i = 0 To $Tabnums-1
    $Pic[$i] = GUICtrlCreatePic(@ScriptDir & '\tab_default.bmp', 90*($i+1), 0, 90, 29)
    GUICtrlCreateLabel($TabText[$i], 90*($i+1), 7, 90, 29, $SS_CENTER)
    GUICtrlSetFont(-1, 11, 400, 0, 'Tahoma')
    GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
    GUICtrlSetcolor(-1, 0x000000)
Next
$Tab = GUICtrlCreateTab(-@DesktopWidth, -@DesktopHeight, 0, 0)
GUICtrlSetState(-1, $GUI_DISABLE)
GUICtrlCreateTabItem('File')
GUICtrlCreateButton('File', 290, 319, 70, 23)
GUICtrlCreateTabItem('Home')
GUICtrlCreateButton('Home', 300, 319, 70, 23)
GUICtrlCreateTabItem('Edit')
GUICtrlCreateButton('Edit', 310, 319, 70, 23)
GUICtrlCreateTabItem('View')
GUICtrlCreateButton('View', 320, 319, 70, 23)
GUICtrlCreateTabItem('Program')
GUICtrlCreateButton('Program', 340, 319, 70, 23)
GUICtrlCreateTabItem('Design')
GUICtrlCreateButton('Design', 350, 319, 70, 23)
GUICtrlCreateTabItem('')
GUISetState()
$Item = -1
$Over = -1
#EndRegion###STARTUP###
While 1
    $Info = GUIGetCursorInfo()
    If @error Then
        If $Over <> -1 Then
            GUICtrlSetImage($Pic[$Over], @ScriptDir & '\tab_default.bmp')
            GUICtrlSetImage($File, @ScriptDir & '\tab_filedefault.bmp')
            $Filehover=0
        EndIf
        GUICtrlSetImage($File, @ScriptDir & '\tab_filedefault.bmp')
        $Filehover=0
        $Over = -1
    Else
        $Index = _Index($Info[4])
        If $Index <> $Over Then
            If $Over <> -1 Then
                GUICtrlSetImage($Pic[$Over], @ScriptDir & '\tab_default.bmp')
                GUICtrlSetImage($File, @ScriptDir & '\tab_filedefault.bmp')
                $Filehover=0
            EndIf
            If ($Index <> -1) And ($Index <> $Item) Then
                GUICtrlSetImage($File, @ScriptDir & '\tab_filedefault.bmp')
                GUICtrlSetImage($Pic[$Index], @ScriptDir & '\tab_hover.bmp')
                $Over = $Index
                $Filehover=0
            Else
                GUICtrlSetImage($File, @ScriptDir & '\tab_filedefault.bmp')
                $Filehover=0
                $Over = -1
            EndIf
            If $Info[4]=6 or $Info[4]=5 And $Filehover=0 Then
                GUICtrlSetImage($File, @ScriptDir & '\tab_filehover.bmp')
                $Filehover=1
            EndIf
        EndIf
    EndIf
    $Msg = GUIGetMsg()
    If $Item = -1 Then
        $Msg = $Pic[0]
        $Item = 1
    EndIf
    Switch $Msg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Pic[0] To $Pic[UBound($Pic) - 1]
            If $Msg <> $Pic[$Item] Then
                GUICtrlSetImage($Pic[$Item], @ScriptDir & '\tab_default.bmp')
                GUICtrlSetImage($Msg, @ScriptDir & '\tab_filedefault.bmp')
                GUICtrlSetImage($Msg, @ScriptDir & '\tab_selected.bmp')
                $Item = _Index($Msg)
                GUICtrlSendMsg($Tab, $TCM_SETCURFOCUS, $Item+1, 0)
                $Over = -1
            EndIf
        Case $File
            GUICtrlSetImage($Pic[$Item], @ScriptDir & '\tab_default.bmp')
            GUICtrlSetImage($Msg, @ScriptDir & '\tab_fileselected.bmp')
            GUICtrlSendMsg($Tab, $TCM_SETCURFOCUS, 0, 0)
            $Filehover=2
            $Item=1
        Case $GlassArea
            dllcall("user32.dll","int","SendMessage","hWnd", $hGUI,"int",0xA1,"int", 2,"int", 0)
    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
Func _Vista_ApplyGlassArea($hWND=$hGUI, $Area=$MyArea, $bColor = 0x000000)
    If @OSVersion <> "WIN_VISTA" And @OSVersion <> "WIN_7" Then
        MsgBox(16, "_Vista_ApplyGlass", "You are not running Vista!")
        Exit
    Else
        If _Vista_ICE() Then
            If IsArray($Area) Then
                DllStructSetData($Struct, "cxLeftWidth", $Area[0])
                DllStructSetData($Struct, "cxRightWidth", $Area[1])
                DllStructSetData($Struct, "cyTopHeight", $Area[2])
                DllStructSetData($Struct, "cyBottomHeight", $Area[3])
                GUISetBkColor($bColor); Must be here!
                $Ret = DllCall("dwmapi.dll", "long*", "DwmExtendFrameIntoClientArea", "hwnd", $hWnd, "ptr", DllStructGetPtr($Struct))
                If @error Then
                    Return 0
                Else
                    Return $Ret
                EndIf
            Else
                    MsgBox(16, "_Vista_ApplyGlassArea", "Area specified is not an array!")
            EndIf
        Else
            MsgBox(0, "DWM Not Enabled", "DWM is not enabled!")
        EndIf
    EndIf
EndFunc ;==>_Vista_ApplyGlassArea
 Func _Vista_ICE()
    $ICEStruct = DllStructCreate("int;")
    $Ret = DllCall("dwmapi.dll", "int", "DwmIsCompositionEnabled", "ptr", DllStructGetPtr($ICEStruct))
    If @error Then
        Return 0
    Else
        Return DllStructGetData($ICEStruct, 1)
    EndIf
 EndFunc ;==>_Vista_ICE

Does anybody see a problem there? Anything and I would be greatful.

Also, this uses aero glass so will not run on XP. If you want to run it on XP, you will have to comment out lines:6 to 8,32 to 37, and 141 onwards. (Although it would be interesting to see what would happen on an XP machine... maybe I will download XP mode just to take a look :))

Thanks.

Edited by Mikeman27294
Link to comment
Share on other sites

  • 2 weeks later...

Hi Mikeman

thanks thats a great start to what i want to achieve. i want it larger lol, basically like the original example but with the tabs on the top (hope im making snese) but its a great example fo rme to start playing with now

thanks

jamie

Yes... I am having problems too. I changed it to work with GIFs, and also changed it so it is similar to the tabs in Firefox. Then I implemented extended glass and now when I click the tabs, nothing happens, and when I hover over the second tab, nothing happens then either. Also happened to the backup script, which, was the one Yashied made.

What problem are you getting?

EDIT

Ok, I downloaded the tabskin file again and implemented your for script. The problem that you are having, is that you are making them too wide, but you are not spacing them that wide apart. Also, you have not moved the labels. Once that is done, you would want to resize the editbox. But I will go right ahead and do that for you. And if you wanted them on top, wait a few days (surely not much longer any more), as I am making a script which has extended title transparency (which you can comment out if you are using XP), horizontal tabs on top, and a file menu. My aim is to get it to look alike the ribbon from office 2010. Anyway, here is your code:

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

Dim $Pic[5]

GUICreate('MyGUI', 705, 369)
GUISetBkColor(0xFFFFFF)
GUICtrlCreatePic('img_bg.bmp', 0, 0, 705, 369)
GUICtrlSetState(-1, $GUI_DISABLE)

For $i = 0 To 4
    $Pic[$i] = GUICtrlCreatePic(@ScriptDir & '\img_black.bmp', 190 + 50 * $i, 20 , 50, 20)
    GUICtrlCreateLabel('Tab ' & $i, 190+50*$i, 21 , 50, 20, $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('Tabsheet0')
GUICtrlCreateEdit('', 190, 48, 487, 293)
GUICtrlCreateTabItem('Tabsheet1')
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

That is the whole file. I hope that is what you were trying to achieve. If not, then please let up know, maybe whip up a quick image in paint showing us the positionings and all of that sort of stuff, and I am sure everyone will be happy to help.

Drunken Frat-Boy Monkey Garbage

Link to comment
Share on other sites

  • 1 year later...

The example script just creates 5 tabs with the same name but with a different number after it. You'd need to create the tabs yourself, and not use the For/Next loop to do it.

As far as I can tell, the TabItem names are just there to let you know they're relation to the actual tab items created above, changing the text in there doesn't do anything to the displayed items.

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Link to comment
Share on other sites

  • 1 month later...

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