BJJ Posted January 12, 2009 Share Posted January 12, 2009 #include <GUIConstantsEx.au3> #include <ComboConstants.au3> Opt("GuiOnEventMode", 1) Global $aCombo[1] Dim $sY = 10 $hGUI = GUICreate("Test GUI", 200, 100) GUISetOnEvent($GUI_EVENT_CLOSE, "_Exit") For $i = 0 To UBound($aCombo) - 1 $aCombo[$i] = GUICtrlCreateCombo("", 50, $sY, 100, 20) GUICtrlSetData(-1, "Item 1|Item 2|Item 3", "Item 1") GUICtrlSetOnEvent(-1, "_GetCurSel") $sY += 30 Next GUISetState() While 1 Sleep(100) WEnd Func _GetCurSel() MsgBox(0, "Info", StringFormat("Current selected item: \nID: %s\nItem text: %s\nItem index: %s", _ @GUI_CtrlId, GUICtrlRead(@GUI_CtrlId), GUICtrlSendMsg(@GUI_CtrlId, $CB_GETCURSEL, 0, 0))) EndFunc Func _Exit() GUIDelete($hGUI) Exit EndFunc I want see difrent MsgBox for any item example I have a list 7 items a,b,c,d,e,f,g, etc. and 7 difrent msgbox's for a "hello" for b "hi" for c "aloha" etc. when i click on c want see attributable msgbox How change this code ?? Link to comment Share on other sites More sharing options...
martin Posted January 12, 2009 Share Posted January 12, 2009 Quzziy, Your script already does what I understand you want, so I must not understand what you want. Do you mean you want a msgbox if you click on the caption in the combobox? If not then you need to give a bit more detail. Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script. Link to comment Share on other sites More sharing options...
BJJ Posted January 12, 2009 Author Share Posted January 12, 2009 yes .. but difrent msgbox for any caption Link to comment Share on other sites More sharing options...
ResNullius Posted January 12, 2009 Share Posted January 12, 2009 Like this? expandcollapse popup#include <GUIConstantsEx.au3> #include <ComboConstants.au3> Opt("GuiOnEventMode", 1) Global $aCombo[1] Dim $sY = 10 $hGUI = GUICreate("Test GUI", 200, 100) GUISetOnEvent($GUI_EVENT_CLOSE, "_Exit") For $i = 0 To UBound($aCombo) - 1 $aCombo[$i] = GUICtrlCreateCombo("", 50, $sY, 100, 20) GUICtrlSetData(-1, "Item 1|Item 2|Item 3", "Item 1") GUICtrlSetOnEvent(-1, "_GetCurSel") $sY += 30 Next GUISetState() While 1 Sleep(100) WEnd Func _GetCurSel() Local $msgText Switch GUICtrlRead(@GUI_CtrlId) Case "Item 1" $msgText = "Hello" Case "Item 2" $msgText = "Hi" Case "Item 3" $msgText = "BYE" EndSwitch MsgBox(0,"Info", $msgText) EndFunc Func _Exit() GUIDelete($hGUI) Exit EndFunc Link to comment Share on other sites More sharing options...
BJJ Posted January 13, 2009 Author Share Posted January 13, 2009 Wonderfull This work brilaint Thx Link to comment Share on other sites More sharing options...
BJJ Posted January 16, 2009 Author Share Posted January 16, 2009 But hmm ..how use gui in place of $msgText = "Hello" ?? Link to comment Share on other sites More sharing options...
ResNullius Posted January 16, 2009 Share Posted January 16, 2009 But hmm ..how use gui in place of $msgText = "Hello" ??Do you mean to display a custom gui depending on what the combobox selection is?If so, would the gui for each case be very similar with just different text, or would it be a completely different gui (size, buttons, colour, etc) for each different selection? Link to comment Share on other sites More sharing options...
BJJ Posted January 17, 2009 Author Share Posted January 17, 2009 I want make each GUI for any item frome combobox If that be easy i can make one exemplary GUI for any item frome Combobox but use difrent background picture Link to comment Share on other sites More sharing options...
ResNullius Posted January 19, 2009 Share Posted January 19, 2009 I want make each GUI for any item frome combobox If that be easy i can make one exemplary GUI for any item frome Combobox but use difrent background pictureWell, depending on how dynamic you want the gui to be, I would look at something like this expandcollapse popup#include <GUIConstantsEx.au3> #include <ComboConstants.au3> #include <WindowsConstants.au3> #include <StaticConstants.au3> Opt("GuiOnEventMode", 1) Global $aCombo[1] Dim $sY = 10 $hGUI = GUICreate("Test GUI", 350, 200) GUISetOnEvent($GUI_EVENT_CLOSE, "_Exit") $Pic1 = GUICtrlCreatePic(@WindowsDir & "\Gone Fishing.bmp", 0, 0, 350, 200, BitOR($SS_NOTIFY, $WS_GROUP, $WS_CLIPSIBLINGS)) GUICtrlSetState(-1, $GUI_DISABLE) For $i = 0 To UBound($aCombo) - 1 $aCombo[$i] = GUICtrlCreateCombo("", 50, $sY, 100, 20) GUICtrlSetData(-1, "Fishing|Rhododendron|Sumida", "Fishing") GUICtrlSetOnEvent(-1, "_GetCurSel") $sY += 30 Next GUISetState() While 1 Sleep(10) WEnd Func _GetCurSel() Local $msgText Switch GUICtrlRead(@GUI_CtrlId) Case "Fishing" GUICtrlSetImage($Pic1, @WindowsDir & "\Gone Fishing.bmp") Case "Rhododendron" GUICtrlSetImage($Pic1, @WindowsDir & "\Rhododendron.bmp") Case "Sumida" GUICtrlSetImage($Pic1, @WindowsDir & "\River Sumida.bmp") EndSwitch EndFunc ;==>_GetCurSel Func _Exit() GUIDelete($hGUI) Exit EndFunc ;==>_Exit Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now