Profile Picture

What is the equivalent for System.Windows.Forms.KeyPressEventArgs in Nevron's Winforms?

Posted By Fábio Mello 14 Years Ago

What is the equivalent for System.Windows.Forms.KeyPressEventArgs in...

Author
Message
Fábio Mello
Posted 14 Years Ago
View Quick Profile
Junior Member

Junior Member (12 reputation)Junior Member (12 reputation)Junior Member (12 reputation)Junior Member (12 reputation)Junior Member (12 reputation)Junior Member (12 reputation)Junior Member (12 reputation)Junior Member (12 reputation)Junior Member (12 reputation)

Group: Forum Members
Last Active: 14 Years Ago
Posts: 12, Visits: 1
I'm using a Nevron.UI.WinForm.Controls.NComboBox but it seems there is no keypress event for it.

Nevron Support
Posted 14 Years Ago
View Quick Profile
Supreme Being

Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)

Group: Forum Members
Last Active: Last Week
Posts: 3,054, Visits: 4,009

Hello Fabio,

NComboBox has KeyPress even should work properly, only the arrow keys are not handled as it is in the standard .NET ComboBox control.



Best Regards,
Nevron Support Team



Fábio Mello
Posted 14 Years Ago
View Quick Profile
Junior Member

Junior Member (12 reputation)Junior Member (12 reputation)Junior Member (12 reputation)Junior Member (12 reputation)Junior Member (12 reputation)Junior Member (12 reputation)Junior Member (12 reputation)Junior Member (12 reputation)Junior Member (12 reputation)

Group: Forum Members
Last Active: 14 Years Ago
Posts: 12, Visits: 1
Thanks for the fast response, but the KeyPressEventHandler from System.Windows.Forms does not work with the Nevron.UI.WinForm.Controls.NComboBox, right? I would like to know if there is this kind of handler in Nevron.UI. If there is, please post the path to that handler; if not, what should I do (the code for it) to deal with the KeyPressEvent?

obs: myNComboBox.Editable = true; //it is necessary because the text is typed inside the text area

Nevron Support
Posted 14 Years Ago
View Quick Profile
Supreme Being

Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)

Group: Forum Members
Last Active: Last Week
Posts: 3,054, Visits: 4,009

Hello Fabio,

When Editable property is set to true you should attach to NComboBox.EditControl.KeyPress event.

 

 



Best Regards,
Nevron Support Team



Fábio Mello
Posted 14 Years Ago
View Quick Profile
Junior Member

Junior Member (12 reputation)Junior Member (12 reputation)Junior Member (12 reputation)Junior Member (12 reputation)Junior Member (12 reputation)Junior Member (12 reputation)Junior Member (12 reputation)Junior Member (12 reputation)Junior Member (12 reputation)

Group: Forum Members
Last Active: 14 Years Ago
Posts: 12, Visits: 1
It still doesn't work. This is the code:

private void InitializeComponent()
{
...#1
this.myForm.EditControl.KeyPress += new KeyPressEventHandler(this.EditControl_KeyPress);/*this is the wrong line*/
...
}

private void EditControl_KeyPress(object sender, KeyPressEventArgs e)
{
... do something;
}

What I am asking is: is this "KeyPressEventArgs" from "System.Windows.Forms" the proper event handler for Nevron.UI.WinForm.Controls.NComboBox? If not, what and where is the event handler? If it is, why there is a NullReferenceException in #1?

No error occurs when I use the System.Windows.Forms.Combobox, but I wanted to use the NCombobox.

Nevron Support
Posted 14 Years Ago
View Quick Profile
Supreme Being

Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)

Group: Forum Members
Last Active: Last Week
Posts: 3,054, Visits: 4,009

Hello Fabio,

You should attach to NComboBox.EditControl.KeyPress only when Editable property is true. The EditControl is actually a text box that represents the editable part of the combo box. When Editable is false EditControl will be null and you should be attached to NComboBox.KeyPress.

KeyPressEventArgs is the proper event argument for KeyPressEventHandler.

Basically you should do the following:

if (nComboBox1.EditControl != null)
{
    nComboBox1.EditControl.KeyPress +=
new KeyPressEventHandler(EditControl_KeyPress);
}
else
{
    nComboBox1.KeyPress +=
new KeyPressEventHandler(nComboBox1_KeyPress);
}

...

void nComboBox1_KeyPress(object sender, KeyPressEventArgs e)
{
    DoSomething(sender, e);
}

void EditControl_KeyPress(object sender, KeyPressEventArgs e)
{
    DoSomething(sender, e);
}

private void DoSomething(object sender, KeyPressEventArgs e)
{
   //Do Something.
}



Best Regards,
Nevron Support Team



Fábio Mello
Posted 14 Years Ago
View Quick Profile
Junior Member

Junior Member (12 reputation)Junior Member (12 reputation)Junior Member (12 reputation)Junior Member (12 reputation)Junior Member (12 reputation)Junior Member (12 reputation)Junior Member (12 reputation)Junior Member (12 reputation)Junior Member (12 reputation)

Group: Forum Members
Last Active: 14 Years Ago
Posts: 12, Visits: 1
Thank you



Similar Topics


Reading This Topic