Author Topic: Return from dialog leaves no buffer selected  (Read 4641 times)

roland

  • Community Member
  • Posts: 7
  • Hero Points: 0
Return from dialog leaves no buffer selected
« on: August 02, 2007, 09:15:15 PM »
Hi...

I've written a macro which brings up a dialog box of my own creation.  I'm very happy with the macro and dialog, with one small exception:  when I exit the dialog, no buffer seems to be selected.  The cursor appears in the window I was in when I invoked the macro, but it's a grey box instead of a vertical line, the same as it would be if SlickEdit were not selected, but were still visible behind another window.

A single click inside the buffer selects it, so it's not a major problem, but I know that SlickEdit-provided dialog boxes don't have this problem.  I've studied the code associated with several SlickEdit dialogs, but I haven't spotted the problem.

I've tried setting a line number after leaving the dialog, just before leaving the macro; the cursor moves to the new line, but the buffer still isn't selected.  I've tried preserving the window ID and restoring it (via activate_window()) just prior to returning from the macro; no help. 

Any ideas?

Rodney

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 798
  • Hero Points: 54
Re: Return from dialog leaves no buffer selected
« Reply #1 on: August 03, 2007, 09:44:04 PM »
I do not know why your focus is changing, but I have heard of this happening on Windows. Try the following:

_mdi._set_foreground_window();

Good luck.

--rodney

roland

  • Community Member
  • Posts: 7
  • Hero Points: 0
Re: Return from dialog leaves no buffer selected
« Reply #2 on: August 06, 2007, 06:11:27 PM »
Hi... calling _mdi._set_foreground_window() didn't work, but it was enough to get me looking in the right place; a simple call on _set_focus() following the call on show() which launched the dialog box did the job.  Thanks!