leevy Posted April 8, 2009 Share Posted April 8, 2009 Hello, Here is my script, my question is, how to create dynamically a control on tab "report"? please see my script line 47-48, I used GUISwitch(), but The results of actual runs is not what I want. the actual result is: if I select a template "data", I only can see the input control "aaaa" after clicking tab "version" or "readme". but I hope I can see the input control after I select a template except "report1". expandcollapse popup#include <GuiConstantsEx.au3> _Main() Func _Main() Global $parent, $tabitem2 ; Create the GUI window and controls $parent = GUICreate("xxxx", 400, 500, (@DesktopWidth - 400)/ 2, (@DesktopHeight - 500) / 2) $OLD = _SetThemes(0) GUISetIcon("xxxx") $tab = GUICtrlCreateTab(10, 10, 382, 440,0x00000020 ) _SetThemes($OLD) $tabitem1 = GUICtrlCreateTabItem("version") $tabitem2 = GUICtrlCreateTabItem("report") $radioAddreport = GUICtrlCreateRadio("Add reports", 25, 45, 160, 20, 000000) $radioAddreporttemplate = GUICtrlCreateRadio("Add report template", 200, 45, 150, 20, 000000) $bugreporttemplatelabel = GUICtrlCreateLabel("Template", 200, 75, 80, 20, 0x0200) $bugreporttemplate = GUICtrlCreateCombo("", 255, 75, 120, 20) GUICtrlSetData($bugreporttemplate, "report1|template|data", "report1") GUICtrlCreateTabItem("readme") GUICtrlCreateTabItem("") ; Run the GUI until it is closed GUISetState() While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop case $msg = $tab if GUICtrlRead($tab) = 1 Then $clickAddreport = ControlClick("Wing 1.0","",$radioAddreport) EndIf Case $msg = $bugreporttemplate Local $reporttemplate = GUICtrlRead($bugreporttemplate) if $reporttemplate = "report1" Then Else GUISwitch($parent, $tabitem2) GUICtrlCreateInput("aaaa", 125, 135, 250, 20,0x0080) EndIf EndSelect WEnd Exit EndFunc ;==>_Main Func _SetThemes($Style) If @OSType = "WIN32_WINDOWS" Or $Style=-1 Then Return SetError(1,0,-1) Local $ret = DllCall("uxtheme.dll", "dword", "GetThemeAppProperties") If Not IsArray($ret) Then Return SetError(1,0,-1) DllCall("uxtheme.dll", "none", "SetThemeAppProperties", "dword", $Style) Return $ret[0] EndFunc hope your help, thanks. Link to comment Share on other sites More sharing options...
KaFu Posted April 8, 2009 Share Posted April 8, 2009 "To create a new control on an existing tabitem use GUISwitch($hWin,$tabitem) to select it and just create your new control. Don't forget to close your tabitem creation with GUICtrlCreateTabItem("")." Add a GUICtrlCreateTabItem("") after the GUICtrlCreateInput(). BigDaddyO 1 OS: Win10-22H2 - 64bit - German, AutoIt Version: 3.3.16.1, AutoIt Editor: SciTE, Website: https://funk.eu AMT - Auto-Movie-Thumbnailer (2022-Nov-26) BIC - Batch-Image-Cropper (2023-Apr-01) COP - Color Picker (2009-May-21) DCS - Dynamic Cursor Selector (2024-Feb-16) HMW - Hide my Windows (2018-Sep-16) HRC - HotKey Resolution Changer (2012-May-16) ICU - Icon Configuration Utility (2018-Sep-16) SMF - Search my Files (2023-Jun-03) - THE file info and duplicates search tool SSD - Set Sound Device (2017-Sep-16) Link to comment Share on other sites More sharing options...
leevy Posted April 8, 2009 Author Share Posted April 8, 2009 "To create a new control on an existing tabitem use GUISwitch($hWin,$tabitem) to select it and just create your new control. Don't forget to close your tabitem creation with GUICtrlCreateTabItem("")."Add a GUICtrlCreateTabItem("") after the GUICtrlCreateInput().thank you KaFu, my code is ok now. Link to comment Share on other sites More sharing options...
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