c# - Sending command to showDialogue Form from inactive form -
i want send keys show dialogue form inactive form.see picture
form showing dialogue.behind form has customized keyboard , numpad. send keys against these button clicks. how possible can send keys keyboard show dialogue form.
what you're asking impossible. once understand how modal dialogs work (forms shown using showdialog
method modal), understand why. modal dialog used when want force user interact only dialog. prevents them interacting other windows in application disabling windows. become impervious mouse clicks, don't receive keyboard input, , can't receive focus. windows beeps @ , flashes title bar of modal dialog when try, it's non-subtle way of shaking head , saying "no, no, no".
so what's going on here when show "deposits" form modal dialog using showdialog
method, of other windows in application disabled. in particular case, means window contains on-screen keyboard disabled, too, , can't receive mouse click events. that's why nothing happening when try click on "keys" (buttons).
the easiest workaround (as suggested in comment) show "deposits" form non-modal dialog using show
method instead. unlike modal dialog, not disable other windows in application, allowing user interact of them @ once. clicking on window set focus window , allow process input events. isn't workable you, because want "deposits" form disable every control on main window, not on-screen keyboard.
of course, lied @ beginning when said "impossible". meant is it's tricky, , require work around standard windows interactivity model. couple of ideas
on how might go doing spring mind:
you use on-screen keyboard utility included recent versions of windows. microsoft provides program purpose. don't have build , maintain own, includes necessary logic prevent stealing focus when user clicks on 1 of "keys", , since isn't part of program, won't disabled when show forms modal using
showdialog
method. check out, go start -> run , typeosk
.for example, in windows 7 looks this:
if insist on using own, custom-designed on-screen keyboard, have show child window of modal dialog. is, application starts main form, per usual. then, when show "deposits" form modal dialog using
showdialog
method, main form gets disabled. "deposits" form, can show on-screen keyboard form using non-modalshow
method. main form still disabled, because it's showing modal dialog (the "deposits" form). "deposits" form not disabled, because it's showing non-modal dialog (your on-screen keyboard).
Comments
Post a Comment