Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 38
Default focus policy

Is there any way to set, or at least fake, Excel, or windows in general, to
mimic the Motif-like 'focus follows mouse' focus policy?

Assume a sheet and a modeless form displayed. When the mouse cursor moves
onto the form, the form gets the focus, and vice versa, when the mouse
cursor moves from the form onto the sheet, the sheet gets the focus. No
clicking, just moving.

Something on the effective order of:

Sub UserForm_Enter()
Me.someControl.SetFocus or whatever
End Sub
.. . .

Sub Worksheet_Enter()
SetFocus or Activate or whatever
End Sub

While modeless forms are certainly a boon, without being able to do this
they can tend to cause more confusion than they're worth. One never knows
just where one is typing without making sure that the place you assume you
are is in fact the place with the focus.

--
Terry

"I said I never had much use for one,
I never said I didn't know how to use one."
M. Quigley


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,327
Default focus policy

Hi Terry

The event you want, or rather closest to it, is called MouseMove. You can code most your
controls and containers like this:

Private Sub TextBox1_MouseMove(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As
Single, ByVal Y As Single)
TextBox1.SetFocus
End Sub

When it comes to the form itself it's more awkward, and the sheet has no mousemove thing
at all. Adding to the problems that there's no MouseExit event on anything, that the form
or sheet to my knowledge won't activate/deactivate itself by code and that they don't even
know when it happens when done manually. Anyway, I think you'd be 70% there with mousemove
on all form controls.

--
HTH. Best wishes Harald
Followup to newsgroup only please.

"Terry von Gease" wrote in message ...
Is there any way to set, or at least fake, Excel, or windows in general, to
mimic the Motif-like 'focus follows mouse' focus policy?

Assume a sheet and a modeless form displayed. When the mouse cursor moves
onto the form, the form gets the focus, and vice versa, when the mouse
cursor moves from the form onto the sheet, the sheet gets the focus. No
clicking, just moving.

Something on the effective order of:

Sub UserForm_Enter()
Me.someControl.SetFocus or whatever
End Sub
. . .

Sub Worksheet_Enter()
SetFocus or Activate or whatever
End Sub

While modeless forms are certainly a boon, without being able to do this
they can tend to cause more confusion than they're worth. One never knows
just where one is typing without making sure that the place you assume you
are is in fact the place with the focus.

--
Terry

"I said I never had much use for one,
I never said I didn't know how to use one."
M. Quigley




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 38
Default focus policy

Thanks, but that's not quite what I had in mind. More like...

Private Sub UserForm_MouseMove(ByVal Button As Integer, ByVal Shift As
Integer, ByVal X As Single, ByVal Y As Single)
Me.Show 0
End Sub

This deals satisfactorily, if incredibly clumsily, with the mouse entering
the form. If I place two modeless forms on a sheet, each with the above in
their code, then moving the mouse from one to the other activates the one
under the mouse cursor and thus deactivates the other. This works but
somewhat less than elegantly since you can move the mouse rapidly and
confound it.

But that's only half the battle. The hard part would seem to be knowing when
either the mouse enters the sheet or leaves the form. Since the cursor
changes at this event, there must be something somewhere that knows that the
sheet is being entered. How does one get in front of that event?

Some magic in the API? What?

--
Terry

"I said I never had much use for one,
I never said I didn't know how to use one."
M. Quigley

"Harald Staff" wrote in message
...
Hi Terry

The event you want, or rather closest to it, is called MouseMove. You can

code most your
controls and containers like this:

Private Sub TextBox1_MouseMove(ByVal Button As Integer, ByVal Shift As

Integer, ByVal X As
Single, ByVal Y As Single)
TextBox1.SetFocus
End Sub

When it comes to the form itself it's more awkward, and the sheet has no

mousemove thing
at all. Adding to the problems that there's no MouseExit event on

anything, that the form
or sheet to my knowledge won't activate/deactivate itself by code and that

they don't even
know when it happens when done manually. Anyway, I think you'd be 70%

there with mousemove
on all form controls.

--
HTH. Best wishes Harald
Followup to newsgroup only please.

"Terry von Gease" wrote in message

...
Is there any way to set, or at least fake, Excel, or windows in general,

to
mimic the Motif-like 'focus follows mouse' focus policy?

Assume a sheet and a modeless form displayed. When the mouse cursor

moves
onto the form, the form gets the focus, and vice versa, when the mouse
cursor moves from the form onto the sheet, the sheet gets the focus. No
clicking, just moving.

Something on the effective order of:

Sub UserForm_Enter()
Me.someControl.SetFocus or whatever
End Sub
. . .

Sub Worksheet_Enter()
SetFocus or Activate or whatever
End Sub

While modeless forms are certainly a boon, without being able to do this
they can tend to cause more confusion than they're worth. One never

knows
just where one is typing without making sure that the place you assume

you
are is in fact the place with the focus.

--
Terry

"I said I never had much use for one,
I never said I didn't know how to use one."
M. Quigley






  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,327
Default focus policy

Ok, 50% then <g. I'm sure it can be found, either a cursor position or cursor change
event. But I haven't managed to create code that deactivates the form(s) and refocuses the
sheet, so simply detecting won't do either. I'll play more around with it when time
allows, let's hope someone has a somution in the meantime.

--
HTH. Best wishes Harald
Followup to newsgroup only please.

"Terry von Gease" wrote in message ...

But that's only half the battle. The hard part would seem to be knowing when
either the mouse enters the sheet or leaves the form. Since the cursor
changes at this event, there must be something somewhere that knows that the
sheet is being entered. How does one get in front of that event?

Some magic in the API? What?

--
Terry

"I said I never had much use for one,
I never said I didn't know how to use one."
M. Quigley

"Harald Staff" wrote in message
...
Hi Terry

The event you want, or rather closest to it, is called MouseMove. You can

code most your
controls and containers like this:

Private Sub TextBox1_MouseMove(ByVal Button As Integer, ByVal Shift As

Integer, ByVal X As
Single, ByVal Y As Single)
TextBox1.SetFocus
End Sub

When it comes to the form itself it's more awkward, and the sheet has no

mousemove thing
at all. Adding to the problems that there's no MouseExit event on

anything, that the form
or sheet to my knowledge won't activate/deactivate itself by code and that

they don't even
know when it happens when done manually. Anyway, I think you'd be 70%

there with mousemove
on all form controls.

--
HTH. Best wishes Harald
Followup to newsgroup only please.

"Terry von Gease" wrote in message

...
Is there any way to set, or at least fake, Excel, or windows in general,

to
mimic the Motif-like 'focus follows mouse' focus policy?

Assume a sheet and a modeless form displayed. When the mouse cursor

moves
onto the form, the form gets the focus, and vice versa, when the mouse
cursor moves from the form onto the sheet, the sheet gets the focus. No
clicking, just moving.

Something on the effective order of:

Sub UserForm_Enter()
Me.someControl.SetFocus or whatever
End Sub
. . .

Sub Worksheet_Enter()
SetFocus or Activate or whatever
End Sub

While modeless forms are certainly a boon, without being able to do this
they can tend to cause more confusion than they're worth. One never

knows
just where one is typing without making sure that the place you assume

you
are is in fact the place with the focus.

--
Terry

"I said I never had much use for one,
I never said I didn't know how to use one."
M. Quigley








Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
New spam policy? MagneticEnergy Excel Discussion (Misc queries) 0 August 15th 09 01:58 AM
R1C1 Referency Style Policy Jasper Recto Excel Discussion (Misc queries) 3 June 23rd 09 04:54 PM
i want to know the meaning of policy terms premchandra New Users to Excel 0 March 21st 09 06:39 PM
'blocked by registry policy settings' Jeff7salter Excel Discussion (Misc queries) 5 August 18th 08 06:21 PM
Change xlstart path - using policy Craig Excel Discussion (Misc queries) 3 August 31st 05 08:36 PM


All times are GMT +1. The time now is 04:50 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"