Hi,
My app using RibbonBar. I need to know whenever an item of a combobox (in the Ribbonbar) is selected ( even if user click on an item that has been already selected before).
The event SelectedIndexChanged and SelectedValueChanged are useless in the case: the user click to an already selected item
Thanks
Vu Anh Minh
Disclaimer: The information provided on DevExpress.com and affiliated web properties (including the DevExpress Support Center) is provided "as is" without warranty of any kind. Developer Express Inc disclaims all warranties, either express or implied, including the warranties of merchantability and fitness for a particular purpose. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.
Confidential Information: Developer Express Inc does not wish to receive, will not act to procure, nor will it solicit, confidential or proprietary materials and information from you through the DevExpress Support Center or its web properties. Any and all materials or information divulged during chats, email communications, online discussions, Support Center tickets, or made available to Developer Express Inc in any manner will be deemed NOT to be confidential by Developer Express Inc. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.
Hi,
Please try to use the following code:
private void comboBoxEdit1_Popup(object sender, EventArgs e) { PopupListBoxForm form = (sender as IPopupControl).PopupWindow as PopupListBoxForm; form.ListBox.MouseClick += new MouseEventHandler(ListBox_MouseClick); } void ListBox_MouseClick(object sender, MouseEventArgs e) { PopupListBox l = sender as PopupListBox; BaseListBoxViewInfo vi = l.GetViewInfo() as BaseListBoxViewInfo; BaseListBoxViewInfo.ItemInfo info = vi.GetItemInfoByPoint(e.Location); if(info.State==DrawItemState.Selected){ } }
Does this meet your requirements?
Thank you, Marina
Hi,
Your support is nearly what I need. But how do I know if the user select the item by press the Enter Key (not by mouse click)
(again the event SelectedIndexChanged and SelectedValueChanged are useless in the case: the user Press enter on an already selected item)
Best regards,
Vu Anh Minh
Vu Anh Minh,
Could you please describe what functionality you're trying to implement? What is the difference between a mouse click and the enter key in your application? Your sample with detailed steps describing your issue may be very helpful.
Thank you, Marina
Hi,
1/Description
I have one app with several profile settings.
I load a profile settings by select profile name in a combobox.
The user could changed a settings, so the app settings will be diffirence with the profile settings
If user reselect a already selected profile settings by mouse or keyboard I need to reload the settings from profile again
The issue is now I do not know if the user reselect a already selected profile to reload it.
2/I need the app working the same with the mouse and the keyboard
3/I attach an sample. Bellow are steps to reproduce the issue
Steps:
1/Select "Settings Profile": Two
2/Change "Settings Value" to 3
3/Select "Settings Profile": Two again by Mouse Click.
Notice that "Settings Value" is changed to 2. That is ok
4/Change "Settings Value" to 3
5/Select "Settings Profile": Two again but by the Keyboard not by Mouse.
Notice that "Settings Value" is still 3. That is not ok
Thanks
Vu Anh Minh
Hi,
Thank you for the clarification. I've found the following way to accomplish this task:
public RibbonForm1() { InitializeComponent(); repositoryItemComboBox1.Popup += new EventHandler(repositoryItemComboBox1_Popup); repositoryItemComboBox1.Leave += new EventHandler(repositoryItemComboBox1_Leave); } void repositoryItemComboBox1_Leave(object sender, EventArgs e) { ComboBoxEdit cmb = sender as ComboBoxEdit; if(cmb.SelectedItem.ToString()==v){ LoadSettingsProfile(); } } string v = String.Empty; void repositoryItemComboBox1_Popup(object sender, EventArgs e){ PopupListBoxForm form = (sender as IPopupControl).PopupWindow as PopupListBoxForm; v = form.ListBox.SelectedItem.ToString(); }
See the modified sample.
Thank you, Marina
Hi,
Thank you for your quickly reply. There is still one issue is that:
we only want to reload the Settings Profile if the user click or press Enter key on a profile. With the Leave event, if when the combobox is popup and user click outside the combobox (such as click to the app title) then the settings profile is reload. That is what we not want.
Thanks,
Vu Anh Minh
Hi Vu,
As far as I see, to achieve this behavior use the first suggested solution, and additionally handle the RepositoryItemComboBox.KeyDown event in the following manner:
void repositoryItemComboBox1_KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.Enter) { LoadSettingsProfile(); } }
I have modified your project accordingly. It is attached. Please let us know if this makes sense.
Thanks,
Michael.
Hi,
Sorry that I was busy with other thing so I could not check your immediately.
There is still issue with you solution. Could you pls. follow the bellow steps:
1/ Run the sample
2/ Set the "Settings Profile to" to "One"
3/ Set the "Settings Value" to 3
4/ Select the "Settings Profile" "Two" by Keyboard
Notice that first the KeyDown event is fired and the LoadSettingsProfile() is load the "Setting Profile" "One". This is wrong and we need to avoid that.
After that the EditValueChanged is fired and the LoadSettingsProfile() is load the "Setting Profile" "Two". That is correct.
Thank you,
Vu Anh Minh
Hi Vu,
Thank you for the additional information. To overcome this issue, use delayed calls to the LoadSettingsProfle method. So, the editor is updated before we read it. Also, you should remove the KeyDown event handler when the popup form is closed. I have modified my sample project accordingly. It is attached.
Thanks,
Michael.
It works exactly as I wanted
Thank a lot,
Vu Anh Minh
Your help is helpful
Thanks
Vu Anh Minh