Windows that do not get the focus

G

Guest

I m trying to write some forms that appear beside Textboxes like the auto
complete window that shows beneath the address bar in IE.
Now i managed to show the window beneath the text box in the same way but my
only problem here is that the window doesnt respond to mouse move events coz
it doesnt have the focus ! , and if it got the focus the form having the
textbox will loose its focus so the cursor will disappear from the textbox
(which means that keypress events will not go to the textbox!).
so how could we make the window capture different mouse events without
having to get the focus ! .
 
K

Kevin Spencer

Use a Control instead of a Form. The Control will respond to mouse events.

--
HTH,

Kevin Spencer
Microsoft MVP
Professional Chicken Salad Alchemist

Big thicks are made up of lots of little thins.
 
S

Stoitcho Goutsev \(100\)

Latief,

Mouse events and the focus are not related. Focused control is the control
that receives the keyboard while the mouse events are send to the control
under the mouse cursor. I believe your problem is somehere else.
Unfortunately without a code that we can play with is really hard to tell
what the prblem might be.

Just for an example the Panel control never gets the focus, but it receives
mouse events.

What type of control are you using for your autocomplete-like window?
 
S

Stoitcho Goutsev \(100\)

Kevin,

I don't think he ever said that he is using a form. Form or not all the
controls receives mouse messages and unless the control for some reason
suppress raising the events he should be able to catch them.

The only situations that I can come up with that a control doesn't reveive
mouse events are:
1. The control is covered by other control and the event hadlers are attched
to the control on the bottom.
2. The control is disabled.
3. The mouse is captured by some other control.
4. The message loop doesn't pump messages.

In all other cases the control/form should receive mouse events.
 
G

Guest

Dear,

Well just try to consider the autocomplete window that appears while ur
writing urls in the IE address textbox , well i m trying to compose a
functionality similar to this one.

1- so when ever a user writes anything in a textbox , a borderless window
just appears beneath the textbox and on top of the current form .
2- unfortunately showing a form will cause it to get the focus.
3- so the focus is moved towards the new borderless window.
4- now for some reasons i need to get the focus back to my textbox that the
user was editing.
5- at this point the main form now has the focus (and the textbox too), and
the borderless window is on the top but it doesnt have the focus! (so it
doesn't recieve the mouse events )

Sorry for not being able to cut a piece of code.

Latief
 
S

Stoitcho Goutsev \(100\)

Latief,

Have you implemented 1-4 already?
Are you sure about 5? As I said mouse events and the focus are not related.
Borderless form has to recive mouse events, but the main window (with the
edit box) won't reveive them for the area covered by the borderless form.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top