找回密码
 加入
搜索
查看: 2024|回复: 3

[GUI管理] [已解决]如何实现按ctrl+tab切换标签页?

[复制链接]
发表于 2017-5-22 01:34:39 | 显示全部楼层 |阅读模式
本帖最后由 3131210 于 2017-5-23 15:26 编辑

如何实现按ctrl+tab切换标签页?
#include <GUIConstantsEx.au3>
#include <TabConstants.au3>
#include <WindowsConstants.au3>
#include <Constants.au3>
#include <ButtonConstants.au3>
#include <ComboConstants.au3>
#include <StaticConstants.au3>
#include <HotKeyInput.au3>
#include <HotKey_21b.au3>
#NoTrayIcon
Opt("SendCapslockMode", 0)
Opt("TrayMenuMode", 3)

Dim $var[100], $ime[100], $imee = ""
Local $sFilePath = @ScriptDir & "\Setting.ini"

#Region ### START Koda GUI section ### Form=

$Exists = "LP快捷辅助 - By Alex" ;判断是否只运行一个程序
If WinExists($Exists) Then
        WinSetState("[CLASS:AutoIt v3 GUI]", "", @SW_RESTORE)
        Exit
EndIf
AutoItWinSetTitle($Exists) ;修改程序窗口的标题名
$MyForm = GUICreate($Exists, 385, 370, 233, 139)
$Save = GUICtrlCreateButton("保存配置", 8, 330, 70, 30)
$Reset = GUICtrlCreateButton("重置配置", 108, 330, 70, 30)

$Tab = GUICtrlCreateTab(0, 0, 370, 20)
$TabSheet1 = GUICtrlCreateTabItem("LP快捷(Ctrl+1)") ;标签1
GUICtrlSetState(-1, $GUI_SHOW) ;优先显示
$LabelEN = GUICtrlCreateLabel("英文输入法", 8, 30, 64, 17)
$LabelCN = GUICtrlCreateLabel("中文输入法", 8, 62, 64, 17)
$Tab1Label1 = GUICtrlCreateLabel("生效", 10, 92, 28, 17)
$Tab1Label2 = GUICtrlCreateLabel("快捷", 54, 92, 28, 17)
$Tab1Label3 = GUICtrlCreateLabel("热键", 220, 92, 28, 17)
$Language1 = GUICtrlCreateCombo("None", 73, 26, 297, 25, BitOR($GUI_SS_DEFAULT_COMBO, $CBS_SIMPLE))
$Language2 = GUICtrlCreateCombo("None", 73, 58, 297, 25, BitOR($GUI_SS_DEFAULT_COMBO, $CBS_SIMPLE))

For $i = 1 To 100
        $var[$i] = RegRead("HKEY_CURRENT_USER\keyboard layout\preload", $i)
        If Not $var[$i] Then
                $var[0] = $i - 1
                ExitLoop
        EndIf
Next
For $i = 1 To $var[0]
        $ime[$i] = RegRead("HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\Keyboard Layouts" & $var[$i], "Layout Text")
        If $ime[$i] Then $imee = $imee & $ime[$i] & "|"
Next

If StringRight($imee, 1) = "|" Then $imee = StringTrimRight($imee, 1)
GUICtrlSetData($Language1, $imee, $ime[1])
GUICtrlSetData($Language2, $imee, $ime[2])

Local $Tab1CheckboxNum[9] ;总数
For $i = 0 To UBound($Tab1CheckboxNum) - 1 ;复选框
        $Tab1CheckboxNum[$i] = GUICtrlCreateCheckbox($i, 15, 110 + $i * 24, 190, 17)
Next

GUICtrlSetData($Tab1CheckboxNum[0], ' 0:欢迎语,还没有说明问题')
GUICtrlSetData($Tab1CheckboxNum[1], ' 1:索取账号')
GUICtrlSetData($Tab1CheckboxNum[2], ' 2:欢迎语,玩家已经说明问题')
GUICtrlSetData($Tab1CheckboxNum[3], ' 3:上传截图')
GUICtrlSetData($Tab1CheckboxNum[4], ' 4:长时间没回复')
GUICtrlSetData($Tab1CheckboxNum[5], ' 5:结束语')
GUICtrlSetData($Tab1CheckboxNum[6], ' 6:玩家满意度')
GUICtrlSetData($Tab1CheckboxNum[7], ' 7:稍等')
GUICtrlSetData($Tab1CheckboxNum[8], ' 8:再次服务')

Local $Tab1HKI[9] ;总数
For $i = 0 To UBound($Tab1HKI) - 1 ;热键框
        $Tab1HKI[$i] = _GUICtrlHKI_Create(0, 220, 110 + $i * 24, 150, 17)
Next


$TabSheet2 = GUICtrlCreateTabItem("自定义快捷(Ctrl+2)") ;标签2

$TabSheet3 = GUICtrlCreateTabItem("杂项(Ctrl+3)") ;标签3
GUICtrlCreateTabItem("")

Local $sBtn[3] = [GUICtrlCreateDummy(), GUICtrlCreateDummy(), GUICtrlCreateDummy()]
Local $sHk[3][2] = [["^1", $sBtn[0]], ["^2", $sBtn[1]], ["^3", $sBtn[2]]]
GUISetAccelerators($sHk)

GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
        $nMsg = GUIGetMsg()
        Switch $nMsg
                Case $GUI_EVENT_CLOSE
                        Exit

                Case $sBtn[0]
                        GUICtrlSetState($TabSheet1, 16)
                Case $sBtn[1]
                        GUICtrlSetState($TabSheet2, 16)
                Case $sBtn[2]
                        GUICtrlSetState($TabSheet3, 16)

        EndSwitch
WEnd
发表于 2017-5-22 09:26:09 | 显示全部楼层
回复 1# 3131210

标签页就有快捷键,为何要重新设置?
发表于 2017-5-22 11:07:28 | 显示全部楼层
系统自带 hotketset
发表于 2017-5-22 16:10:01 | 显示全部楼层
系统自带 hotketset
您需要登录后才可以回帖 登录 | 加入

本版积分规则

QQ|手机版|小黑屋|AUTOIT CN ( 鲁ICP备19019924号-1 )谷歌 百度

GMT+8, 2024-11-13 12:15 , Processed in 0.076139 second(s), 23 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表