Jump to content

How to disable a drobdown menu?


DannyJ
 Share

Recommended Posts

Hello Auto It Forum,

I load an Excel file to a dropdown menu, and it takes several seconds.

I want to disable this menu until the Excel is not loaded. 

While the Dropdown writes that Loading I want to disable the drotown

Here is my example, which is unfortunately it works inversely: 

So it DISables the button after it loaded, I need that before

#include <Array.au3>
#include <SendMessage.au3>
#include <GUIConstantsEx.au3>
#include <ComboConstants.au3>
#include <WindowsConstants.au3>
#include <_XLSXReadToArray.au3>

#include <Excel.au3>

#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 615, 437)

$hCombo = GUICtrlCreateCombo("Loading", 120, 192, 400, 30, BitOR($GUI_SS_DEFAULT_COMBO, $CBS_SIMPLE, $CBS_DISABLENOSCROLL))

GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

Local $aXLSX, $iError, $iExtended, $sXLSX
$aXLSX = _XLSXReadToArray(@ScriptDir & "\abc.xlsx", 0, 0, 0)
ConsoleWrite("Fonoöts " & $aXLSX & @CRLF)
;_Excel_SheetActivate($aXLSX, "DATA")
;$list = _Excel_SheetList($aXLSX)
;ConsoleWrite($list)
$iError = @error
$iExtended = @extended
ConsoleWrite("$iError = " & $iError & " - $iExtended = " & $iExtended & @LF)
;_ArrayDisplay($aXLSX)


For $i = 2 To $aXLSX[0][0]
    $sXLSX &= $aXLSX[$i][0] & "|"
    ;ConsoleWrite("$sXLSX: " & $sXLSX & @CRLF)
Next

_SendMessage(GUICtrlGetHandle($hCombo), $CB_RESETCONTENT)
GUICtrlSetData($hCombo, $sXLSX, "")
_SendMessage(GUICtrlGetHandle($hCombo), $CB_RESETCONTENT)
GUICtrlSetState($hCombo, $GUI_Disable)

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $hCombo
            $sXLSX = GUICtrlRead($hCombo)
            For $i = 2 To $aXLSX[0][0]
                If $sXLSX = $aXLSX[$i][0] Then
                    MsgBox(0, $i, $aXLSX[$i][1])
                    ;;do something
                    ;;$aXLSX[$i][1]
                    ;;$aXLSX[$i][2]
                    ;;$aXLSX[$i][3]
                    ExitLoop
                EndIf
            Next

    EndSwitch
WEnd

 

Thank you in advance  your help :)

Link to comment
Share on other sites

Suggestion (untested)

GUICtrlSetState($hCombo, $GUI_Disable)

For $i = 2 To $aXLSX[0][0]
    $sXLSX &= $aXLSX[$i][0] & "|"
    ;ConsoleWrite("$sXLSX: " & $sXLSX & @CRLF)
Next
GUICtrlSetData($hCombo, "|" & $sXLSX, "")

GUICtrlSetState($hCombo, $GUI_Enable)

Edit
If the above fails you might try  _GUICtrlComboBox_BeginUpdate

 

Edited by mikell
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...