Quantcast
Channel: ScintillaNET
Viewing all 397 articles
Browse latest View live

New Post: What is the difference between the addtext and the appendtext predicate?

$
0
0
Hi,
What is the difference between the addtext and the appendtext predicate?
When should I use addtext and when appendtext?
What are their side side-effects?

Regards
 Frank

New Post: How can I force scintilla to apply styles to text lines instead of language elements?

$
0
0
Helpp!!!
I want to enhance lines with styles like this
1 = title
2 = table header
3 = table body
...
  • 7 = error.
    I have defined the styles but I see the new colors and attributes distinguishing the element (numbers., keywords, variable, strings) of the preset language instead on whole lines.
TIA
Frank

New Post: Split view using two Scintilla controls?

$
0
0
I have tried so many things, but I have not yet gotten the perfect answer.
So there's nobody out there that knows?

Sorry for bumping, but I've been waiting for so long. :)

New Post: Split view using two Scintilla controls?

$
0
0
I believe the best solution would be to copy the text of the two controls onto each other, but save the cursor and scroll positions before doing that copy, and restore those positions after.

New Post: Split view using two Scintilla controls?

$
0
0
blah38621 wrote:
I believe the best solution would be to copy the text of the two controls onto each other, but save the cursor and scroll positions before doing that copy, and restore those positions after.
I tried that before. And suddenly when rewriting my code, it works. :D
It's a bit laggy though.

I also tried to make a new setting for the Scintilla control. Sadly it didn't work.
I see you're a developer. Can you recognize this problem?
(Translation: Method not found)
Image

Here's the change in the source:
private bool EnableOnTextChangedEvent = true;

(... further down in the code ...)

        private void ScnModified(ref ScintillaNET.Internal.NativeMethods.SCNotification scn)
        {
            bool flag = false;
            flag |= (scn.modificationType & 1) == 1;
            flag |= (scn.modificationType & 2) == 2;
            if (this.EnableOnTextChangedEvent) //This 'if'-statement is new. Not the code inside it. I made it so that it wouldn't raise the OnTextChanged event, so that it wouldn't scroll.
            {
                this.OnTextChanged(EventArgs.Empty);
            } //End of new
            if ((scn.modificationType & 0x20000) == 0x20000)
            {
                AnnotationChangedEventArgs e = new AnnotationChangedEventArgs(scn.line, scn.annotationLinesAdded);
                this.OnAnnotationChanged(e);
            }
        }

(... even further down in the code ...)

        [Browsable(false), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
        public bool EnableTextChangedEvent
        {
            get
            {
                return this.EnableOnTextChangedEvent;
            }
            set
            {
                this.EnableOnTextChangedEvent = value;
            }
        }
And then when you use it, the error will occur. (I use Visual Basic 2010 for my application.)
ScintillaBox2.EnableTextChangedEvent = False 'Disable raising the event.
ScintillaBox2.Text = ScintillaBox1.Text
ScintillaBox2.EnableTextChangedEvent = True

New Post: Tooltip beside the autocomplete list

$
0
0
Hello,

i don't know the exact expression of the tooltip beside the autocomplete list, but is it possible to show it?

Image

Thanks in advance & Greetings ... Peter (sorry for my poor english)

New Post: Margin width auto adjustable

$
0
0
Note that the example provided by jk001 does not take into account the Scintilla control's zoom factor.

Rather than referencing scintilla.Font use a new font object, using the zoom factor to adjust the point size.
scintilla.Margins[0].Width = TextRenderer.MeasureText(
    lines.ToString(), 
    new Font(
        scintilla.Font.FontFamily, 
        scintilla.Font.SizeInPoints + scintilla.ZoomFactor, 
        scintilla.Font.Style)
    ).Width;
And since scintilla.ZoomFactor can change without the text changing, the last_measure_lines check needs to allow an override, or a modification of scintilla.ZoomFactor needs to reset last_measure_lines.

Created Unassigned: Incorrect RegexOptions assignment? [35792]

$
0
0
I am not sure, but if you take a look at the FindReplaceDialog.cs code on lines 500 and 529 you will see this:

```
if (chkCompiledF.Checked) // Refers to the "Compiled" option.
ro |= RegexOptions.Compiled;

if (chkCultureInvariantF.Checked) // Refers to the "CultureInvariant" option.
ro |= RegexOptions.Compiled; //<---- Isn't this supposed to be "RegexOptions.CultureInvariant" instead?
```

```
if (chkCompiledR.Checked) // Refers to the "Compiled" option.
ro |= RegexOptions.Compiled;

if (chkCultureInvariantR.Checked) // Refers to the "CultureInvariant" option.
ro |= RegexOptions.Compiled; //<---- Isn't this supposed to be "RegexOptions.CultureInvariant" instead?
```

//Visual Vincent

New Post: Tooltip beside the autocomplete list

$
0
0
Hi!
The Scintilla's ToolTip is called CallTip and it can be accessed like this:
ScintillaBox1.CallTip.Show(<message As String>, <position As Integer>)

New Post: Tooltip beside the autocomplete list

$
0
0
Hello Visual_Vincent,
The Scintilla's ToolTip is called CallTip
unfortunately it's not that easy. I want to place the CallTip next to the autocomplete list. And i don't know how to get the position and width of this list.

Furthermore i want to change the content of the tooltip if i scroll in the autocomplete list (just like in Visual Studio).

Thanks nevertheless ... Peter

New Post: Changing syntax highlighting in runtime.

$
0
0
Hello all,
I am writing an app for editing PAWN language.

I want to make all functions which is written by the user to be highlighted by a color.
Sooo, How do I add a word to the text highlighting on runtime without a need for XML file.

Thanks in advance.

New Post: Changing syntax highlighting in runtime.

$
0
0
You should be able to modify the keyword lists at runtime, though some lexers may handle it better than others.

New Post: Changing syntax highlighting in runtime.

New Post: Inserting snippet in OnAutoCompleteAccept event

$
0
0
I ran into the same problem.
The solution I found was in hindsight obvious.
When you take over the handling of autocompletion you have to inform the other handlers that you have taken action.

if (you have inserted a snippet)
{
e.Cancel = true;
}

return;

Don't forget to set the caret back to the begin of word before inserting the snippet.

New Post: How to add annotations? Collection has no add() method?

$
0
0
Hi everyone, I'd like to start working with ScintillaNET annotations, but I can't figure out how.

I'm struggling to learn how to add an annotation to the ScintillaNET control, since the annotations collection doesn't seem to have an add() method, and there seems to be no other mechanism in place.

I've set the Annotations visibility to standard. Could you please let me know the process for creating annotations?

Thanks in advance!

New Post: Getting the TextBox control of the ScintillaNET control.

$
0
0
I don't know how ScintillaNET is created.
But I want to implement this autocompletemenu to it.

But that autocomplete menu only supports RichTextBox'es and Textbox'es
So, Anyway to get the textbox control in it ?

Thanks in advanced
And I hope you understand me.

New Post: Crash while trying to use multiple views (DocumentHandler.Current)

$
0
0
Hi all!
Thanks for awesome project!
Have a question in regards to proper usage of DocumentHandler for multiple views.
So I have three tabs, with one tab item visible at a time. When the user switches a tab i re-parent my unique instance of ScintillaNet window to the visible tab. I want to switch the document so as to preserve undo functionality etc. When the ScintillaNet controll is initialized there is a non null pointer which i store:
Document d0 = myScintilla.DocumentHandler.Current;
Document d1 = myScintilla.DocumentHandler.Create();
Document d2 = myScintilla.DocumentHandler.Create();
Also at that point I create two more documents for other tabs.
Then during tab switch i simply reset to desired doc, i.e.:
myScintilla.DocumentHandler.Current = d2;
However, I get AccessViolation exception if I use d0 - initial Current pointer. It seems I have to call Create() even on the initial document? Is that so?
Thanks again!
Running out of WPF, C#, VS2013.

New Post: Need help with plus minus boxes

$
0
0
do any one know how to apply folding to simple text file

i.e. fold line 1 to 6 and it will show plus minus block at line 1 and line 1-6 gets hidden

New Post: Folding for text files

$
0
0
Need a functionality like fold line from 1 to 6
in a text file

Created Unassigned: Snippets Surround With works once [35802]

$
0
0
Snippets insertion using the Snippet Chooser inserts the selection only once on the $selected$ marker and the list contains all snippets, also the snippets without the IsSurroundsWith flag, in snippet list.

Any insertion thereafter the snippet is placed after the selection.

This was the code, including the diagnostic statement and a hack, to solve the loss of the selection
However as soon the list disappear, because the user clicks in the chooser field for another filtering
a new list appears, but hack does not work in that case.

```
Private Sub mnuSnippetSurroundWith_Click(ByVal sender As Object, ByVal e As EventArgs) Handles mnuSnippetSurroundWith.Click
#If DEBUG Then
Dim SelEnd As Integer = Scintilla1.Selection.End
Dim SelStart As Integer = Scintilla1.Selection.Start
#End If
Scintilla1.Snippets.ShowSurroundWithList()
#If DEBUG Then
If SelStart <> Scintilla1.Selection.Start OrElse SelEnd <> Scintilla1.Selection.End Then
Debug.WriteLine(String.Format("Snippet selection is CHANGED!!! Start b-{0} a-{1} End b-{2} a-{3}", SelStart, Scintilla1.Selection.Start, SelEnd, Scintilla1.Selection.End))
End If
#End If

' ' HACK to reset the loss of selection
' If SelEnd <> Scintilla1.Selection.End Then Scintilla1.Selection.End = SelEnd
End Sub
```

Using the VS debugger I detected the culprit in the SnipperChooser.cs (version 2.6 round line 103)
The code looks like a kind of hack to solve the lost of the chooser.
The statement Scintilla.Caret.Goto(0) cause the selection to be lost.
So first I added some code to save the selection and restore it afterwards.
That solved the problem. The I removed everything except the statement
```
txtSnippet.AutoComplete.Show(0, _snippetList);
```

that worked also.
For me it is unclear why Goto was used.

Hereafter the total change I have added / changed to resolve the issue.

```
private void txtSnippet_AutoCompleteAccepted(object sender, AutoCompleteAcceptedEventArgs e)
{
string shortcut = txtSnippet.AutoComplete.SelectedText;
Hide();
Scintilla.Snippets.InsertSnippet(shortcut);
e.Cancel = true; // following the event rules, when handled return e.Cancel = true
}


private void txtSnippet_DocumentChange(object sender, NativeScintillaEventArgs e)
{
//// If for any reason the window DOES manage to hide itself
//// we merely reshow it.
if (!txtSnippet.AutoComplete.IsActive && Visible)
{
//int selstart = Scintilla.Selection.Start;
//int selend = Scintilla.Selection.End;
//int pos = Scintilla.Caret.Position;
//Scintilla.Caret.Goto(0); // this resets any selection, which cause surround with to fail - if this is needed
// then the selection should be saved and restored and the caret should be set to selstart
txtSnippet.AutoComplete.Show(0, _snippetList);
//Scintilla.Caret.Goto(selstart); //Scintilla.Caret.Goto(pos);
//Scintilla.Selection.End = selend;
}
}


```

The comment I have added hopefully clarifies what was/is done.
The issue of the complete list instead of snippets with the IsSurroundsWith flag is still there.
It looks like a racing condition. The event to handle is processing the list before the Snippermanager has completed the list.

```
public void ShowSurroundWithList()
{
SnippetList sl = new SnippetList(null);
foreach (Snippet s in _list)
{
if (s.IsSurroundsWith)
sl.Add(s);
}

if (sl.Count == 0)
return;

if (_snipperChooser == null)
{
_snipperChooser = new SnippetChooser();
_snipperChooser.Scintilla = Scintilla;
_snipperChooser.SnippetList = _list.ToString(); // <-------- the complete list
_snipperChooser.Scintilla.Controls.Add(_snipperChooser);
}
_snipperChooser.SnippetList = sl.ToString(); // <------ the filtered list
_snipperChooser.Show();
}

```
Viewing all 397 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>