找回密码
 加入
搜索
查看: 1299|回复: 1

[GUI管理] [已解决]GUI中批量设置case按钮的问题

[复制链接]
发表于 2017-5-23 04:18:11 | 显示全部楼层 |阅读模式
本帖最后由 3131210 于 2017-5-23 08:28 编辑

麻烦大神帮看看  149行-150行,149设置的case是有效的,但是150不能读出相应位置的按钮,只能一直读一个$Tab1HKI[0]的,有没有办法解决呢?
#include <GUIConstantsEx.au3>
#include <EditConstants.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)
;输入法-Start
Dim $var[100], $ime[100], $imee = '', $SFile = @ScriptDir & '\Setting.ini'
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)

#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快捷') ;标签1====================================================================================================
GUICtrlSetState(-1, $GUI_SHOW) ;优先显示
$LabelEN = GUICtrlCreateLabel('英文输入法', 8, 30, 64, 17)
$LabelCN = GUICtrlCreateLabel('中文输入法', 8, 62, 64, 17)
$Tab1Label1 = GUICtrlCreateLabel('热键(按Backspace删除)', 25, 92, 130, 17)
$Tab1Label2 = GUICtrlCreateLabel('生效', 175, 92, 28, 17)
$Tab1Label3 = GUICtrlCreateLabel('快捷(发送的内容)', 240, 92, 100, 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))

GUICtrlSetData($Language1, $imee, $ime[1])
GUICtrlSetData($Language2, $imee, $ime[2])

Local $Num = 9, $Tab1HKI[$Num], $Tab1CheckboxNum[$Num] ;总数
For $i = 0 To $Num - 1
        $Tab1HKI[$i] = _GUICtrlHKI_Create(0, 10, 110 + $i * 24, 150, 17) ;热键框
        GUICtrlSetStyle($Tab1HKI[$i], $ES_CENTER)
        $Tab1CheckboxNum[$i] = GUICtrlCreateCheckbox($i, 180, 110 + $i * 24, 190, 17) ;复选框
Next

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

$TabSheet2 = GUICtrlCreateTabItem('自定义快捷') ;标签2====================================================================================================
$Tab2Label1 = GUICtrlCreateLabel('热键(按Backspace删除)', 25, 25, 130, 17)
$Tab2Label2 = GUICtrlCreateLabel('生效', 175, 25, 28, 17)
$Tab2Label3 = GUICtrlCreateLabel('快捷(发送的内容)', 240, 25, 100, 17)

Local $Num = 12, $Tab2HKI[$Num], $Tab2CheckboxNum[$Num], $Tab2Input[$Num] ;总数
For $i = 0 To $Num - 1
        $Tab2HKI[$i] = _GUICtrlHKI_Create(0, 10, 45 + $i * 24, 150, 17) ;热键框
        GUICtrlSetStyle($Tab2HKI[$i], $ES_CENTER)
        $Tab2CheckboxNum[$i] = GUICtrlCreateCheckbox('', 180, 45 + $i * 24, 17, 17) ;复选框
        $Tab2Input[$i] = GUICtrlCreateInput('None', 210, 45 + $i * 24, 165, 17) ;输入框
Next

$TabSheet3 = GUICtrlCreateTabItem('杂项') ;标签3====================================================================================================



$SpecialCheckbox1 = GUICtrlCreateCheckbox('【F1】特殊功能', 25, 150, 110, 17) ;F1特殊功能
$SpecialCheckbox2 = GUICtrlCreateCheckbox('【F6】窗口置顶', 25, 180, 110, 17) ;F1特殊功能

GUICtrlCreateGroup("LP快捷延迟", 15, 35, 150, 100)
$Tab3Label1 = GUICtrlCreateLabel("切换输入法延迟", 25, 55, 85, 17, $SS_RIGHT)
$Tab3Label2 = GUICtrlCreateLabel("A 延迟", 25, 75, 85, 17, $SS_RIGHT)
$Tab3Label3 = GUICtrlCreateLabel("→ 延迟", 25, 95, 85, 17, $SS_RIGHT)
$Tab3Label4 = GUICtrlCreateLabel("选择项目延迟", 25, 115, 85, 17, $SS_RIGHT)
$WSleep1 = GUICtrlCreateInput("1", 120, 53, 30, 17)
$WSleep2 = GUICtrlCreateInput("1", 120, 73, 30, 17)
$WSleep3 = GUICtrlCreateInput("1", 120, 93, 30, 17)
$WSleep4 = GUICtrlCreateInput("1", 120, 113, 30, 17)
GUICtrlCreateGroup("", -99, -99, 1, 1) ;关闭组框控件
GUICtrlCreateGroup("自定义快捷延迟", 215, 35, 150, 100)
$Tab3Label5 = GUICtrlCreateLabel("切换输入法延迟", 225, 55, 85, 17, $SS_RIGHT)
$Tab3Label6 = GUICtrlCreateLabel("A 延迟", 225, 75, 85, 17, $SS_RIGHT)
$Tab3Label7 = GUICtrlCreateLabel("→ 延迟", 225, 95, 85, 17, $SS_RIGHT)
$Tab3Label8 = GUICtrlCreateLabel("选择项目延迟", 225, 115, 85, 17, $SS_RIGHT)
$WSleep5 = GUICtrlCreateInput("1", 320, 53, 30, 17)
$WSleep6 = GUICtrlCreateInput("1", 320, 73, 30, 17)
$WSleep7 = GUICtrlCreateInput("1", 320, 93, 30, 17)
$WSleep8 = GUICtrlCreateInput("1", 320, 113, 30, 17)
GUICtrlCreateGroup("", -99, -99, 1, 1) ;关闭组框控件

GUICtrlCreateTabItem('') ;关闭标签功能


;标签切换热键-Start
Local $sBtn[2] = [GUICtrlCreateDummy(), GUICtrlCreateDummy()], $TabSheet[3] = [$TabSheet1, $TabSheet2, $TabSheet3]
Local $sHk[2][2] = [['^{Tab}', $sBtn[0]], ['^+{Tab}', $sBtn[1]]]
GUISetAccelerators($sHk)
;标签切换热键-End

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



While 1
        $nMsg = GUIGetMsg()
        Switch $nMsg
                Case $GUI_EVENT_CLOSE
                        Exit
                Case $Save
                        MsgBox(0, 0, 0)
                Case $sBtn[0]
                        If GUICtrlRead($Tab) < UBound($TabSheet) - 1 Then
                                Local $i = GUICtrlRead($Tab) + 1
                        Else
                                Local $i = 0
                        EndIf
                        GUICtrlSetState($TabSheet[$i], 16)
                Case $sBtn[1]
                        If GUICtrlRead($Tab) = 0 Then
                                Local $i = 2
                        Else
                                Local $i = GUICtrlRead($Tab) - 1
                        EndIf
                        GUICtrlSetState($TabSheet[$i], 16)

                Case $Tab1CheckboxNum[0] To $Tab1CheckboxNum[UBound($Tab1CheckboxNum) - 1]
                        MsgBox(0, 0, GUICtrlRead($Tab1HKI[0]))

        EndSwitch
WEnd

Func ShowMessage()
        MsgBox($MB_SYSTEMMODAL, "", "这是一条消息.")
EndFunc   ;==>ShowMessage
发表于 2017-5-23 06:27:38 | 显示全部楼层
MsgBox(0, 0, GUICtrlRead($nMsg-1)
您需要登录后才可以回帖 登录 | 加入

本版积分规则

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

GMT+8, 2024-11-17 03:44 , Processed in 0.085614 second(s), 23 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

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