Author Topic: Focus of codesnippets browser  (Read 3588 times)

Offline mariocup

  • Developer
  • Lives here!
  • *****
  • Posts: 586
Focus of codesnippets browser
« on: July 13, 2007, 03:02:40 pm »
Hi Pecan,

if you move the mouse from the editor (has the focus) to the tree of the codesnippets entries then the focus is set to the codesnippets window, although it has not been selected with the left mouse button.

This is also a problem if you click on a category in codesnippets to rename it and the mouse moves slightly (without clicking) then you can not rename, because the focus is again in the codesnippets view.


Offline Pecan

  • Plugin developer
  • Lives here!
  • ****
  • Posts: 2265
Re: Focus of codesnippets browser
« Reply #1 on: July 13, 2007, 03:37:15 pm »
Hi Pecan,

if you move the mouse from the editor (has the focus) to the tree of the codesnippets entries then the focus is set to the codesnippets window, although it has not been selected with the left mouse button.

This is also a problem if you click on a category in codesnippets to rename it and the mouse moves slightly (without clicking) then you can not rename, because the focus is again in the codesnippets view.



It isn't CodeSnippets that's causing that.

It's either the OS or wxAUI setting focus back to the parent of the floating window.

For example: pull the project management window out to the side of CB. Now click (focus) within it. Now move the cursor to CB.

The Management floating window will lose focus and CB will gain it.
« Last Edit: July 27, 2007, 04:30:58 am by Pecan »

Offline danselmi

  • Developer
  • Almost regular
  • *****
  • Posts: 202
Re: Focus of codesnippets browser
« Reply #2 on: April 07, 2008, 12:29:13 am »
Hi

Is not the pw->SetFocus() call in the OnEnterWindow method
(CodeSnippetsTreeCtrl's EVT_ENTER_WINDOW handler)
causing that?

What is the reason for this call in the OnEnterWindow handler?
I believe that it is wrong to set the focus just after the mouse
moved over this window.

regards, daniel
« Last Edit: April 07, 2008, 12:55:40 am by danselmi »

Offline Pecan

  • Plugin developer
  • Lives here!
  • ****
  • Posts: 2265
Re: Focus of codesnippets browser
« Reply #3 on: April 07, 2008, 10:43:51 pm »
Is not the pw->SetFocus() call in the OnEnterWindow method
(CodeSnippetsTreeCtrl's EVT_ENTER_WINDOW handler)
causing that?

Yes. Thanks for the "heads up".

Fixed in SVN 5000

This will still happen to EditLabel if the user has DragScroll's "Focus-follows-mouse" enabled. But otherwise EditLabel should work ok.

The reason for this code: wxAUI does not pass on events to child frames of floating windows if the main floating window did not previously have the focus, and the user moved from the parent to the child.

For example, If the user clicks on the CodeSnippet floating window banner, then clicks into an CodeSnippetEditWindow, the cursor is not restored because the OS gave the edit window focus, but the window does not get the EVT_FOCUS_WINDOW, or EVT_CLOSE, nor other common events.
 
« Last Edit: April 07, 2008, 10:51:36 pm by Pecan »

Offline Pecan

  • Plugin developer
  • Lives here!
  • ****
  • Posts: 2265
Re: Focus of codesnippets browser
« Reply #4 on: April 08, 2008, 01:42:52 am »
This will still happen to EditLabel if the user has DragScroll's "Focus-follows-mouse" enabled. But otherwise EditLabel should work ok.

That is to say: the Label editing will end when the cursor is moved out of the Label control, and Focus-follows-mouse is enabled.

Alternatively, right click on the label and change it in the "properties" dialog.