We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Autodropdown of RichTextEntryPanel

Thread ID:

Created:

Updated:

Platform:

Replies:

44946 Jun 7,2006 02:58 PM UTC Jun 8,2006 10:38 AM UTC Windows Forms 4
loading
Tags: GridControl
Christian Lützenkirchen
Asked On June 7, 2006 02:58 PM UTC

Hi, I derived GridRichTextBoxCellModel and GridCellRendererBase for an own implementation of the rich text dropdown-editor with XP-toolbar (V4.2.0.37). How can I automatically drop down the editor when a user starts to type printable characters after entering the (not dropped down) cell? Regards, Christian

Administrator [Syncfusion]
Replied On June 8, 2006 05:08 AM UTC

Hi Christian, To get the desired behavior, please add the code below in theCurrentCellKeyPress Event. Here is a code snippet. private void gridControl1_CurrentCellKeyPress(object sender, System.Windows.Forms.KeyPressEventArgs e) { GridCurrentCell cc = this.gridControl1.CurrentCell; //your custom cell render ... GridDerivedRichTextBoxCellRenderer cr = cc.Renderer as GridDerivedRichTextBoxCellRenderer; if( cr != null) { cc.ShowDropDown(); } } Regards, Haneef

Christian Lützenkirchen
Replied On June 8, 2006 08:45 AM UTC

Hi Haneef, thank you for your example. The example has two problems: 1. The panel is opend when the tab-key is pressed so I had to filter the tab key. (It was not opened by the left or right key), 2. My bigger problem is that the first character is not shown in the panel. How can I get my panel and how can I send the pressed key? Regards, Christian

Administrator [Syncfusion]
Replied On June 8, 2006 09:13 AM UTC

Hi Christian , Issue 1 : To show the dropdown when the Right/Left key is pressed , You need to handle the CurrentCellKeyDown Event. Here is a code snippet. private void gridControl1_CurrentCellKeyDown(object sender, System.Windows.Forms.KeyEventArgs e) { GridCurrentCell cc = this.gridControl1.CurrentCell; GridRichTextBoxCellRenderer cr = cc.Renderer as GridRichTextBoxCellRenderer; if(cr != null && ( Keys.Right == e.KeyData || Keys.Left == e.KeyData ) ) { cc.ShowDropDown(); e.Handled = true; } } Issue 2: Try this code to check the TabKey pressed in a cell, and assign the pressed Keychar in a richtextbox . Here is code snippet. private void gridControl1_CurrentCellKeyPress(object sender, System.Windows.Forms.KeyPressEventArgs e) { GridCurrentCell cc = this.gridControl1.CurrentCell; GridRichTextBoxCellRenderer cr = cc.Renderer as GridRichTextBoxCellRenderer; int Tabchar = (int)e.KeyChar; if(cr != null && Tabchar != 9) { cc.ShowDropDown(); GridRichTextEntryPanel panel = cr.DropDownContainer.Controls[0] as GridRichTextEntryPanel; if(panel != null) { RichTextBox richBox = panel.ActiveControl as RichTextBox; if( richBox != null) { richBox.Text += e.KeyChar.ToString(); richBox.SelectionStart = richBox.Text.Length; } } } } Let me know if this helps. Best Regards, Haneef

Christian Lützenkirchen
Replied On June 8, 2006 10:38 AM UTC

Hi Haneef, thank you very much. It works fine. I decided not to open then panel für tab, right or left key. Best Regards, Christian

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;