Ticket T151540
Visible to All Users
Duplicate

We have closed this ticket because another page addresses its subject:

Layout - How to switch between the Tab and Enter keys to focus controls on a Windows Form

Problems with DatePropertyEditor and LookupPropertyEditor when using the EnterMoveNextControl option

created 10 years ago

hI,
I create a controller for detailview in module.win to switch tab and enter keys to focus control on a form. It works fine for all controls (textbox, combobox, checkbox), except datecontrol and lookupedit control. When i press enter in that controls, show the popup, how to fix that?
How to disable open the popup when i press enter key? I want to work like Tab key.
Thanks

Answers approved by DevExpress Support

created 10 years ago (modified 10 years ago)

Hello Tzanis,

The behavior of the DatePropertyEditor as well as ways around it are described in the confused about EnterMoveNextControl ticket. As for the LookupPropertyEditor, you will also likely need to handle the control's KeyDown event and process it accordingly, but I would need some additional time to verify. I will update this thread if a different solution is required for this editor.

UPDATE:
The LookupEdit control used by our LookupPropertyEditor listens to the keyboard and shows a popup as a result. So, you will have to create custom LookupEdit and LookupPropertyEditor classes to manage this behavior as you want, I am afraid:

C#
protected override void OnEditorKeyPress(KeyPressEventArgs e) { base.OnEditorKeyPress(e); if(!Properties.ReadOnly && !e.Handled && e.KeyChar != '\t') { char charCode = e.KeyChar; if(Properties.CharacterCasing != CharacterCasing.Normal) { charCode = Properties.CharacterCasing == CharacterCasing.Lower ? Char.ToLower(e.KeyChar) : Char.ToUpper(e.KeyChar); } ShowPopup(); if(!Char.IsControl(charCode) || charCode == '\b') { string searchString = charCode == '\b' ? "" : charCode.ToString(); PopupForm.Template.SetStartSearchString(searchString); } e.Handled = true; //B30072 } } protected override void OnEditorKeyDown(KeyEventArgs e) { base.OnEditorKeyDown(e); if(e.KeyData == (Keys.Down | Keys.Alt) || e.KeyCode == Keys.Delete) { if(!Properties.ReadOnly && !e.Handled) { ShowPopup(); PopupForm.Template.SetStartSearchString(""); e.Handled = true; } } }
    Comments (3)
    Dennis Garavsky (DevExpress) 10 years ago

      I have updated my previous answer accordingly.

        Hi dennis,
        can you sent me the complete source?
        thanks.

        Dennis Garavsky (DevExpress) 10 years ago

          Tzanis,

          If you are looking for the source code of the built-in editors I mentioned, then it is installed on your machine:
          <YourDevExpressInstallationFolder>\Components\Sources\DevExpress.ExpressApp\DevExpress.ExpressApp.Win\Editors\DatePropertyEditor.cs
          <YourDevExpressInstallationFolder>\Components\Sources\DevExpress.ExpressApp\DevExpress.ExpressApp.Win\Editors\LookupPropertyEditor.cs
          If you are asking for a sample implementing the aforementioned solutions, then I am afraid we do not have a ready one at the moment. I will be more than happy to help you implement these solutions if you experience any concrete difficulties with them, though.

          Other Answers

          created 10 years ago

          Thank you very much Dennis

            Comments (1)
            Dennis Garavsky (DevExpress) 10 years ago

              You're always welcome, Tzanis

              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.