Jump to content
Sign in to follow this  
bordomavi

Same hotkeys not work in different tabs

Recommended Posts

bordomavi

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

Share this post


Link to post
Share on other sites
Melba23

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

  • Like 1

Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______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

 

Share this post


Link to post
Share on other sites
bordomavi

No :) it is good idea but not works for me. i create some works in tab1 and when i press enter key it goes case $button_all. doesn't do my work.

Share this post


Link to post
Share on other sites
Melba23

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

  • Like 1

Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______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

 

Share this post


Link to post
Share on other sites
bordomavi

Yes working thanks :)

Share this post


Link to post
Share on other sites
232showtime

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.

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  

×