Jump to content

Recommended Posts

Posted

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

  • Moderators
Posted

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:

  Reveal hidden contents

 

  • Moderators
Posted

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:

  Reveal hidden contents

 

Posted

  On 7/27/2014 at 6:26 PM, Melba23 said:

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.

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...