[Mono-winforms-list] SendKeys

martin at fony.sk martin at fony.sk
Fri Feb 16 03:00:48 EST 2007


Hi

so 1.2.3 version is here and I tried to implement SendKeys.Send() into my
application, but it doesnt work.

My application looks like this:

...

//window
Window win = new Window ("...");
VBox vbox = new VBox (false, 1);
win.Add (vbox);
HBox entry_bar = new HBox (false, 1);
//entry widget
Entry entry = new Entry ("");							entry_bar.PackStart (entry, true,
true, 1);
vbox.PackStart (entry_bar, false, false, 1);
//keyboard widget
HBox keyboard = new HBox (false, 1);
Button q = new Button ("Q");
q.CanFocus = false;
q.Clicked += new EventHandler (q_clicked);
keyboard.PackStart (q, false, false,1);
vbox.PackStart (keyboard,false,false,1);

...

void q_clicked (object obj, EventArgs args)
{
System.Windows.Forms.SendKeys.Send("a");
}

...

There are no errors during compilation and start, I can write into entry
widget using keyboard, but when I click Q button, nothing happens. Cursor
stays in entry all the time (q.canfocus=false) but "a" is not written into
it.
Is there something missing in my code? I tried a lot of button and entry
properties and methods but nothing helped.

Thanks for you advise. I am just a beginner.

Martin



More information about the Mono-winforms-list mailing list