Jump to content
Sign in to follow this  
fabianenos

tab selection via menu

Recommended Posts

fabianenos

so in my attatched script when the app opens up it selects the tab based on the no in the settings.ini file which is either 1 or 2.

when it starts at tab_ch = 1, nothing works well but when tab_ch = 2 the i can only select custom via the menu. any recomendations?

Share this post


Link to post
Share on other sites
Zedna

#include <GUIConstants.au3>
#include <GuiTab.au3>

;GUI being created------------------------------------------------------------------------------------------------------------------
$gui = GUICreate("GUI_title",300,200)
;GUI features-----------------------------------------------------------------------------------------------------------------------
;Tabs-------------------------------------------------------------------------------------------------------------------------------
$tab = GUICtrlCreateTab(0,0,299,165)
$tabHwnd = ControlGetHandle($gui,"",$tab)
;Tab1-------------------------------------------------------------------------------------------------------------------------------
$list1 = GUICtrlCreateTabItem("Custom")
;Tab2-------------------------------------------------------------------------------------------------------------------------------
$list2 = GUICtrlCreateTabItem("Predefined")
;Menu-------------------------------------------------------------------------------------------------------------------------------
$filemenu = GuiCtrlCreateMenu ("&File")
$exititem = GuiCtrlCreateMenuitem ("E&xit",$filemenu)

$view_menu = GUICtrlCreateMenu("&View")
$_type_custom = GUICtrlCreateMenuItem("&Custom",$view_menu)
$_type_pd = GUICtrlCreateMenuItem("Pre&Defined",$view_menu)
;Start------------------------------------------------------------------------------------------------------------------------------
GuiSetState()


$def_tab = IniRead("settings.ini","settings","tab_ch","1") ;Reading Default Tab
        If($def_tab = "2") Then
            _GUICtrlTab_SetCurSel ($tabHwnd, 1) ;Setting the tab in the GUI
            GUICtrlSetState($_type_pd,$GUI_CHECKED) ;Setting choice in menu
        ElseIf($def_tab = "1") Then
            _GUICtrlTab_SetCurSel ($tabHwnd, 0) ;Setting the tab in the GUI
            GUICtrlSetState($_type_custom,$GUI_CHECKED) ;Setting choice in menu
        EndIf

;GUI actions---------------------------------------------------------------------------------------------------------------------
While 1
    $msg = GUIGetMsg()
        Select
                    Case $msg = $GUI_EVENT_CLOSE    
                    ExitLoop
                    Case $msg = $tab
            $sw = GUICtrlRead($tab)
            If($sw == 0) Then
                GUICtrlSetState($_type_pd,$GUI_UNCHECKED)
                GUICtrlSetState($_type_custom,$GUI_CHECKED)
            ElseIf($sw == 1) Then
                GUICtrlSetState($_type_pd,$GUI_CHECKED)
                GUICtrlSetState($_type_custom,$GUI_UNCHECKED)
            EndIf
                    Case $msg = $_type_pd
            _GUICtrlTab_SetCurSel ($tabHwnd, 1) ;Setting the tab in the GUI
            GUICtrlSetState($_type_pd,$GUI_CHECKED)
            GUICtrlSetState($_type_custom,$GUI_UNCHECKED)
                    Case $msg = $_type_custom
            _GUICtrlTab_SetCurSel ($tabHwnd, 0) ;Setting the tab in the GUI
            GUICtrlSetState($_type_pd,$GUI_UNCHECKED)
            GUICtrlSetState($_type_custom,$GUI_CHECKED)
        EndSelect
WEnd

Share this post


Link to post
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
Sign in to follow this  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.