Jump to content

Show-Hide TabItem ?


Madza91
 Share

Recommended Posts

Hello, is possible to hide and show TabItem with all ctrl-s on it?

#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <TabConstants.au3>
#include <WindowsConstants.au3>

$Form1 = GUICreate("Form1", 321, 258, -1, -1)
$Tab1 = GUICtrlCreateTab(16, 16, 289, 177)
GUICtrlCreateTabItem("Default Tab")
GUICtrlCreateTabItem("Tab for Hide/Show")
$Label1 = GUICtrlCreateLabel("Label1", 64, 40, 36, 17)
GUICtrlCreateTabItem("")
$Checkbox1 = GUICtrlCreateCheckbox("Hide/Show", 16, 208, 289, 33, BitOR($BS_CHECKBOX,$BS_AUTOCHECKBOX,$BS_PUSHLIKE,$WS_TABSTOP))
GUISetState(@SW_SHOW)

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Checkbox1
            $read = GUICtrlRead($Checkbox1)
            If $read = 1 Then
                MsgBox(0,"","Now i want to hide Tab")
            Else
                MsgBox(0,"","Now i want to show Tab")
            EndIf
    EndSwitch
WEnd

[quote name='dbzfanatic' post='609696' date='Nov 26 2008, 08:46 AM']This is a help forum not a "write this for me" forum.[/quote](Sorry for bad English) :)

Link to comment
Share on other sites

n3nE

You can't hide a tab control, you can delete and insert control.

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <ButtonConstants.au3>
#include <GuiTab.au3>

Global $aItem

$Form1 = GUICreate("Form1", 321, 258, -1, -1)

$Tab1 = GUICtrlCreateTab(16, 16, 289, 177)

GUICtrlCreateTabItem("Default Tab")
GUICtrlCreateTabItem("")

_GUICtrlTab_InsertItem($Tab1, 1, "Tab for Hide/Show")

$Checkbox1 = GUICtrlCreateCheckbox("Hide/Show", 16, 208, 289, 33, BitOR($BS_CHECKBOX,$BS_AUTOCHECKBOX,$BS_PUSHLIKE,$WS_TABSTOP))

GUISetState(@SW_SHOW)

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Checkbox1
            $read = GUICtrlRead($Checkbox1)
            If $read = 1 Then
                MsgBox(0,"","Now i want to hide Tab")
                _GUICtrlTab_DeleteItem($Tab1, 1)
            Else
                MsgBox(0,"","Now i want to show Tab")
                _GUICtrlTab_InsertItem($Tab1, 1, "Tab for Hide/Show")
            EndIf
    EndSwitch
WEnd
Link to comment
Share on other sites

Tnx, but i maded on another way : )))

#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <GuiTab.au3>

$Form1 = GUICreate("Form1", 321, 258, -1, -1)
$Tab1 = GUICtrlCreateTab(16, 16, 289, 177)
GUICtrlCreateTabItem("Default Tab")
$button = GUICtrlCreateButton("Dugme",70,50,100,20)
GUICtrlDelete($button)
GUICtrlCreateTabItem("")
$Checkbox1 = GUICtrlCreateCheckbox("Hide/Show", 16, 208, 289, 33, BitOR($BS_CHECKBOX,$BS_AUTOCHECKBOX,$BS_PUSHLIKE,$WS_TABSTOP))
GUISetState(@SW_SHOW)

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Checkbox1
            $read = GUICtrlRead($Checkbox1)
            If $read = 4 Then
                GUICtrlSetData($Checkbox1,"Show")
                _GUICtrlTab_DeleteItem($Tab1,1)
                GUICtrlDelete($button)
            Else
                GUICtrlSetData($Checkbox1,"Hide")
                GUICtrlCreateTabItem("Tab for Hide/Show")
                $button = GUICtrlCreateButton("Dugme",70,50,100,20)
                GUICtrlCreateTabItem("")
            EndIf
        Case $button
            MsgBox(0,"","Ok")
    EndSwitch
WEnd

[quote name='dbzfanatic' post='609696' date='Nov 26 2008, 08:46 AM']This is a help forum not a "write this for me" forum.[/quote](Sorry for bad English) :)

Link to comment
Share on other sites

  • 1 month later...

Is it possible to do this depending on what's selected in a combo box? I want to have it so that if the combox box says 'Custom' an input box appears but is deleted if it does not say 'Custom'

If GUICtrlRead($Combo) = 'Custom' Then
    $Custom = GUICtrlCreateInput('', 140, 300, 60, 20)
Else
    GuiCtrlDelete($Custom)
EndIf

if I use the above code when the combo box is on 'custom' it continuously remakes the input box and is impossible to use

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