Problem on Key binding

  1. #1

    Problem on Key binding

    Hi there
    My problem is when I use the code below in two windows that are opened in Desktop control, assigned short keys will raising button click event of the first added window not in second one.

    <ext:ButtonGroup ID="ButtonGroupClipboard" runat="server" Title="Clipboard" Columns="4">
        <Content>
            <ext:KeyMap runat="server" Target="#{ContentPanel}">
                <Binding>
                    <ext:KeyBinding Ctrl="True" Handler="#{ButtonCopy}.fireEvent('click');">
                        <Keys>
                            <ext:Key Code="C"/>
                        </Keys>
                    </ext:KeyBinding>
                    <ext:KeyBinding Ctrl="True" Handler="#{ButtonPaste}.fireEvent('click');">
                        <Keys>
                            <ext:Key Code="V"/>
                        </Keys>
                    </ext:KeyBinding>
                    <ext:KeyBinding Ctrl="True" Handler="#{ButtonCut}.fireEvent('click');">
                        <Keys>
                            <ext:Key Code="X"/>
                        </Keys>
                    </ext:KeyBinding>
                </Binding>
            </ext:KeyMap>
        </Content>
        <Items>
            <diten:Button ID="ButtonPinTo" runat="server" Text="Pin to Quick access" OverflowText="Pin..." Scale="Large" IconAlign="Top" RowSpan="3" ToolTip="Pin folder to quick access" OnClick="ButtonPinTo_Click"/>
            <diten:Button ID="ButtonCopy" runat="server" Text="Copy" Icon="PageCopy" Scale="Large" IconAlign="Top" RowSpan="3" ToolTip="Copy the selected items to clipboard (Ctrl+C)." OnClick="ButtonCopy_Click"/>
            <diten:Button ID="ButtonPaste" runat="server" Text="Paste" Icon="PagePaste" Scale="Large" IconAlign="Top" RowSpan="3" ToolTip="Paste the contents of Clipboard to the curent location. (Ctrl+V)" OnClick="ButtonPaste_Click"/>
            <diten:Button ID="ButtonCut" runat="server" Text="Cut" Icon="Cut" ToolTip="Move the selected items to the Clipboard. (Ctrl+X)" OnClick="ButtonCut_Click"/>
            <diten:Button ID="ButtonCopyPath" runat="server" Text="Copy path" Icon="PageCopy" ToolTip="Copy the path of selected items to the Clipboard." OnClick="ButtonCopyPath_Click"/>
            <diten:Button ID="ButtonPasteShorcut" runat="server" Text="Paste shorcut" Icon="PagePaste" ToolTip="Paste shortcuts to the items on the Clipboard." OnClick="ButtonPasteShorcut_Click"/>
        </Items>
        <Content>
        </Content>
    </ext:ButtonGroup>
    I found a way for solving this problem but it's not pratic. After some research I found out ID of Buttons must not be the same in windows. for example if in window A and in window B we set ButtonCopy as ID of copy button Handler of KeyBinding can not diagnose these two buttons are in separated windows. If we change ID of button in window A to WindowA_ButtonCopy and in window B we set it to WindowB_ButtonCopy, Handler of KeyBinding will works fine but if we use same ID for buttons in Window A and window B handler could not diagnose window B ButtonCopy.

    and why the code below not works:

            <diten:Button ID="ButtonCopy" runat="server" Text="Copy" Icon="PageCopy" Scale="Large" IconAlign="Top" RowSpan="3" ToolTip="Copy the selected items to clipboard (Ctrl+C)." OnClick="ButtonCopy_Click">
                <KeyMap Target="#{ContentPanel}">
                    <Binding>
                        <ext:KeyBinding Ctrl="True" Handler="#{ButtonCopy}.fireEvent('click');">
                            <Keys>
                                <ext:Key Code="C"/>
                            </Keys>
                        </ext:KeyBinding>
                    </Binding>
                </KeyMap>
            </diten:Button>
    Last edited by ArashRahimian; Jul 03, 2017 at 6:47 PM.
  2. #2
    Hello @ArashRahimian!

    Thanks for sharing your experience with the issue. This is something really broken in current Ext.NET code, but has some known workarounds that could work nicer for you, not sure in the context of having user controls. There's an open issue with this issue (as long as it is not specific to user controls) at Keymap in gridpanel not working. I believe during your research you probably been thru this thread but felt like sharing the topic here for a related (closely) issue that's currently open.

    We really should review this key mapping issue for our next release, 4.3.0. Interesting that it has been out at least since 4.0.0 but took a while to be raised.

    Well, if you weren't aware of the topic above, please give it a look, it may bring useful insight for better approaches to binding keys on current Ext.NET versions.
    Fabrício Murta
    Developer & Support Expert
  3. #3

    TX for reply

    TX for reply

Similar Threads

  1. [CLOSED] Binding problem with <ext:Store>
    By aditya in forum 2.x Premium Help
    Replies: 4
    Last Post: Feb 18, 2014, 8:36 AM
  2. problem with CheckboxGroup Binding....
    By antoreegan in forum 2.x Help
    Replies: 2
    Last Post: Apr 12, 2013, 7:24 AM
  3. Problem in store binding
    By softlabsgroup.support in forum 1.x Help
    Replies: 0
    Last Post: Jun 09, 2012, 7:15 AM
  4. Problem with combo binding on direct event
    By reezvi in forum 1.x Help
    Replies: 0
    Last Post: May 05, 2012, 1:50 PM
  5. [CLOSED] Combobox Data Binding Problem
    By Vasudhaika in forum 1.x Premium Help
    Replies: 4
    Last Post: Feb 09, 2011, 1:55 PM

Tags for this Thread

Posting Permissions