We help IT Professionals succeed at work.

How do I create a floating text box without stealing focus from the user?

shaunchristopher
on
847 Views
Last Modified: 2013-12-14
Hi,

Let me first try to describe what I want to do.

Basically, I have a program that needs to continually be monitoring whatever the user is currently typing. At various points in time, when it has gathered sufficient information, it will show a transparent box slightly below where the user has been typing, which contains some possible autocomplete suggestions. The user can choose one of these suggestions, or just completely ignore the box and continue working.

So for example, if they were typing a memo in Microsoft Word, the suggestion box could overlay itself near where they are typing, however, without interfering with the user's workflow. That means that it is important that the box not steal focus from what the user is doing at the moment. However, there would be a special mappable hotkey, such as Ctrl-Alt-Num, where Num would correspond to one of the suggestions offered in the suggestion box, this hotkey would be redirected to my application, and the application would then paste the chosen suggestion into the currently active Windows Control.

Basically, kind of like a application-agnostic autocompletion tool.

Secondary question:
Although I'm monitoring/caching what the user is currently typing, what I would ideally prefer is the ability to see into the user's currently active windows control, determine if the control is some kind of input box such as a text box, and than iterate backwards from the cursor position to the beginning of the sentence that they were in the middle of typing.

Right now, this program is still in the design-phase, so I'm completely open to general suggestions as well as detailed help, although I would prefer the latter.

Main points in order of importance:
1. Creating a dynamic graphical box that can appear below the user's cursor without interfering with workflow.
2. Scanning the existing text in user's currently active application.
3. Trapping certain hot-keys and suppressing them from any given active application

This application is being designed in C# for Windows XP and up. Any help is much appreciated.

Thanks,
Shaun Christopher
Comment
Watch Question

Unlock this solution and get a sample of our free trial.
(No credit card required)
UNLOCK SOLUTION
Mike TomlinsonHigh School Computer Science, Computer Applications, Digital Design, and Mathematics Teacher
CERTIFIED EXPERT
Top Expert 2009
Commented:
Unlock this solution and get a sample of our free trial.
(No credit card required)
UNLOCK SOLUTION
Mike TomlinsonHigh School Computer Science, Computer Applications, Digital Design, and Mathematics Teacher
CERTIFIED EXPERT
Top Expert 2009

Commented:
The keyboard trapping can be done with either system wide global hotkeys or via a low level keyboard hook.
This is great Idle_Mind!
But then how the user will select the chosen sugestion if desired?
By the way I sugest replacing the TextBox by a ListBox and adding the sugestion to it.
Mike TomlinsonHigh School Computer Science, Computer Applications, Digital Design, and Mathematics Teacher
CERTIFIED EXPERT
Top Expert 2009

Commented:
"But then how the user will select the chosen sugestion if desired?"

This does make interaction with the "floating form" a little difficult eh?... ;)

The author stated though:

    "However, there would be a special mappable hotkey, such as Ctrl-Alt-Num, where Num would correspond to one of the suggestions offered in the suggestion box, this hotkey would be redirected to my application, and the application would then paste the chosen suggestion into the currently active Windows Control."

So the user would press a Hotkey combo corresponding to they entry number and the value will be pasted and I assume the form will be hidden again.

Simple Labels in a FlowLayoutPanel could be used to easily position the available suggestions.
Hehe right...
But wouldn't be better if an unexpirient user (like old people) could just click on the suggestion if desired?
Neither averybody can understand what is a Hotkey combo (trust me, I know a lot of "slow" people).
making the floatable form as I described would allow that.

And another thing that I forgot...

When the suggestion is chosen (or not) instead of closing the form, just make it invisible again. (remember that invisible forms doesn't catch clicks, so user's clicking on the form while invisible will go to whatever is behind it.) and clean the suggestion on the FlowLayoutPanel with FlowLayoutPanel1.Controls.Clear(); or clean the list box with ListBox1.Items.Clear();
Please forgive my English... It's not my first language.

Gain unlimited access to on-demand training courses with an Experts Exchange subscription.

Get Access
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Empower Your Career
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE

Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Unlock the solution to this question.
Thanks for using Experts Exchange.

Please provide your email to receive a sample view!

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.