highlighting

Highlighting keywords in a richtextbox in WPF

谁说胖子不能爱 提交于 2019-11-29 17:10:49
I'm making a program which needs to look through a paragraph of text and find how many times a certain keyword/keywords appear. It also has to highlight each of these key words in the text. I have managed to make he interface and it can now track how many times the word appears but I am really stuck for how to highlight where the keywords appear. I will post my code below, any help is greatly appreciated on how to search for and highlight text inside a richtextbox. Since this is in WPF the obvious richtextbox.find() is not avaliable for use. class TextAnalyser { public int

Slow highlighting in Firefox

你离开我真会死。 提交于 2019-11-29 15:53:04
We need to add anchors and highlights for some keywords/sentences in the html page. It turns out the highlighting is really slow in Firefox. In the following code, all ranges which need to be highlighted are stored in array hiliteRanges : for (var i = 0; i < hiliteRanges.length; i++){ document.designMode = "on"; var selHilites = window.getSelection(); if (selHilites.rangeCount > 0) selHilites.removeAllRanges(); selHilites.addRange(hiliteRanges[i]); var anchorId = 'index'+i; var insertedHTML = '<span id="' + anchorId + '" style="background-color: #FF8C00;" >'+hiliteRanges[i].toString()+'</span>

Highlight Part of a text in a cell of datagridview

我怕爱的太早我们不能终老 提交于 2019-11-29 08:10:58
How can i Highlight Part of a text in a cell of datagridview ? I am using C#. For example user searches book. on of cells contains bookmark. I want to highlight "book" in bookmark. Thanks. Edition. Is this code ok? Private Sub DataGridView1_CellPainting(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewCellPaintingEventArgs) Handles DataGridView1.CellPainting If e.RowIndex >= 0 And e.ColumnIndex >= 0 Then e.Handled = True e.PaintBackground(e.CellBounds, True) Dim sw As String = GetSearchWord(e.ColumnIndex) If Not String.IsNullOrEmpty(sw) Then Dim val As String = DirectCast(e

Highlighting a piece of string in a TextArea

拜拜、爱过 提交于 2019-11-29 07:23:57
I'm trying to highlight a piece of text in a "Textarea". I have a long string in that TextArea: Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident And I have a function that can extract the first string occurrence that is between the "begin" and "end" vars. For

jQuery Validation plugin: add/remove class to/from element's error container

南楼画角 提交于 2019-11-29 06:01:10
I'm working with the jQuery Validation plugin and I wrote the following code which adds a class to the element's ( <input> ) parent ( <label> ) if not valid, as well as inserting the actual error element ( <span> ) before the <br> . the HTML ... <label> text<br><input> </label> ... and the jQuery. $("#form_to_validate").validate({ rules: { ... }, errorElement: "span", errorPlacement: function(error, element) { element.parent().addClass('error'); error.insertBefore(element.parent().children("br")); } }); So, if a form element doesn't validate, it turns into: <label class="error"> text<span

JTextPane highlighting issue

徘徊边缘 提交于 2019-11-29 02:45:11
The last days I have been trying to implement a highlighting feature in a small text editor. For some reason I get a strange result: The given example should highlight each "dolor" - the first occurences are correctly found and highlighted but the next ones aren't. Here is the code I wrote so far: import java.awt.Color; import java.awt.Dimension; import java.awt.event.MouseEvent; import java.awt.event.MouseListener; import javax.swing.JFrame; import javax.swing.JScrollPane; import javax.swing.JTextPane; import javax.swing.text.BadLocationException; import javax.swing.text.DefaultHighlighter;

jQuery UI Datepicker - Date range - Highlight days in between

廉价感情. 提交于 2019-11-29 02:20:44
I'm looking for a way of highlighting the days in between the date range of 2 inputs on mouse over. This example is nearly doing what I want to achieve: http://hackingon.net/files/jquery_datepicker/range.htm Only difference is that the highlighting of the selected range should happen on two separate datepickers and on mouse over. Any suggestions? Update: Ok, a bit more details: After selecting a date from the first datepicker, the second datepicker should highlight the previous selected date. If you then mouse over a day past the previous selected day, all days in between should highlight by

Wildcard searching and highlighting with Solr 1.4

江枫思渺然 提交于 2019-11-29 02:19:36
I've got a pretty much vanilla install of SOLR 1.4 apart from a few small config and schema changes. <requestHandler name="standard" class="solr.SearchHandler" default="true"> <!-- default values for query parameters --> <lst name="defaults"> <str name="defType">dismax</str> <str name="echoParams">explicit</str> <str name="qf"> text </str> <str name="spellcheck.dictionary">default</str> <str name="spellcheck.onlyMorePopular">false</str> <str name="spellcheck.extendedResults">false</str> <str name="spellcheck.count">1</str> </lst> </requestHandler> The main field type I'm using for Indexing is

Emacs :TODO indicator at left side

痴心易碎 提交于 2019-11-28 20:29:24
I want to have sort of indiacator at left side of the line wherever I have in the source code #TODO : some comment //TODO: some comments The indicator could be a just mark and I already enabled line numbers displayed at emacs. This command will do something like you want. (defun annotate-todo () "put fringe marker on TODO: lines in the curent buffer" (interactive) (save-excursion (goto-char (point-min)) (while (re-search-forward "TODO:" nil t) (let ((overlay (make-overlay (- (point) 5) (point)))) (overlay-put overlay 'before-string (propertize "A" 'display '(left-fringe right-triangle)))))))

Android - Highlight a Word In a TextView?

与世无争的帅哥 提交于 2019-11-28 16:24:05
I have a database search query which search in the database for a word entered by the user and return a Cursor . In my ListActivity , I have a ListView which will hold the items (the Cursor items). The ListView items layout is basically a TextView . I mean, the ListView will be a list of TextView 's. What I want is to highlight the search term wherever it appears in the TextView . I mean by highlighting: different color or different background color or anything makes it different than the rest of the text. Is this possible? and how? Update: cursor = myDbHelper.search(term); //term: a word