Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
215
UltraPopupControlContainer force focus to popup control
posted

I am using the UltraPopupControlContainer with an UltraListView as the popup control.  The show occurs on a click of a button as follows (a button within a UltraFormattedTextEditor):

        /// <summary>
        /// Show the samples pick list when the button in the text editor is pressed.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void textDateTimeFormatButton_Click(object sender, EditorButtonEventArgs e)
        {
            popupControlContainer.Show();
        }

My problem is that once the list has opened, I would like the list to have the focus such that the user can right away scroll using the mouse wheel or the keyboard arrows, not having to click in the list to set the focus.

Here is what I try now, but the list view does not get the focus:

        /// <summary>
        /// To give focus to the contained control.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void listViewPickList_MouseEnter(object sender, EventArgs e)
        {
            listViewPickList.PerformAction(UltraListViewAction.ActivateFirst);
            listViewPickList.Select();
        }

I also tried popupControlContainer.PopupControl.Select();, which should be the same anyway, without success. I also tried the same code immediately after the Show in the event textDateTimeFormatButton_Click, no success. In fact, at first I would have expected the list view to have the focus on Show without anything else to do.

The use of listViewPickList.PerformAction(UltraListViewAction.ActivateFirst) does select an item in the list, but still no scroll control (and no hot tracking either) until I click in the list.

Any idea what is going on? Should the Show set the focus as I was expecting? If not, is it a bug or is there another way?

Thanks in advance for your help.