Jump to content

Same hotkeys not work in different tabs


Recommended Posts

$TabSheet1 = GUICtrlCreateTabItem("a")
$Button1 = GUICtrlCreateButton("aaaaa", 16, 192, 225, 41)
Dim $Form1_AccelTable[1][2] = [["{ENTER}", $Button1]]
GUISetAccelerators($Form1_AccelTable)

$TabSheet2 = GUICtrlCreateTabItem("b")
$Button2 = GUICtrlCreateButton("bbbbb", 16, 192, 225, 41)
Dim $Form1_AccelTable[1][2] = [["{ENTER}", $Button2]]
GUISetAccelerators($Form1_AccelTable)

$TabSheet3 = GUICtrlCreateTabItem("c")
$Button3 = GUICtrlCreateButton("ccccc", 16, 192, 225, 41)
Dim $Form1_AccelTable[1][2] = [["{ENTER}", $Button3]]
GUISetAccelerators($Form1_AccelTable)

Enter hotkey is working only first tab. i want it work all tab.

Link to comment
Share on other sites

  • Moderators

bordomavi,

How about this? ;)

#include <GUIConstantsEx.au3>
#include <MsgBoxConstants.au3>

$hGUI = GUICreate("Test", 500, 500)

$cTab = GUICtrlCreateTab(10, 10, 480, 480)

$TabSheet1 = GUICtrlCreateTabItem("a")
$Button1 = GUICtrlCreateButton("1", 16, 192, 225, 41)

$TabSheet2 = GUICtrlCreateTabItem("b")
$Button2 = GUICtrlCreateButton("2", 16, 192, 225, 41)

$TabSheet3 = GUICtrlCreateTabItem("c")
$Button3 = GUICtrlCreateButton("3", 16, 192, 225, 41)

GUICtrlCreateTabItem("")

$Button_All = GUICtrlCreateDummy()

GUISetState()

Global $Form1_AccelTable[1][2] = [["{ENTER}", $Button_All]]
GUISetAccelerators($Form1_AccelTable)

While 1

    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Button1
            MsgBox($MB_SYSTEMMODAL, "Hi", "Button 1 Pressed")
        Case $Button2
            MsgBox($MB_SYSTEMMODAL, "Hi", "Button 2 Pressed")
        Case $Button3
            MsgBox($MB_SYSTEMMODAL, "Hi", "Button 3 Pressed")
        Case $Button_All

            $iTab = GUICtrlRead($cTab) + 1
            MsgBox($MB_SYSTEMMODAL, "Hi", "Button " & $iTab & " pressed" & @CRLF & "using Accel key")
    EndSwitch

WEnd
All clear? :)

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

  • Moderators

bordomavi,

So you have to create some additional functions which are called by the buttons and the dummy when the correct tab is active: ;)

#include <GUIConstantsEx.au3>
#include <MsgBoxConstants.au3>

$hGUI = GUICreate("Test", 500, 500)

$cTab = GUICtrlCreateTab(10, 10, 480, 480)

$TabSheet1 = GUICtrlCreateTabItem("a")
$Button1 = GUICtrlCreateButton("1", 16, 192, 225, 41)

$TabSheet2 = GUICtrlCreateTabItem("b")
$Button2 = GUICtrlCreateButton("2", 16, 192, 225, 41)

$TabSheet3 = GUICtrlCreateTabItem("c")
$Button3 = GUICtrlCreateButton("3", 16, 192, 225, 41)

GUICtrlCreateTabItem("")

$Button_All = GUICtrlCreateDummy()

GUISetState()

Global $Form1_AccelTable[1][2] = [["{ENTER}", $Button_All]]
GUISetAccelerators($Form1_AccelTable)

While 1

    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Button1
            _Button_1()
        Case $Button2
            _Button_2()
        Case $Button3
            _Button_3()
        Case $Button_All
            Switch GUICtrlRead($cTab)
                Case 0
                    _Button_1(1)
                Case 1
                    _Button_2(1)
                Case 2
                    _Button_3(1)
            EndSwitch
    EndSwitch

WEnd

Func _Button_1($iDummy = 0)
    $sMsg = "Button 1 Pressed"
    If $iDummy Then $sMsg &= @CRLF & "using Accel key"
    MsgBox($MB_SYSTEMMODAL, "Hi", $sMsg)
EndFunc

Func _Button_2($iDummy = 0)
    $sMsg = "Button 2 Pressed"
    If $iDummy Then $sMsg &= @CRLF & "using Accel key"
    MsgBox($MB_SYSTEMMODAL, "Hi", $sMsg)
EndFunc

Func _Button_3($iDummy = 0)
    $sMsg = "Button 3 Pressed"
    If $iDummy Then $sMsg &= @CRLF & "using Accel key"
    MsgBox($MB_SYSTEMMODAL, "Hi", $sMsg)
EndFunc
How about that? :)

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

bordomavi,

So you have to create some additional functions which are called by the buttons and the dummy when the correct tab is active: ;)

#include <GUIConstantsEx.au3>
#include <MsgBoxConstants.au3>

$hGUI = GUICreate("Test", 500, 500)

$cTab = GUICtrlCreateTab(10, 10, 480, 480)

$TabSheet1 = GUICtrlCreateTabItem("a")
$Button1 = GUICtrlCreateButton("1", 16, 192, 225, 41)

$TabSheet2 = GUICtrlCreateTabItem("b")
$Button2 = GUICtrlCreateButton("2", 16, 192, 225, 41)

$TabSheet3 = GUICtrlCreateTabItem("c")
$Button3 = GUICtrlCreateButton("3", 16, 192, 225, 41)

GUICtrlCreateTabItem("")

$Button_All = GUICtrlCreateDummy()

GUISetState()

Global $Form1_AccelTable[1][2] = [["{ENTER}", $Button_All]]
GUISetAccelerators($Form1_AccelTable)

While 1

    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            Exit
      %2

ill get to that... i still need to learn and understand a lot of codes graduated.gif

Correct answer, learn to walk before you take on that marathon.

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