Hallo!
ich möchte gerne in meinem GUI Func A/Func B ausführen, wenn Tab A/Tab B aktiv ist.
Im moment weiß ich aber nicht, wie ich das angehen soll.
Über Hilfe bin ich dankbar.
Gruß
Heini
Func an Tab koppeln
-
- [ gelöst ]
-
heini -
19. Oktober 2008 um 17:23 -
Geschlossen -
Erledigt
-
-
- Offizieller Beitrag
Ich habe das Beispiel aus der Hilfe entsprechend erweitert:
Spoiler anzeigen
[autoit]
[/autoit] [autoit][/autoit] [autoit]
#include <GUIConstantsEx.au3>Opt('MustDeclareVars', 1)
[/autoit] [autoit][/autoit] [autoit]Example()
[/autoit] [autoit][/autoit] [autoit]Func Example()
[/autoit] [autoit][/autoit] [autoit]
Local $tab, $tab0, $tab0OK, $tab0input
Local $tab1, $tab1combo, $tab1OK
Local $tab2, $tab2OK, $aMsg, $actTab, $oldTab
GUICreate("My GUI Tab") ; will create a dialog box that when displayed is centeredGUISetBkColor(0x00E0FFFF)
[/autoit] [autoit][/autoit] [autoit]
GUISetFont(9, 300)$tab = GUICtrlCreateTab(10, 10, 200, 100)
[/autoit] [autoit][/autoit] [autoit]$tab0 = GUICtrlCreateTabItem("tab0")
[/autoit] [autoit][/autoit] [autoit]
GUICtrlCreateLabel("label0", 30, 80, 50, 20)
$tab0OK = GUICtrlCreateButton("OK0", 20, 50, 50, 20)
$tab0input = GUICtrlCreateInput("default", 80, 50, 70, 20)$tab1 = GUICtrlCreateTabItem("tab----1")
[/autoit] [autoit][/autoit] [autoit]
GUICtrlCreateLabel("label1", 30, 80, 50, 20)
$tab1combo = GUICtrlCreateCombo("", 20, 50, 60, 120)
GUICtrlSetData(-1, "Trids|CyberSlug|Larry|Jon|Tylo", "Jon") ; default Jon
$tab1OK = GUICtrlCreateButton("OK1", 80, 50, 50, 20)$tab2 = GUICtrlCreateTabItem("tab2")
[/autoit] [autoit][/autoit] [autoit]
GUICtrlSetState(-1, $GUI_SHOW) ; will be display first
GUICtrlCreateLabel("label2", 30, 80, 50, 20)
$tab2OK = GUICtrlCreateButton("OK2", 140, 50, 50)GUICtrlCreateTabItem("") ; end tabitem definition
[/autoit] [autoit][/autoit] [autoit]GUICtrlCreateLabel("label3", 20, 130, 50, 20)
[/autoit] [autoit][/autoit] [autoit]GUISetState()
[/autoit] [autoit][/autoit] [autoit]; Run the GUI until the dialog is closed
[/autoit]
While 1
Switch GUIGetMsg()
Case $GUI_EVENT_CLOSE
Exit
Case $GUI_EVENT_PRIMARYDOWN
$actTab = GUICtrlRead($tab,1)
If $actTab <> $oldTab Then
$oldTab = $actTab
Switch $actTab
Case $tab0
MsgBox(0,0,'0')
Case $tab1
MsgBox(0,0,'1')
Case $tab2
MsgBox(0,0,'2')
EndSwitch
EndIf
EndSwitch
WEnd
EndFunc ;==>Example -
Du musst nicht mal PrimaryDown abfragen, sondern nur auf ein TabEvent
Spoiler anzeigen
[autoit]#include <GUIConstantsEx.au3>
[/autoit] [autoit][/autoit] [autoit]Opt('MustDeclareVars', 1)
[/autoit] [autoit][/autoit] [autoit]Example()
[/autoit] [autoit][/autoit] [autoit]Func Example()
[/autoit] [autoit][/autoit] [autoit]
Local $tab, $tab0, $tab0OK, $tab0input
Local $tab1, $tab1combo, $tab1OK
Local $tab2, $tab2OK, $aMsg, $actTab
GUICreate("My GUI Tab") ; will create a dialog box that when displayed is centeredGUISetBkColor(0x00E0FFFF)
[/autoit] [autoit][/autoit] [autoit]
GUISetFont(9, 300)$tab = GUICtrlCreateTab(10, 10, 200, 100)
[/autoit] [autoit][/autoit] [autoit]$tab0 = GUICtrlCreateTabItem("tab0")
[/autoit] [autoit][/autoit] [autoit]
GUICtrlCreateLabel("label0", 30, 80, 50, 20)
$tab0OK = GUICtrlCreateButton("OK0", 20, 50, 50, 20)
$tab0input = GUICtrlCreateInput("default", 80, 50, 70, 20)$tab1 = GUICtrlCreateTabItem("tab----1")
[/autoit] [autoit][/autoit] [autoit]
GUICtrlCreateLabel("label1", 30, 80, 50, 20)
$tab1combo = GUICtrlCreateCombo("", 20, 50, 60, 120)
GUICtrlSetData(-1, "Trids|CyberSlug|Larry|Jon|Tylo", "Jon") ; default Jon
$tab1OK = GUICtrlCreateButton("OK1", 80, 50, 50, 20)$tab2 = GUICtrlCreateTabItem("tab2")
[/autoit] [autoit][/autoit] [autoit]
GUICtrlSetState(-1, $GUI_SHOW) ; will be display first
GUICtrlCreateLabel("label2", 30, 80, 50, 20)
$tab2OK = GUICtrlCreateButton("OK2", 140, 50, 50)GUICtrlCreateTabItem("") ; end tabitem definition
[/autoit] [autoit][/autoit] [autoit]GUICtrlCreateLabel("label3", 20, 130, 50, 20)
[/autoit] [autoit][/autoit] [autoit]GUISetState()
[/autoit] [autoit][/autoit] [autoit]; Run the GUI until the dialog is closed
[/autoit]
While 1
Switch GUIGetMsg()
Case $GUI_EVENT_CLOSE
Exit
Case $tab
$actTab = GUICtrlRead($tab,1)
Switch $actTab
Case $tab0
MsgBox(0,0,'0')
Case $tab1
MsgBox(0,0,'1')
Case $tab2
MsgBox(0,0,'2')
EndSwitch
EndSwitch
WEnd
EndFunc ;==>Example -
- Offizieller Beitrag
Upps! So ist es natürlich noch besser!
Mache so wenig mit TABs... -
Wie funktioniert das im "Opt("GUIOnEventMode", 1)"-Modus???
Ich hab das Problem, daß die Func:
..
..
GUICtrlDelete($daten_012)
$_012 = IniRead($inifile1, "Hardware", "cpuver", "Unbekannt")
$daten_012 = GuiCtrlCreateLabel($_012, 650, 107, 100, 13)
GUICtrlSetOnEvent(-1, '_Daten')
..
..
das Label in allen Tabs schreibt und nicht nur in den Tab in den es gehört.