E1M1 Posted June 18, 2009 Posted June 18, 2009 Whats wrong here? How I can make only "Untitled" show that label (and "Untitled2" should be empty) If I run that code I will see same label on both tabs, how to I can fix it? $hTab = _GUICtrlTab_Create($Form1, 0, 0, 640, 120) _GUICtrlTab_InsertItem($hTab, 0 ,"Untitled") GUICtrlCreateLabel ( "text",50,50,75,20) _GUICtrlTab_InsertItem($hTab, 1 ,"Untitled2") edited
Lars Posted June 18, 2009 Posted June 18, 2009 Hi there if I test it like this CODE $myTab = GUICtrlCreateTab(32, 24, 145, 97) $myTabSheet1 = GUICtrlCreateTabItem("Untitled") $myTabSheet2 = GUICtrlCreateTabItem("Untitled2") It works like candy
E1M1 Posted June 18, 2009 Author Posted June 18, 2009 (edited) but with this example I cant use other tab commands like _GUICtrlTab_GetItemText()? Thanks anyway. Edited June 18, 2009 by E1M1 edited
DjDeep00 Posted June 18, 2009 Posted June 18, 2009 @E1M1... Remember that when you use any of the advanced controls like _GuiCtrlCreate*, these controls are not standard controls and currently AutoIt does not play nice with them. However you can control these yourself by using WM_NOTIFY() expandcollapse popup#include <GuiConstantsEx.au3> #include <GuiTab.au3> #include <WindowsConstants.au3> $Form1 = GUICreate("test",200,200) $hTab = _GUICtrlTab_Create($Form1, 0, 0, 640, 120) _GUICtrlTab_InsertItem($hTab, 0 ,"Untitled") $Label1 = GUICtrlCreateLabel ( "text",50,50,75,20) GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT) _GUICtrlTab_InsertItem($hTab, 1 ,"Untitled2") GUISetState() GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY") While 1 $msg = GUIGetMsg() If $msg = $GUI_EVENT_CLOSE Then ExitLoop WEnd GUIDelete() Func WM_NOTIFY($hWnd, $Msg, $wParam, $lParam) Local $hWndTab, $tNMHDR, $HwndFrom, $iCode $hWndTab = $hTab If Not IsHWnd($hWndTab) Then $hWndTab = GUICtrlGetHandle($hTab) $tNMHDR = DllStructCreate($tagNMHDR, $lParam) $HwndFrom = HWnd(DllStructGetData($tNMHDR, "hWndFrom")) $iCode = DllStructGetData($tNMHDR, "Code") Switch $HwndFrom Case $hWndTab Switch $iCode Case $TCN_SELCHANGE Switch _GUICtrlTab_GetCurSel($hTab) Case 0 GUICtrlSetState($Label1,$GUI_SHOW) Case 1 GUICtrlSetState($Label1,$GUI_HIDE) Case 2; Third tab... Case 3; Fourth tab... EndSwitch EndSwitch EndSwitch Return $GUI_RUNDEFMSG EndFunc
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now