PavelTorgashov / FastColoredTextBox

Fast Colored TextBox for Syntax Highlighting. The text editor component for .NET.
Other
1.21k stars 464 forks source link

Using the scrollbar selects text. #132

Closed mikeoverbay closed 6 years ago

mikeoverbay commented 6 years ago

This is in VB.Net.. I have a form.. On this form is a TabControl and in this TabControl there are 3 TabPages. Each TabPage has a FCTB docked on them. This took me 10 hours to figure out and I'm not even sure it can be duplicated. If I set the Forms TopMost setting to True,.. the scrollbars work fine. If I RESIZE the Form, than the ScrollBars select text as if I'm dragging the the mouse in the text window. If I rebuild the app with TopMost set to False, than the ScrollBars work fine regardless of resizing the Form. Leaving this here in case anyone else has this problem.. SHUT OFF TOPMOST FOR THE FORM THE FCTB IS ON! Thanks Pavel for a great control! I use it on 4 different apps as my OpenGL - GLSL editor. Mike.

PavelTorgashov commented 6 years ago

I made example app as you described (topmost form, FCTB inside tabpage), and it works properly. https://www.dropbox.com/s/zct6e8jlxe1ap5f/WindowsFormsApplication384.zip?dl=0

If you have the issue, please make and share test app where I can see this issue.

mikeoverbay commented 6 years ago

Thank you Pavel for the fast reply.. This is sooooo strange, I didn't expect it to fail for you as your FCTB works perfect in 3 other apps I''m using it with. I'm starting to think this is something deeply wrong in the form. I'll recreate the entire form after I get this damn PBR shading working .. GRRRRRRR lol

mikeoverbay commented 6 years ago

WOW... I found the problem but don't understand it. If my app is refreshing the opengl screen, the FCTB doesn't work right.. If I disable screen updates, It works fine. Guess I need to dig in to this deeper.

mikeoverbay commented 6 years ago

I found a work around. If my editor window is open, I set a boolean flag to True. If this is True, the screen updating thread stops calling the screen draw function. I also use this flag in the "on size changed" and "on look point changed" functions.. It works but I'm still wondering why a OpenGL draw routine is messing up the FCTB. I have a feeling it has something to do with the device context. I set it for every draw call. I know the Win API requires a context handle to draw to any form and I think my setting of it every 60th of a second is whats causing the FCTB to screw up. I'm not sure but I think you might need to look in to this issue.. Thanks again for this!!!