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.

GDBD CommandStack

Thread ID:

Created:

Updated:

Platform:

Replies:

47359 Aug 3,2006 08:53 AM Aug 7,2006 07:33 AM Windows Forms 9
loading
Tags: GridControl
Marek Solarski
Asked On August 3, 2006 08:53 AM

Hi,

How can I disable Shortcuk Keys (ALT+Z) in GDBG.
I set
this.Model.CommandStack.Enabled = false;

but wheen I press ALT+Z redo i generated.

Best regards,
MS

Administrator [Syncfusion]
Replied On August 3, 2006 03:02 PM

Try handling the CurrentCellKeyDown event to see if that does what you need.

void gridDataBoundGrid1_CurrentCellKeyDown(object sender, KeyEventArgs e)
{
if((e.Alt && e.KeyCode == Keys.Z)
|| (e.Control && e.KeyCode == Keys.Z))
{
e.Handled = true;
}
}

Marek Solarski
Replied On August 3, 2006 06:23 PM

Hi,

Thank you for your answer.

I forgot to add that in my country RIGHT ALT + Z is a combination for a special character. I''d like this combination to put this special character in grida and not to generate undo/redo commands.

Regards,
MS

Administrator [Syncfusion]
Replied On August 4, 2006 05:09 AM

Hi Marek,

You can handle the CurrentCellKeyDown event and try to put the special character there itself. Try the code below.

void gridDataBoundGrid1_CurrentCellKeyDown(object sender, KeyEventArgs e)
{
GridCurrentCell cc = this.gridDataBoundGrid1.CurrentCell;
if((e.Alt && e.KeyCode == Keys.Z) || (e.Control && e.KeyCode == Keys.Z))
{
string str = cc.Renderer.ControlText;
cc.Renderer.ControlText = str + "spl-char";
e.Handled = true;
}
}

Let us know if this helps.
Thanks,
Rajagopal

Marek Solarski
Replied On August 4, 2006 09:58 AM

Hi,
I tried your code.

cc.Renderer.ControlText is correct and contains special character.
But GDBG seems to catch the undo command anyway (although I set e.Handled = true) and any of my changes to cell value is being undone (rolled back by undo command) :(

Regards,
ms

Marek Solarski
Replied On August 4, 2006 10:00 AM

PS

Maybe I should handle

protected override bool ProcessCmdKey(ref Message msg, Keys keyData) {}

But I can''t figure out how to check whether ALT+Z was pressed.

Administrator [Syncfusion]
Replied On August 7, 2006 02:12 AM

Hi Marek,

Please try the below piece of code.

protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
{
if(this.gridDataBoundGrid1.CurrentCell != null)
{
if((Control.ModifierKeys & Keys.Alt) != 0)
{
if ((keyData & Keys.Z) == Keys.Z)
{
Console.WriteLine("Hello");
return true;
}
}
}
return base.ProcessCmdKey (ref msg, keyData);
}

Let me know if you need any further assistance.
Thanks,
Rajagopal

Administrator [Syncfusion]
Replied On August 7, 2006 05:07 AM

Hi,

Thank you - it works! However cell contents becames highlighted.

Could you please tell me how to make grid not to highlight the cell contents after I press ALT+Z

I replaced your line:
Console.WriteLine("Hello");

with

GDBD.CurrentCell.Renderer.ControlText += "spec-ch";

Regards,
Marek

Administrator [Syncfusion]
Replied On August 7, 2006 05:31 AM

Hi Marek,

Try adding the code below, this will help you.

///
this.gridDataBoundGrid1.CurrentCell.Renderer.ControlText += "spec-ch";

GridTextBoxCellRenderer tr = this.gridDataBoundGrid1.CurrentCell.Renderer as GridTextBoxCellRenderer;
tr.TextBox.SelectionStart = this.gridDataBoundGrid1.CurrentCell.Renderer.ControlText.Length;
tr.TextBox.SelectionLength = 0;
////

Regards,
Rajagopal

Administrator [Syncfusion]
Replied On August 7, 2006 07:33 AM

Thank you, it works!

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.

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.

;