ScintillaNET icon indicating copy to clipboard operation
ScintillaNET copied to clipboard

Side effects in indicator click handler causes erratic mouse pointer behavior

Open ghost opened this issue 10 years ago • 2 comments

This bug has been vexing me for several months and I finally found a way to reproduce it.

One possible use of the indicator click handler is to open a browser when a user presses a link (see #111). In some cases when user returns to the program with the Scintilla control, the mouse pointer will flicker erratically between the normal pointer and the beam. This seems to be a general problem with having the handler do anything which has side effects. Just setting a breakpoint in the handler is sufficient to trigger it.

To reproduce, start a new project and add a Scintilla control like this:

namnlos

Add the following code:

    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void Form1_Load(object sender, EventArgs e)
        {
            scintilla1.IndicatorClick += scintilla1_IndicatorClick;
            scintilla1.IndicatorCurrent = (int)1;
            scintilla1.IndicatorClearRange(0, scintilla1.TextLength);
            scintilla1.IndicatorFillRange(0, scintilla1.TextLength);
        }

        void scintilla1_IndicatorClick(object sender, ScintillaNET.IndicatorClickEventArgs e)
        {
            System.Diagnostics.Debugger.Break(); // Just press F5.
        }
    }

Start the program in the debugger and click on the text in the Scintilla Control. The breakpoint will be raised; just press F5 to continue.

Now move the mouse pointer in the area just above the Scintilla control. It will change rapidly between the normal pointer and a beam.

This does not seem to happen with Indicator_Release_.

ghost avatar Jan 21 '16 21:01 ghost

I have the exact same problem - any solutions yet?

VPKSoft avatar Nov 11 '19 15:11 VPKSoft

Hi, I found a work-around.. this is not a solution for the problem.

  • Only set a volatile string value when clicking the link to contain the link's address.
  • Create a separate thread, etc.. to start the process and then set the volatile string value to null.

Hope someone did found this useful 🙂...

VPKSoft avatar Nov 11 '19 15:11 VPKSoft