Disabled TabPage in DockingTab selectable by cursor-key

Posted by: lars.dankenbrink on 24 March 2021, 3:09 am EST

    • Post Options:
    • Link

    Posted 24 March 2021, 3:09 am EST - Updated 3 October 2022, 2:19 pm EST

    Hello support-team,

    I’ve got a question related to the DockingTab-control.

    As you see in screenshot there are 3 tabs available. Page 2 is Enabled=False and so not selectable by mouse-clicks.

    I expected that Page 2 is generally not selectable, but if you use cursor-keys (when tab-control has focus) then content gets visible.

    Is this the wanted behaviour?

    Is there a simple way to prevent the disabled tabpage from selecting with cursor-keys?

    Thank you!

    Lars

    C1DisabledTabPage.zip

  • Posted 24 March 2021, 5:10 pm EST

    Hi,

    You can use the SelectedIndexChanging event to cancel the selection change when the newly selected tab is a disabled tab and then set the new tab manually to the next enabled tab. You need to override the ProcessCmdKey to set a flag to know if the left or right key was used. Once you know which key was used you can change the selection to the left or right accordingly.

    Please refer to the sample attached.

    Regards.

    Avnish

    C1DisabledTabPage_mod.zip

  • Posted 25 March 2021, 6:57 pm EST

    Hello Avnish,

    I had hoped for a simpler solution, but your control-extension works great aswell and does the job.

    Thanks for spending time on the sample project and helping me out. :+1::+1::+1:

    Kind regards

    Lars

  • Posted 25 March 2021, 7:18 pm EST

    Hi Lars,

    Glad we could help.

    Regards.

    Avnish

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels