Jump to content

GUICtrlComboBoxEx Show/Hide on Tabs


 Share

Recommended Posts

As my GUI grew I had to add tabs and that's where I encountered insurmountable problems with ComboBoxEx components.

I have followed advices to use ControlHide and ControlShow but it produces strange effects on both WinXP and Win7, comboboxex controls disappear, or they are not repainted or they are not clickable etc. If I use WinSetState @SW_HIDE/@SW_SHOW instead of ControlHide/ControlShow everything works OK but it is very very slow to hide components as I switch tabs - totally unusable.

I made small demo script based on my application to demonstrate effect. I might be making big mistake somewhere or skipped important information in help files?

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#Include <GuiComboBoxEx.au3>

$_Gui = GUICreate ( "dcc", 560, 520, -1, -1, -1, $WS_EX_LAYERED )
GUISetState(@SW_HIDE)
$child_GUI = GUICreate("xxy", 560, 520, -1, -1, -1, -1, $_Gui)
GUISetFont( 8.5, 300, -1, "Andale Mono" )
$childTab = GUICtrlCreateTab( 11, 11, 540, 500 )
    $tab1 = GUICtrlCreateTabItem( "  tab 1  " )
        $chp = _GUICtrlComboBoxEx_Create( $child_GUI, "", 30, 50, 140, 150, 0x0003 )
    $tab2 = GUICtrlCreateTabItem( "  tab 2  " )
        $crp = _GUICtrlComboBoxEx_Create( $child_GUI, "", 30, 50, 140, 150, 0x0003 )
    $tab3 = GUICtrlCreateTabItem( "  tab 3  " )
        GUICtrlCreateLabel( "I am just a label", 50, 404 )
GUICtrlCreateTabItem("")
GUISetState()

_GUICtrlComboBoxEx_AddString( $chp, "AA1" )
_GUICtrlComboBoxEx_AddString( $chp, "AA2" )
_GUICtrlComboBoxEx_AddString( $chp, "AA3" )
_GUICtrlComboBoxEx_AddString( $chp, "AA4" )
_GUICtrlComboBoxEx_SetCurSel( $chp, 0 )

_GUICtrlComboBoxEx_AddString( $crp, "BB1" )
_GUICtrlComboBoxEx_AddString( $crp, "BB2" )
_GUICtrlComboBoxEx_AddString( $crp, "BB3" )
_GUICtrlComboBoxEx_SetCurSel( $crp, 0 )

ControlHide( $crp, "", "" )

While 1
    $msg = GUIGetMsg()
    Switch( $msg )
        Case $GUI_EVENT_CLOSE
            Exit
        Case $childTab
            If GUICtrlRead( $childTab, 1 ) = $tab1 Then
                ControlHide( $crp, "", "" )
                ControlShow( $chp, "", "" )
            ElseIf GUICtrlRead( $childTab, 1 ) = $tab2 Then
                ControlHide( $chp, "", "" )
                ControlShow( $crp, "", "" )
            Else
                ControlHide( $crp, "", "" )
                ControlHide( $crp, "", "" )
            EndIf
    EndSwitch
WEnd
Link to comment
Share on other sites

  • Moderators

iDenoQ,

Obvious question: Why use the GUICtrlComboBoxEx UDF? What does it give you that the more usual Combo creation functions do not? :mellow:

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png 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 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

 

Link to comment
Share on other sites

To be honest, reason is half-stupid :mellow: - I got carried, started using Ex combobox thinking of using it's editing capabilities and abandoned that idea along the way (10 days of programming) - so I made style 0x0003 - and left it so I may use that feature again.

I will definitely change everything back to normal combobox since I tested and it works with tabs quite nicely.

Thanks for help!

Link to comment
Share on other sites

Oh well I remembered now - it was _GUICtrlComboBoxEx_GetItemText() that I used to use in comboboxex :mellow:

I didn't know that I could use _GUICtrlComboBoxEx_GetItemText() on ComboBox created with _GUICtrlComboBox_Create.

Now I know...

Edited by iDenoQ
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...