terminatorn Posted April 11, 2010 Share Posted April 11, 2010 (edited) Hi ! #include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <GuiIPAddress.au3> #include <TabConstants.au3> #include <WindowsConstants.au3> #Region ### START Koda GUI section ### Form= $Form2 = GUICreate("Tabbed Notebook Dialog", 419, 285, 306, 185) GUISetIcon("D:\005.ico") $PageControl1 = GUICtrlCreateTab(8, 8, 396, 256) GUICtrlSetResizing(-1, $GUI_DOCKWIDTH+$GUI_DOCKHEIGHT) $TabSheet1 = GUICtrlCreateTabItem("TabSheet1") $Button1 = GUICtrlCreateButton("Button1", 24, 56, 75, 25, $WS_GROUP) GUICtrlSetFont(-1, 8, 400, 0, "Arial") $IPAddress1 = _GUICtrlIpAddress_Create($Form2, 24, 176, 130, 21) _GUICtrlIpAddress_Set($IPAddress1, "0.0.0.0") $TabSheet2 = GUICtrlCreateTabItem("TabSheet2") $TabSheet3 = GUICtrlCreateTabItem("TabSheet3") GUICtrlCreateTabItem("") GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Button1 $Com_Ctrl11 = GUICtrlCreateCombo("no icon", 100, 100, 145, 25) GUICtrlSetData(-1, "2|3|4|5") EndSwitch WEnd And 2 problems: - _GUICtrlIpAddress_Create() Appears in all the tabs - Creating a GUICtrlCreateCombo() after the creation of the tabs go "transparent" Thank you in advance =) Edited April 11, 2010 by terminatorn Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted April 11, 2010 Moderators Share Posted April 11, 2010 terminatorn,Not bugs, just another example of the problems mixing "built-in" and "UDF-created" controls. 1. The UDF creates another "window" rather than a "control" (it is more involved than that, but the analogy will serve for the moment ) and so AutoIt does not realise that it is supposed be on one tab only. So you have to do the work of hiding/showing the IP address input depending on the tab selected.2. Here you are creating the Combo control outside of the tab definition space, so AutoIt does not recognise that you want the control limited to the first tab only. The solution? Create the Combo within the tab definiton space, hide it, and then show it when the button is pressed.Look for the <<<<<<<<<<<<< lines:expandcollapse popup#include <GUIConstantsEx.au3> #include <GuiIPAddress.au3> #include <TabConstants.au3> #include <WindowsConstants.au3> $Form2 = GUICreate("Tabbed Notebook Dialog", 419, 285, 306, 185) GUISetIcon("D:\005.ico") $PageControl1 = GUICtrlCreateTab(8, 8, 396, 256) GUICtrlSetResizing(-1, $GUI_DOCKWIDTH + $GUI_DOCKHEIGHT) $TabSheet1 = GUICtrlCreateTabItem("TabSheet1") $Button1 = GUICtrlCreateButton("Button1", 24, 56, 75, 25, $WS_GROUP) GUICtrlSetFont(-1, 8, 400, 0, "Arial") $IPAddress1 = _GUICtrlIpAddress_Create($Form2, 24, 176, 130, 21) _GUICtrlIpAddress_Set($IPAddress1, "0.0.0.0") ; Create combo and hide it $Com_Ctrl11 = GUICtrlCreateCombo("no icon", 100, 100, 145, 25); <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< GUICtrlSetState(-1, $GUI_HIDE); <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< GUICtrlSetData(-1, "2|3|4|5"); <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< $TabSheet2 = GUICtrlCreateTabItem("TabSheet2") $TabSheet3 = GUICtrlCreateTabItem("TabSheet3") GUICtrlCreateTabItem("") GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Button1 ; Show the combo GUICtrlSetState($Com_Ctrl11, $GUI_SHOW); <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< Case $PageControl1 ; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< ; Show/Hide the IP Input as required Switch GUICtrlRead($PageControl1) Case 0 WinSetState($IPAddress1, "", @SW_SHOW) Case Else WinSetState($IPAddress1, "", @SW_HIDE) EndSwitch EndSwitch WEndI hope that is all clear - please ask again if not. M23 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: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
terminatorn Posted April 11, 2010 Author Share Posted April 11, 2010 But if I want CREATE the "GUICtrlCreateCombo" ( no HIDE/SHOW ) ? Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted April 11, 2010 Moderators Share Posted April 11, 2010 terminatorn, But if I want CREATE the "GUICtrlCreateCombo"Then you will have it visible on all the tabs unless you write code to deal with it, as I did with the IP address input. As I explained above, only "built-in" controls created within the tab creation space are dealt with by AutoIt, you have to do the rest: expandcollapse popup#include <GUIConstantsEx.au3> #include <GuiIPAddress.au3> #include <TabConstants.au3> #include <WindowsConstants.au3> ; Create place holder for combo ControlID $Com_Ctrl11 = 9999 ; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< $Form2 = GUICreate("Tabbed Notebook Dialog", 419, 285, 306, 185) GUISetIcon("D:\005.ico") $PageControl1 = GUICtrlCreateTab(8, 8, 396, 256) GUICtrlSetResizing(-1, $GUI_DOCKWIDTH + $GUI_DOCKHEIGHT) $TabSheet1 = GUICtrlCreateTabItem("TabSheet1") $Button1 = GUICtrlCreateButton("Button1", 24, 56, 75, 25, $WS_GROUP) GUICtrlSetFont(-1, 8, 400, 0, "Arial") $IPAddress1 = _GUICtrlIpAddress_Create($Form2, 24, 176, 130, 21) _GUICtrlIpAddress_Set($IPAddress1, "0.0.0.0") $TabSheet2 = GUICtrlCreateTabItem("TabSheet2") $TabSheet3 = GUICtrlCreateTabItem("TabSheet3") GUICtrlCreateTabItem("") GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Button1 $Com_Ctrl11 = GUICtrlCreateCombo("no icon", 100, 100, 145, 25) GUICtrlSetData(-1, "2|3|4|5") GUICtrlSetState(-1, $GUI_HIDE) ; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< GUICtrlSetState(-1, $GUI_SHOW) ; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< Case $PageControl1 ; Show/Hide the IP input & combo as required Switch GUICtrlRead($PageControl1) Case 0 WinSetState($IPAddress1, "", @SW_SHOW) If $Com_Ctrl11 <> 9999 Then GUICtrlSetState($Com_Ctrl11, $GUI_SHOW) ; <<<<<<<<<<<<< Case Else WinSetState($IPAddress1, "", @SW_HIDE) GUICtrlSetState($Com_Ctrl11, $GUI_HIDE) ; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< EndSwitch EndSwitch WEnd Note that you will have to hide/show the Combo when it is created so AutoIt displays it correctly over the tab control. You also need a placeholder for the Combo ControlID so that you do not get an "undeclared variable" error when you change tab before creating it. M23 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: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area 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