Jump to content

Where is my fault?


 Share

Recommended Posts

Hi!

I've a problem to destroy the content of a combo box.

It seems to be the same as in the help, but :mellow:

Someone have a look?

Thanks!

#NoTrayIcon

#include <ButtonConstants.au3>

#include <GuiComboBoxEX.au3>

#include <GUIConstantsEx.au3>

#include <WindowsConstants.au3>

HotKeySet("{ESC}", "CLOSE")

Opt("MustDeclareVars", 0)

Global $Line, $Edit

Global $Username, $Combo1

Gui()

CLOSE()

Func Gui()

$Form1_1_1 = GUICreate("Userinfo", 200, 180, 190, 122)

GUICtrlSetResizing(-1, $GUI_DOCKWIDTH+$GUI_DOCKHEIGHT)

$Tab1 = GUICtrlCreateTab(0, 0, 913, 761)

;### TEST

$Suchen2 = GUICtrlCreateButton("Suchen2", 48, 60, 105, 33, $BS_DEFPUSHBUTTON)

GUICtrlSetFont(-1, 18, 800, 0, "Arial")

$Combo1 = GUICtrlCreateCombo("", 50, 100, 100, 25)

$Label1 = GUICtrlCreateLabel("Computername", 220, 552, 75, 17)

GUICtrlSetState(-1, $GUI_HIDE)

GUISetState(@SW_SHOW)

GUICtrlSetState($Username, $GUI_CHECKED)

GUISetState(@SW_SHOW)

GUICtrlSetData($Combo1, "111|aaa|222|ccc","222")

$x = 1

While 1

$nMsg = GUIGetMsg()

Select

Case $nMsg = $GUI_EVENT_CLOSE

Exit

Case $nMsg = $Suchen2

_GUICtrlComboBoxEx_ResetContent($Combo1)

EndSelect

WEnd

EndFunc

Func CLOSE()

FileDelete(@TempDir & "\adfind.exe")

Exit

EndFunc

Combo_test.au3

Link to comment
Share on other sites

Use GUICtrlSetData($Combo1, '') instead of _GUICtrlComboBoxEx_ResetContent($Combo1)

Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times

Link to comment
Share on other sites

Use GUICtrlSetData($Combo1, '') instead of _GUICtrlComboBoxEx_ResetContent($Combo1)

Hi Xenobiologist,

thanks for your help. This works ! :(

I found the "_GUICtrlComboBoxEx_ResetContent" in the help file and it seems to be the right thing.

Can you explain the difference?

Thx

Dizzy

Link to comment
Share on other sites

Hi,

I guess this command works with a ComBoxEX.

See here:

HotKeySet("{ESC}", "CLOSE")

Opt("MustDeclareVars", 0)

Global $Line, $Edit
Global $Username, $hCombo

Gui()
CLOSE()


Func Gui()
    $hGUI = GUICreate("Userinfo", 200, 180, 190, 122)
    GUICtrlSetResizing(-1, $GUI_DOCKWIDTH + $GUI_DOCKHEIGHT)
;~  $Tab1 = GUICtrlCreateTab(0, 0, 913, 761)
    ;### TEST
    $Suchen2 = GUICtrlCreateButton("Suchen2", 48, 60, 105, 33, $BS_DEFPUSHBUTTON)
    GUICtrlSetFont(-1, 18, 800, 0, "Arial")

    $hCombo = _GUICtrlComboBoxEx_Create($hGUI, "111", 50, 100, 100, 225 )

    _GUICtrlComboBoxEx_InitStorage($hCombo, 150, 300)

    _GUICtrlComboBoxEx_BeginUpdate($hCombo)
    For $x = 0 To 149
        _GUICtrlComboBoxEx_AddString($hCombo, StringFormat("%03d : Random string", Random(1, 200, 1)), $x, $x)
    Next
    _GUICtrlComboBoxEx_EndUpdate($hCombo)
    $Label1 = GUICtrlCreateLabel("Computername", 220, 552, 75, 17)

    GUICtrlSetState(-1, $GUI_HIDE)
    GUICtrlSetState($Username, $GUI_CHECKED)
    GUISetState(@SW_SHOW)

    $x = 1
    While 1
        $nMsg = GUIGetMsg()
        Select
            Case $nMsg = $GUI_EVENT_CLOSE
                Exit
            Case $nMsg = $Suchen2
                ConsoleWrite("NOW" & @CRLF)
                MsgBox(4160, "Information", "Count: " & _GUICtrlComboBoxEx_GetCount ($hCombo))
                _GUICtrlComboBoxEx_ResetContent($hCombo)
        EndSelect
    WEnd
EndFunc ;==>Gui

Func CLOSE()
    FileDelete(@TempDir & "\adfind.exe")
    Exit
EndFunc ;==>CLOSE

Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times

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...