Sign in to follow this  
Followers 0
terminatorn

_GUICtrlIpAddress_Create bug and GUICtrlCreateCombo

4 posts in this topic

#1 ·  Posted (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 by terminatorn

Share this post


Link to post
Share on other sites



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:

#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
WEnd

I 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._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

But if I want CREATE the "GUICtrlCreateCombo" ( no HIDE/SHOW ) ?

Share this post


Link to post
Share on other sites

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:

#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._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

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
Sign in to follow this  
Followers 0