Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / WinForms > Buttons, RadioButton, CheckBox, etc > Accept Button on ToolWindow

Not answered Accept Button on ToolWindow

Feed from this thread
  • Adam avatar

    Posted on Aug 9, 2011 (permalink)

    I have a rather complex application that has many UI components. I'm attempting to use the radDock and create a ToolWindow that has search capabilities. This ToolWindow has a RadPanel on it with RadTextBoxes for the different fields they can search. It also has a RadButton to perform the search. What I'd like to do is have it so when the user clicks in the panel or clicks in the textbox, that the AcceptButton for the form becomes the search button...

    example:

    private void customerSearchNumberTextBox_GotFocus(object sender, EventArgs e)
    {
        this.AcceptButton = customerSearchButton;
    }
     
    private void customerSearchButton_Click(object sender, EventArgs e)
    {
        int i = 1;
    }

    However, this isn't working...the GotFocus event fires, and the above code is executed, but when I hit 'enter' nothing happens....the click event doesn't fire...thoughts?

    Reply

  • Adam avatar

    Posted on Aug 9, 2011 (permalink)

    Ultimate goal here is to have AcceptButton be different based on what they are currently doing in the UI. A work around (which I'd rather not code up if there is another solution) would be to check the OnKeyPress event...if it's enter, then manually execute the search. Seems clunky and hackish given that AcceptButton was written to do this...

    Reply

  • Alexander Alexander admin's avatar

    Posted on Aug 11, 2011 (permalink)

    Hello Adam,

    Thank you for your question.

    I suppose you use auto-hidden ToolWindow in your scenario. This window is hosted in its own form (toolWindow1.FloatingParent) and this is the form which receives the pressed Enter key. This is why it never reaches your main form. Even checking the OnKeyPress event in your main form will not allow you to handle the pressed key.

    You can achieve your scenario handling KeyPress events to the individual controls in the ToolWindow.

    I hope it helps.

    Best regards,
    Alexander
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get now >>

    Reply

Back to Top

Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / WinForms > Buttons, RadioButton, CheckBox, etc > Accept Button on ToolWindow
Related resources for "Accept Button on ToolWindow"

[ Features | Demos | Documentation | Knowledge Base | Telerik TV | Code Library | Step-by-step Tutorial | Blogs | Self-Paced Trainer ]