NickProstrelchuk Posted October 5, 2010 Share Posted October 5, 2010 Hello, I have a problem with loading data into combo box. I have two combo boxes: one with Mailbox Server's names and one with Mailbox's names. If i selected Mailbox server from first Combo Box second combo box should load elements according to the selected Server name. I've written a code which selects server name from first combo box but second combo box hasn't loaded any items at all. When I've tried to perform this steps manually, all has worked fine. I think such situation is occurred because _GUICtrlComboBoxEx_SetCurSel method do not send any event to the control. I've tried to use ControlCommand method with "SelectString" and "SeCurrentSelection" params. But this solutions did not resolve my problem. Here is my peace of code: Local $index = _GUICtrlComboBoxEx_FindStringExact(ControlGetHandle("Select Mailbox", "","[NAME:m_serverComboBox]"),"Server") If $index > -1 Then _GUICtrlComboBoxEx_SetCurSel(ControlGetHandle("Select Mailbox", "","[NAME:m_serverComboBox]"),$index) EndIf Sleep(1000) $index = _GUICtrlComboBoxEx_FindStringExact(ControlGetHandle("Select Mailbox", "","[NAME:m_mailboxComboBox]"),"Mailbox") If $index > -1 Then _GUICtrlComboBoxEx_SetCurSel(ControlGetHandle("Select Mailbox", "","[NAME:m_mailboxComboBox]"),$index) EndIf Could you please help me to solve this problem. Best Regards, Nick Prostrelchuk. Link to comment Share on other sites More sharing options...
PsaltyDS Posted October 5, 2010 Share Posted October 5, 2010 (edited) You may need to send CBN_SELCHANGE as a WM_COMMAND. Note the comments from MSDN: CBN_SELCHANGE Notification Code that this is not done automatically: The CBN_SELCHANGE notification code is not sent when the current selection is set using the CB_SETCURSEL message. That CB_SETCURSEL is what you sent with _GuiCtrlComboBoxEx_SetCurSel().P.S. I thought this sounded familiar... Edited October 5, 2010 by PsaltyDS Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
NickProstrelchuk Posted October 6, 2010 Author Share Posted October 6, 2010 You may need to send CBN_SELCHANGE as a WM_COMMAND. Note the comments from MSDN: CBN_SELCHANGE Notification Code that this is not done automatically: That CB_SETCURSEL is what you sent with _GuiCtrlComboBoxEx_SetCurSel().P.S. I thought this sounded familiar... Thanks for you reply. I just added ControlSend method with according event and now all works fine. 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