Jump to content

GUI Dropdown list MsgBox on selection


Recommended Posts

Hello,

 

is it possible to create MsgBox notice after user select from GUI drop down list a text but that text have no action in code, so I want to make a notice what the user should do if his selection cannot do any action.

 

Drop down list I have made in .ini file and the GUI reads it to show for user all possible selections.

So for example:

.ini has this list

 

[Name1]

City=NY

Country=USA

[Name2]

here is nothing, so my code should detect selection Name2 and give MsgBox notice after user click button Select

 

Link to post
Share on other sites
1 hour ago, Subz said:

Can you post your code, so we can get a better understanding of what you're trying to achieve?

The recent code is a little bit different but I can show similar example from my previous topics on this forum.

So, some of selections in the list will have only Name2 without Address, City and Country inside and I need to show MsgBox notice when user selects empty Name2 in droplist and clicks Select.


GUI below and .ini from previous post:

 

#include <ComboConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <Array.au3>
#include <ButtonConstants.au3>

#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 251, 137, 192, 124)
$Combo1 = GUICtrlCreateCombo("", 40, 24, 145, 25, BitOR($CBS_DROPDOWNLIST,$CBS_AUTOHSCROLL))
$Button1 = GUICtrlCreateButton("Select", 152, 56, 75, 25)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

Global $ini = 'companies.ini'
Global $sections = IniReadSectionNames($ini)
If IsArray($sections) Then
For $a = 1 To UBound($sections) - 1
    GUICtrlSetData($Combo1, $sections[$a])
Next
EndIf

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Button1
            $Address = IniRead($ini, guictrlread($Combo1), 'Address', '')
            $Country = IniRead($ini, guictrlread($Combo1), 'Country', '')
            $City = IniRead($ini, guictrlread($Combo1), 'City', '')
            ConsoleWrite('Address '&$Address&@TAB&' Country '&$Country&@TAB&' City '&$City&@CRLF)
            MsgBox(64 + 262144, guictrlread($Combo1), 'Address '&$Address&@TAB&' Country '&$Country&@TAB&' City '&$City&@CRLF)
    EndSwitch
WEnd
Link to post
Share on other sites

Do you mean something like:

Case $Button1
            $Address = IniRead($ini, guictrlread($Combo1), 'Address', '')
            $Country = IniRead($ini, guictrlread($Combo1), 'Country', '')
            $City = IniRead($ini, guictrlread($Combo1), 'City', '')
            If $Address = "" And $Country = "" And $City = "" Then ContinueLoop MsgBox(4096, "", "N/A")

 

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
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...