Fix all broken links: absolute URLs, blog images, comment reply cleanup
This commit is contained in:
238
public/blog/wp-content/uploads/2013/01/chapter-search.html
Normal file
238
public/blog/wp-content/uploads/2013/01/chapter-search.html
Normal file
@@ -0,0 +1,238 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||
<head>
|
||||
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
|
||||
<title>Searching Items</title>
|
||||
<link href="style.css.html" rel="stylesheet" type="text/css">
|
||||
<link href="prettify.css.html" type="text/css" rel="stylesheet">
|
||||
<script type="text/javascript" src="prettify.js.html"></script><script type="text/javascript" src="lang-vb.js.html"></script><link href="../resources/main.css.html" media="screen" rel="stylesheet" type="text/css">
|
||||
</head>
|
||||
<body onload="prettyPrint()"><div class="placing">
|
||||
<br><table class="navigation"><tr>
|
||||
<td class="navigation-previous"><a href="chapter-save-load.html"><strong>
|
||||
« Saving and Loading ListView Content</strong></a></td>
|
||||
<td class="navigation-index"><a href="../index.html"><strong>Index</strong></a></td>
|
||||
<td class="navigation-next"><a href="chapter-serialization.html"><strong>Serialization »
|
||||
</strong></a></td>
|
||||
</tr></table>
|
||||
<br><h1>Searching Items</h1>
|
||||
<div class="banner">
|
||||
<a href="../../../../page/6/index.html"><img src="../resources/overview.gif.html" alt="Better ListView" class="ss"></a>
|
||||
<div class="inside">
|
||||
<div class="text">Better ListView: Ultimate .NET ListView replacement control for WinForms (C#, VB.NET)</div>
|
||||
<span class="dbtn-c dbtn-hilight"><span class="dbtn-w"><a href="../../../../../betterlistview.exe" class="dbtn">Download</a></span></span>
|
||||
<span class="dbtn-c"><span class="dbtn-w"><a href="../../../../page/6/index.html" class="dbtn">More Info</a></span></span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
<p>Better ListView offers many options for searching items by typing on
|
||||
keyboard and programmaticaly (<span class="code">FindItemWithText</span>,
|
||||
<span class="code">FindItemsWithText</span> methods). Search can be extended to sub-items
|
||||
and event multiple items can be contained in a search result.</p>
|
||||
|
||||
<p>Search can be customized with <span class="code">SearchSettings</span> property.
|
||||
This structure contains three other properties:</p>
|
||||
|
||||
<ul style="list-style:none">
|
||||
<li>
|
||||
<span class="code">Mode</span><ul style="list-style:none"><li>
|
||||
<p>Specifies how the searching is done on each item/sub-item
|
||||
string.</p>
|
||||
|
||||
<ul style="list-style:none">
|
||||
<li>
|
||||
<span class="code">Disabled</span><ul style="list-style:none"><li>
|
||||
<p>Searching is disabled.</p>
|
||||
</li></ul>
|
||||
</li>
|
||||
<li>
|
||||
<span class="code">Prefix</span><ul style="list-style:none"><li>
|
||||
<p>Search is restricted to text prefix.</p>
|
||||
</li></ul>
|
||||
</li>
|
||||
<li>
|
||||
<span class="code">PrefixOrSubstring</span><ul style="list-style:none"><li>
|
||||
<p>Search query can match any substring, if nothing found by
|
||||
prefix.</p>
|
||||
</li></ul>
|
||||
</li>
|
||||
<li>
|
||||
<span class="code">Substring</span><ul style="list-style:none"><li>
|
||||
<p>Search query can match any substring.</p>
|
||||
</li></ul>
|
||||
</li>
|
||||
</ul>
|
||||
</li></ul>
|
||||
</li>
|
||||
<li>
|
||||
<span class="code">Options</span><ul style="list-style:none"><li>
|
||||
<p>Additional options for searching.</p>
|
||||
|
||||
<ul style="list-style:none">
|
||||
<li>
|
||||
<span class="code">CaseSensitive</span><ul style="list-style:none"><li>
|
||||
<p>The search is case-sensitive.</p>
|
||||
</li></ul>
|
||||
</li>
|
||||
<li>
|
||||
<span class="code">FirstWordOnly</span><ul style="list-style:none"><li>
|
||||
<p>Search is restricted to the first word of searched
|
||||
text.</p>
|
||||
</li></ul>
|
||||
</li>
|
||||
<li>
|
||||
<span class="code">None</span><ul style="list-style:none"><li>
|
||||
<p>No options active.</p>
|
||||
</li></ul>
|
||||
</li>
|
||||
<li>
|
||||
<span class="code">PlaySound</span><ul style="list-style:none"><li>
|
||||
<p>Sound is played, when nothing is found.</p>
|
||||
</li></ul>
|
||||
</li>
|
||||
<li>
|
||||
<span class="code">PrefixPreference</span><ul style="list-style:none"><li>
|
||||
<p>Results matched by prefix are prefered among other (e.g.
|
||||
when searching for <strong><em>pla</em></strong>, then the text
|
||||
<strong><em>player</em></strong> is prefered among the word
|
||||
<strong><em>applause</em></strong>).</p>
|
||||
</li></ul>
|
||||
</li>
|
||||
<li>
|
||||
<span class="code">SelectableItemsOnly</span><ul style="list-style:none"><li>
|
||||
<p>Restrict the search to selectable items only.</p>
|
||||
</li></ul>
|
||||
</li>
|
||||
<li>
|
||||
<span class="code">WordSearch </span><ul style="list-style:none"><li>
|
||||
<p>Searched text si first split into words and searching is
|
||||
done on each word separately.</p>
|
||||
</li></ul>
|
||||
</li>
|
||||
</ul>
|
||||
</li></ul>
|
||||
</li>
|
||||
<li>
|
||||
<span class="code">SubItemIndices</span><ul style="list-style:none"><li>
|
||||
<p>Specifies sub-items on which the search is done; if the
|
||||
collection is empty, than all sub-items are searched.</p>
|
||||
</li></ul>
|
||||
</li>
|
||||
</ul>
|
||||
<p>There is a default one-second delay to register when user stopped
|
||||
typing and the search is discarded. A new search is initiated when user
|
||||
starts typing after this interval has passed. This interval can be set via
|
||||
<span class="code">SearchTimeoutDelay</span> property.</p>
|
||||
|
||||
<p>The delay is not relevant when user types the same letter several
|
||||
times and there are other items beginning with that letter. If there are
|
||||
items named <strong><em>ab</em></strong>, <strong><em>ac</em></strong>,
|
||||
<strong><em>ad</em></strong>, then the selection cycles through these items as
|
||||
long as the user keeps pressing <strong><em>A</em></strong> key. This works
|
||||
essentialy the same way as in the Windows Explorer.</p>
|
||||
|
||||
<br><hr>
|
||||
<p class="note">The keyboard search works, of course, only when the control has
|
||||
focus. You can ensure this (e.g. when showing the form) by calling
|
||||
<span class="code">Focus</span> method on Better ListView.</p>
|
||||
<hr>
|
||||
<br><h2>Sample Source Code</h2>
|
||||
|
||||
|
||||
<p><strong>C#</strong></p>
|
||||
<pre class="prettyprint"><code class="lang-cs">this.listView.BeginUpdate();
|
||||
|
||||
// fill the ListView with items in two columns
|
||||
this.listView.Columns.AddRange(
|
||||
new[]
|
||||
{
|
||||
new BetterListViewColumnHeader("Word", 128),
|
||||
new BetterListViewColumnHeader("Synonym List", 160)
|
||||
});
|
||||
|
||||
this.listView.Items.AddRange(
|
||||
new[]
|
||||
{
|
||||
new BetterListViewItem(new[] { "apparently", "evidently, presumably, seemingly" }),
|
||||
new BetterListViewItem(new[] { "blunt", "brusque, curt, snippy" }),
|
||||
new BetterListViewItem(new[] { "class", "caste, estate, folk" }),
|
||||
new BetterListViewItem(new[] { "detailed", "elaborate, full, thorough" }),
|
||||
});
|
||||
|
||||
// search in substrings
|
||||
BetterListViewSearchMode searchMode = BetterListViewSearchMode.Substring;
|
||||
|
||||
// use case-sensitive searching and play sounds
|
||||
BetterListViewSearchOptions searchOptions = (BetterListViewSearchOptions.CaseSensitive | BetterListViewSearchOptions.PlaySound);
|
||||
|
||||
// search in the first and second column
|
||||
//NOTE: empty array also means searching in all columns
|
||||
int[] subItemIndices = new[] { 0, 1 };
|
||||
|
||||
// set-up the search
|
||||
this.listView.SearchSettings = new BetterListViewSearchSettings(searchMode, searchOptions, subItemIndices);
|
||||
|
||||
this.listView.EndUpdate();</code></pre>
|
||||
|
||||
<p><strong>Visual Basic</strong></p>
|
||||
<pre class="prettyprint"><code class="lang-vb">ListView.BeginUpdate()
|
||||
|
||||
' fill the ListView with items in two columns
|
||||
ListView.Columns.AddRange(
|
||||
New BetterListViewColumnHeader() { _
|
||||
New BetterListViewColumnHeader("Word", 128),
|
||||
New BetterListViewColumnHeader("Synonym List", 160)
|
||||
})
|
||||
|
||||
ListView.Items.AddRange(
|
||||
New BetterListViewItem() { _
|
||||
New BetterListViewItem(New String() _
|
||||
{"apparently", "evidently, presumably, seemingly"}),
|
||||
New BetterListViewItem(New String() {"blunt", "brusque, curt, snippy"}),
|
||||
New BetterListViewItem(New String() {"class", "caste, estate, folk"}),
|
||||
New BetterListViewItem(New String() {"detailed", "elaborate, full, thorough"})
|
||||
})
|
||||
|
||||
' search in substrings
|
||||
Dim searchMode As BetterListViewSearchMode = BetterListViewSearchMode.Substring
|
||||
|
||||
' use case-sensitive searching and play sounds
|
||||
Dim searchOptions As BetterListViewSearchOptions =
|
||||
(BetterListViewSearchOptions.CaseSensitive Or BetterListViewSearchOptions.PlaySound)
|
||||
|
||||
' search in the first and second column
|
||||
'NOTE: empty array also means searching in all columns
|
||||
Dim subItemIndices As Integer() = New Integer() {0, 1}
|
||||
|
||||
' set-up the search
|
||||
ListView.SearchSettings = New BetterListViewSearchSettings (searchMode, searchOptions, subItemIndices)
|
||||
|
||||
ListView.EndUpdate()</code></pre>
|
||||
|
||||
<br><div class="banner">
|
||||
<a href="../../../../page/6/index.html"><img src="../resources/overview.gif.html" alt="Better ListView" class="ss"></a>
|
||||
<div class="inside">
|
||||
<div class="text">Better ListView: Ultimate .NET ListView replacement control for WinForms (C#, VB.NET)</div>
|
||||
<span class="dbtn-c dbtn-hilight"><span class="dbtn-w"><a href="../../../../../betterlistview.exe" class="dbtn">Download</a></span></span>
|
||||
<span class="dbtn-c"><span class="dbtn-w"><a href="../../../../page/6/index.html" class="dbtn">More Info</a></span></span>
|
||||
</div>
|
||||
</div>
|
||||
<table class="navigation"><tr>
|
||||
<td class="navigation-previous"><a href="chapter-save-load.html"><strong>
|
||||
« Saving and Loading ListView Content</strong></a></td>
|
||||
<td class="navigation-index"><a href="../index.html"><strong>Index</strong></a></td>
|
||||
<td class="navigation-next"><a href="chapter-serialization.html"><strong>Serialization »
|
||||
</strong></a></td>
|
||||
</tr></table>
|
||||
<br><table class="footer"><tr>
|
||||
<td class="footer-title">Better ListView Documentation
|
||||
</td>
|
||||
<td class="footer-copyright">
|
||||
Copyright © 2010-2012 <a href="../../../../../index.html" target="_blank">ComponentOwl.com</a>
|
||||
</td>
|
||||
</tr></table>
|
||||
</div></body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user