Notifications
Clear all
[Closed] dotnet question and a case question
Oct 23, 2009 9:52 pm
I’m working on a richtextbox and i have 2 question
how can i tell if both shift and enter are pressed during a keydown method call?
So if a user hits enter do one thing, and the if they hold shift and hit enter do another. I would prefer to do this all in .net
and then ..
if i am using a case of expression, how can i "fall through" effect like you can get in c++
here's the function
on EditBox keyDown arg do
(
pressed = arg.keycode
case pressed of
(
(pressed.Enter ):
(pressed.Return):
(
EditBox.SelectedText = "
"
)
(pressed.Tab):
(
EditBox.SelectedText = " ";
)
)
)
I'd like the pressed.Enter and pressed.Return to have the same clause with out duplicating it.
Thanks
4 Replies
Oct 23, 2009 9:52 pm
System.Windows.Forms.KeyEventArgs has property “Shift”… just check it:
if arg.Shift and (arg.keyCode == arg.keyCode.Enter) …
or
case arg.keyCode of
(
(arg.keyCode.Enter) : if arg.Shift do …
)
1 Reply
you can’t fall through in MXS case expression.
but you use case without a test expression :
case of
(
((arg.keycode == arg.keycode.enter) or (arg.keycode == arg.keycode.tab)) : ...
)
Oct 23, 2009 9:52 pm
sweet, worked like a charm.
haha, was posting when you wrote.
Thanks again