[ScintillaNET] Re: Focus problems

  • From: "Tab Bennedum" <tab@xxxxxxxxxxxx>
  • To: scintillanet@xxxxxxxxxxxxx
  • Date: Sat, 22 Oct 2005 10:18:33 -0400 (EDT)

Steve,

But you see, that's the problem. I can't tell when it's activated.
I'm talking about the case when a user either clicks on the control
or tabs to it from another control. I can't tell when scintilla gets
the focus.

Anyway, I've put a hack into place that seems to work for now. I
won't post the code (unless someone wants me to) since it's truly
evil, but here's what I did. In the WndProc method in the
ScintillControl class I examined the messages comming from Windows
and noticed 2 particular messages that always got sent when the
control was getting and loosing focus (they're both WM_COMMAND
messages). The notification part of WParam is 0x02000000 during a
'got focus' and 0x01000000 during a 'lost focus'. I detect these
messages and call my own 'OnMyGotFocus' and 'OnMyLostFocus' methods.
It seems to work ok and seems to be reliable. I'm sure it's not the
right way to do this, but it seems to take care of the problem.

One thing I didn't do, but I should have (although it doesn't effect
me right now) is set the IsFocus property when I detect those
messages, just to make things more consistent.

-Tab


>>>> tab@xxxxxxxxxxxx 10/20/05 5:29 AM
> I'm a newb with ScintillaNet and I'm having a problem concerning
> focus.
>
> Hi tab,
>
> I think we've all had that problem.  The solution is to explicitly
> force the focus on activation:
>
> sc.Focus();
> sc.GrabFocus();
>
> The documentation says that GrabFocus() is for GTK only, but it
> seems necessary on Windows as well.
>
> Hope that helps,
> Steve d.
>
>
> --
> This message is subject to the CSIR's copyright, terms and
> conditions and
> e-mail legal notice. Views expressed herein do not necessarily
> represent the
> views of the CSIR.
>
> CSIR E-mail Legal Notice
> http://mail.csir.co.za/CSIR_eMail_Legal_Notice.html
>
> CSIR Copyright, Terms and Conditions
> http://mail.csir.co.za/CSIR_Copyright.html
>
> For electronic copies of the CSIR Copyright, Terms and Conditions
> and the CSIR
> Legal Notice send a blank message with REQUEST LEGAL in the subject
> line to
> HelpDesk@xxxxxxxxxxx
>
>
> This message has been scanned for viruses and dangerous content by
> MailScanner,
> and is believed to be clean.  MailScanner thanks Transtec Computers
> for their support.
>
> --------------------------------------------------------------------------
> ScintillaNET Mailing List: ScintillaNET@xxxxxxxxxxxxx
>
>     To unsubscribe: Send an email to
> scintillanet-request@xxxxxxxxxxxxx
>     and put "unsubscribe" (without the quotes) in the Subject line.
>
>     Web Page: http://tinyurl.com/yvoh2
>
>
>



--------------------------------------------------------------------------
ScintillaNET Mailing List: ScintillaNET@xxxxxxxxxxxxx

    To unsubscribe: Send an email to scintillanet-request@xxxxxxxxxxxxx
    and put "unsubscribe" (without the quotes) in the Subject line. 

    Web Page: http://tinyurl.com/yvoh2

Other related posts: