Jump to content

Create a tab "disable"


frankito
 Share

Recommended Posts

hi again :)

I just want to create a tab disable, but i feel this property doesn't exist ?

$tab = GUICtrlCreateTab(1, 1, 540, 400)
$tab1 = GUICtrlCreateTabItem("TEST")
GUICtrlSetState(-1, $GUI_DISABLE)
$tab2 = GUICtrlCreateTabItem("TEST2")

then i want to enable it, but i feel too i can't ;)

Edited by frankito
Link to comment
Share on other sites

You can use my OwnTab-UDF if you want. I just wrote 2 extra functions for that reason.

#include "OwnTab.au3"

Local $hGui = GUICreate("Funkey's OwnTab-UDF Example", 500, 350)
GUISetBkColor(0xbbbbbb)

Local $aTabText[4] = ["Item 1", "Register without icon", "Pic", "Status"] ;Declare the regions for the OwnTab-control
Local $aTabIcons[4][2] = [["shell32.dll", Random(1, 234, 1)],[""],["shell32.dll", Random(1, 234, 1)], ["shell32.dll", Random(1, 234, 1)]]
Global $aCtrlTab = _OwnTab_Create($hGui, $aTabText, 10, 10, 480, 300, 30, 0xD5D5D5, 0xCFE0E7, 0xCFE0E7, $aTabIcons)

#Region Tab1
_OwnTab_Add($aCtrlTab) ;Start controls tab1
Global $Edit1 = GUICtrlCreateEdit("Edit in Tab1", 20, 55, 300, 50, 0)
Global $Button1 = GUICtrlCreateButton("Simulate an alarm", 20, 120, 300, 20)
Global $Box1 = GUICtrlCreateCheckbox("Switch on hover", 20, 180)
GUICtrlSetBkColor(-1, 0xCFE0E7)
#EndRegion Tab1

#Region Tab2
_OwnTab_Add($aCtrlTab) ;Start controls tab2
Global $Edit2 = GUICtrlCreateEdit("Edit in Tab2", 20, 150, 300, 50, 0)
Global $Label2 = GUICtrlCreateLabel("Label in Tab2", 20, 220, 300, 20, 0x201)
GUICtrlSetBkColor(-1, -2) ;$GUI_BKCOLOR_TRANSPARENT
#EndRegion Tab2

#Region Tab3
_OwnTab_Add($aCtrlTab) ;Start controls tab3
Global $Edit3 = GUICtrlCreatePic(@DocumentsCommonDir & '\Eigene Bilder\Beispielbilder\Winter.jpg', 20, 55, 460, 280)
#EndRegion Tab3

#Region Tab4
_OwnTab_Add($aCtrlTab) ;Start controls tab4
Global $Button4 = GUICtrlCreateButton("Acknowledge the alarm", 20, 120, 300, 20)
Global $Button5 = GUICtrlCreateButton("Enable tab 3", 20, 150, 300, 20)
Global $Button6 = GUICtrlCreateButton("Disable tab 3", 20, 180, 300, 20)
#EndRegion Tab4

_OwnTab_End($aCtrlTab)
_OwnTab_Switch($aCtrlTab, 1) ;inizialize the OwnTab
_OwnTab_Disable($aCtrlTab, 3)

GUISetState()

_OwnTab_Hover($aCtrlTab, 0xFFFF88, 0) ;start hover-function if you want

Local $msg
Do
 $msg = GUIGetMsg()
 For $a = 1 To UBound($aCtrlTab, 1) - 1
  If $msg = $aCtrlTab[$a][0] Then
   _OwnTab_Switch($aCtrlTab, $a)
  EndIf
 Next
 If $msg = $Button1 Then _OwnTab_SetAlarm($aCtrlTab, 4, 0xFF0000, 0xFF0000)
 If $msg = $Button4 Then _OwnTab_ResetAlarm($aCtrlTab, 4)
 If $msg = $Button5 Then _OwnTab_Enable($aCtrlTab, 3)
 If $msg = $Button6 Then _OwnTab_Disable($aCtrlTab, 3)
 If $msg = $Box1 Then
  If GUICtrlRead($Box1) = 1 Then
   _OwnTab_Hover($aCtrlTab, 0xFFFF88, 15)
  Else
   _OwnTab_Hover($aCtrlTab, 0xFFFF88, 0)
  EndIf
 EndIf
 Sleep(10)
Until $msg = -3

#Region Disable and Enable Tab-Register
Func _OwnTab_Disable($aOwnTab, $iIndex)
 GUICtrlSetState($aOwnTab[$iIndex][0], 128)
 _OwnTab_UnRegisterHover($aOwnTab, $iIndex)
 Local $iSearch = _ArraySearch($OwnTabHoverHelp, $aOwnTab[$iIndex][0])
 If $iSearch = -1 Then _ArrayAdd($OwnTabHoverHelp, $aOwnTab[$iIndex][0])
EndFunc

Func _OwnTab_Enable($aOwnTab, $iIndex)
 GUICtrlSetState($aOwnTab[$iIndex][0], 64)
 _OwnTab_RegisterHover($aOwnTab, $iIndex)
 Local $iSearch = _ArraySearch($OwnTabHoverHelp, $aOwnTab[$iIndex][0])
 If $iSearch <> -1 Then _ArrayDelete($OwnTabHoverHelp, $iSearch)
EndFunc
#EndRegion  Disable and Enable Tab-Register

#745231

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

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