Code: Select all
<!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" dir="ltr" lang="en-gb" xml:lang="en-gb">
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
<meta http-equiv="content-language" content="en-gb" />
<meta http-equiv="content-style-type" content="text/css" />
<meta http-equiv="imagetoolbar" content="no" />
<meta name="resource-type" content="document" />
<meta name="distribution" content="global" />
<meta name="copyright" content="2000, 2002, 2005, 2007 phpBB Group" />
<meta name="keywords" content="" />
<meta name="description" content="" />
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />
<title>PureBasic Forum • View topic - Autocomplete for Comboboxgadget - Simple version</title>
<link rel="stylesheet" href="./style.php?sid=00510aa568832e6ef7e067ada84996fd&id=4&lang=en" type="text/css" />
<script type="text/javascript">
// <![CDATA[
if (0)
{
popup('./ucp.php?i=pm&mode=popup', 400, 225, '_phpbbprivmsg');
}
function popup(url, width, height, name)
{
if (!name)
{
name = '_popup';
}
window.open(url.replace(/&/g, '&'), name, 'height=' + height + ',resizable=yes,scrollbars=yes,width=' + width);
return false;
}
function jumpto()
{
var page = prompt('Enter the page number you wish to go to:', '1');
var per_page = '';
var base_url = '';
if (page !== null && !isNaN(page) && page == Math.floor(page) && page > 0)
{
if (base_url.indexOf('?') == -1)
{
document.location.href = base_url + '?start=' + ((page - 1) * per_page);
}
else
{
document.location.href = base_url.replace(/&/g, '&') + '&start=' + ((page - 1) * per_page);
}
}
}
/**
* Find a member
*/
function find_username(url)
{
popup(url, 760, 570, '_usersearch');
return false;
}
/**
* Mark/unmark checklist
* id = ID of parent container, name = name prefix, state = state [true/false]
*/
function marklist(id, name, state)
{
var parent = document.getElementById(id);
if (!parent)
{
eval('parent = document.' + id);
}
if (!parent)
{
return;
}
var rb = parent.getElementsByTagName('input');
for (var r = 0; r < rb.length; r++)
{
if (rb[r].name.substr(0, name.length) == name)
{
rb[r].checked = state;
}
}
}
// ]]>
</script>
</head>
<body class="ltr">
<a name="top"></a>
<div id="wrapmain">
<div id="wrapheader">
<div id="logodesc">
<table width="100%" cellspacing="0">
<tr>
<td><a href="./index.php"><img src="./styles/subsilverPlus/imageset/purebasic_logo.png" alt="" title="" /></a></td>
<td width="100%" align="center"><h1>PureBasic Forum</h1><span class="gen"><a href="http://www.purebasic.com">PureBasic web site</a><br><a href="http://blog.purebasic.com">PureBasic blog page</a></span></td>
</tr>
</table>
</div><!-- / logodesc -->
<div id="menubar">
<table width="100%" cellspacing="0">
<tr>
<td class="genmed">
<a href="./faq.php"><img src="./styles/subsilverPlus/theme/images/icon_mini_faq.gif" width="12" height="13" alt="*" /> FAQ</a>
<a href="./search.php"><img src="./styles/subsilverPlus/theme/images/icon_mini_search.gif" width="12" height="13" alt="*" /> Search</a> <a href="./memberlist.php"><img src="./styles/subsilverPlus/theme/images/icon_mini_members.gif" width="12" height="13" alt="*" /> Members</a> <a href="./ucp.php"><img src="./styles/subsilverPlus/theme/images/icon_mini_profile.gif" width="12" height="13" alt="*" /> User Control Panel</a> </td>
<td class="genmed" align="right">
<a href="./ucp.php?i=pm&folder=inbox"><img src="./styles/subsilverPlus/theme/images/icon_mini_message.gif" width="12" height="13" alt="*" /> <strong>0</strong> new messages</a> <a href="./ucp.php?mode=logout&sid=00510aa568832e6ef7e067ada84996fd"><img src="./styles/subsilverPlus/theme/images/icon_mini_login.gif" width="12" height="13" alt="*" /> Logout [ Vera ]</a> </td>
</tr>
</table>
</div><!-- / menubar -->
<div id="datebar">
<table width="100%" cellspacing="0">
<tr>
<td class="gensmall">Last visit was: 02.11.09 18h39</td>
<td class="gensmall" align="right">It is currently 10.11.09 1h20<br /></td>
</tr>
</table>
</div>
</div><!-- / wrapheader -->
<div id="wrapcentre">
<p class="searchbar">
<span style="float: left;"><a href="./search.php?search_id=unanswered">View unanswered posts</a> | <a href="./search.php?search_id=active_topics">View active topics</a></span>
<span style="float: right;"><a href="./search.php?search_id=newposts">View new posts</a> | <a href="./search.php?search_id=egosearch">View your posts</a></span>
</p>
<br style="clear: both;" />
<table class="tablebg" width="100%" cellspacing="1" cellpadding="0" style="margin-top: 5px;">
<tr>
<td class="row1">
<p class="breadcrumbs"><a href="./index.php">Board index</a> » <a href="./viewforum.php?f=29">PureBasic</a> » <a href="./viewforum.php?f=12">Tricks 'n' Tips</a></p>
<p class="datetime">All times are UTC + 1 hour [ <abbr title="Daylight Saving Time">DST</abbr> ]</p>
</td>
</tr>
</table> <br />
<div id="pageheader">
<h2><a class="titles" href="./viewtopic.php?f=12&t=39844&start=0">Autocomplete for Comboboxgadget - Simple version</a></h2>
</div>
<br clear="all" /><br />
<div id="pagecontent">
<table width="100%" cellspacing="1">
<tr>
<td align="left" valign="middle" nowrap="nowrap">
<a href="./posting.php?mode=post&f=12"><img src="./styles/subsilverPlus/imageset/en/button_topic_new.gif" alt="Post new topic" title="Post new topic" /></a> <a href="./posting.php?mode=reply&f=12&t=39844"><img src="./styles/subsilverPlus/imageset/en/button_topic_reply.gif" alt="Reply to topic" title="Reply to topic" /></a> </td>
<td class="nav" valign="middle" nowrap="nowrap"> Page <strong>1</strong> of <strong>1</strong><br /></td>
<td class="gensmall" nowrap="nowrap"> [ 1 post ] </td>
<td class="gensmall" width="100%" align="right" nowrap="nowrap"></td>
</tr>
</table>
<table class="tablebg" width="100%" cellspacing="1">
<tr>
<td class="cat">
<table width="100%" cellspacing="0">
<tr>
<td class="nav" nowrap="nowrap">
<a href="./viewtopic.php?uid=4751&f=12&t=39844&watch=topic&start=0&hash=85fae2e2" title="Subscribe topic">Subscribe topic</a> | <a href="./viewtopic.php?f=12&t=39844&start=0&bookmark=1&hash=85fae2e2" title="Bookmark topic">Bookmark topic</a> | <a href="./viewtopic.php?f=12&t=39844&start=0&view=print" title="Print view">Print view</a> | <a href="./memberlist.php?mode=email&t=39844" title="E-mail friend">E-mail friend</a> </td>
<td class="nav" align="right" nowrap="nowrap"><a href="./viewtopic.php?f=12&t=39844&view=previous">Previous topic</a> | <a href="#unread">First unread post</a> | <a href="./viewtopic.php?f=12&t=39844&view=next">Next topic</a> </td>
</tr>
</table>
</td>
</tr>
</table>
<table class="tablebg" width="100%" cellspacing="1">
<tr>
<th>Author</th>
<th>Message</th>
</tr>
<tr class="row1">
<td align="center" valign="middle">
<a name="unread"></a><a name="p305406"></a>
<b class="postauthor">mesozorn</b>
</td>
<td width="100%" height="25">
<table width="100%" cellspacing="0">
<tr>
<td class="gensmall" width="100%"><div style="float: left;"> <b>Post subject:</b> Autocomplete for Comboboxgadget - Simple version</div><div style="float: right;"><a href="./viewtopic.php?p=305406#p305406"><img src="./styles/subsilverPlus/imageset/icon_post_target_unread.gif" width="12" height="9" alt="New post" title="New post" /></a><b>Posted:</b> 08.11.09 4h24 </div></td>
</tr>
</table>
</td>
</tr>
<tr class="row1">
<td valign="top" class="profile">
<table cellspacing="4" align="center" width="150">
<tr>
<td><img src="./styles/subsilverPlus/imageset/en/icon_user_offline.gif" alt="Offline" title="Offline" /></td>
</tr>
<tr>
<td class="postdetails">User</td>
</tr>
<tr>
<td><img src="./images/ranks/chip_ranks_1.gif" alt="User" title="User" /></td>
</tr>
</table>
<span class="postdetails">
<br /><b>Joined:</b> 20.02.09 3h23<br /><b>Posts:</b> 65 </span>
</td>
<td valign="top">
<table width="100%" cellspacing="5">
<tr>
<td>
<div class="postbody">I have seen other autocomplete routines posted which are very good indeed. This is mine which is very short and very simple:<br /><br /><div class="codetitle"><b>Code:</b></div><div class="codecontent">Structure comboboxinfo<br /> cbSize.l<br /> rcItem.RECT<br /> rcButton.RECT<br /> stateButton.l<br /> hwndCombo.l<br /> hwndEdit.l<br /> hwndList.l<br />EndStructure<br /><br />cbinfo.comboboxinfo<br /><br /><br />OpenWindow(0, 0, 0, 270, 140, "ComboBoxGadget", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)<br /> ComboBoxGadget(0, 10, 10, 250, 21, #PB_ComboBox_Editable)<br /> AddGadgetItem(0, -1, "Adams")<br /> AddGadgetItem(0, -1, "Franklin")<br /> AddGadgetItem(0, -1, "Jefferson")<br /> AddGadgetItem(0, -1, "Walters")<br /> AddGadgetItem(0, -1, "Washington")<br /> SetActiveGadget(0)<br /><br /><br />Repeat<br /> W=WaitWindowEvent()<br /> <br /> <br /> If W=#WM_KEYDOWN And GetActiveGadget()=0<br /> acg=GetActiveGadget()<br /> cbinfo\cbsize=SizeOf(comboboxinfo)<br /> GetComboBoxInfo_(GadgetID(acg),@cbinfo)<br /> tb=cbinfo.comboboxinfo\hwndedit<br /> SendMessage_(tb, #EM_GETSEL, @spos.l, @epos.l) <br /> <br /> matchesfound=0 <br /> For x=0 To CountGadgetItems(acg)-1<br /> If LCase(Left(GetGadgetText(acg),spos)+LCase(Chr(EventwParam())))=LCase(Left(GetGadgetItemText(acg,x),spos+1)) And epos=Len(GetGadgetText(acg))<br /> matchesfound+1:match=x<br /> If matchesfound>1:Break:EndIf<br /> EndIf<br /> Next x<br /> <br /> If matchesfound=1 <br /> ks=GetKeyState_(#VK_SHIFT)<br /> If ks<2:addchar$=LCase(Chr(EventwParam())):Else:addchar$=UCase(Chr(EventwParam())):EndIf<br /> SetGadgetText(acg,Left(GetGadgetText(acg),spos)+addchar$+Mid(GetGadgetItemText(acg,match),spos+2))<br /> SendMessage_(tb, #EM_SETSEL, spos+1, epos+999) <br /> PeekMessage_(@msg.MSG, hWnd, #WM_KEYFIRST, #WM_KEYLAST, #PM_REMOVE)<br /> EndIf<br /> <br /> EndIf<br /> <br /> <br />Until W = #PB_Event_CloseWindow<br /></div><br /><br />It is of course very easy to enhance this so as to be able to add autocomplete functionality to any comboboxgadget created on the fly, without having to go back and edit this source to include each new gadget. I have not added these extra lines to the example above only because it is a fairly obvious enhancement.</div>
<br clear="all" /><br />
<table width="100%" cellspacing="0">
<tr valign="middle">
<td class="gensmall" align="right">
<a href="./report.php?f=12&p=305406"><img src="./styles/subsilverPlus/imageset/en/icon_post_report.gif" alt="Report this post" title="Report this post" /></a> </td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
<tr class="row1">
<td class="profile"><strong><a href="#wrapheader" class="back_top">Top</a></strong></td>
<td><div class="gensmall" style="float: left;"> <a href="./memberlist.php?mode=viewprofile&u=4480"><img src="./styles/subsilverPlus/imageset/en/icon_user_profile.gif" alt="Profile" title="Profile" /></a> <a href="./ucp.php?i=pm&mode=compose&action=quotepost&p=305406"><img src="./styles/subsilverPlus/imageset/en/icon_contact_pm.gif" alt="Send private message" title="Send private message" /></a> </div> <div class="gensmall" style="float: right;"><a href="./posting.php?mode=quote&f=12&p=305406"><img src="./styles/subsilverPlus/imageset/en/icon_post_quote.gif" alt="Reply with quote" title="Reply with quote" /></a> </div></td>
</tr>
<tr>
<td class="spacer" colspan="2" height="1"><img src="images/spacer.gif" alt="" width="1" height="1" /></td>
</tr>
</table>
<table width="100%" cellspacing="1" class="tablebg">
<tr align="center">
<td class="cat"><form name="viewtopic" method="post" action="./viewtopic.php?f=12&t=39844&start=0"><span class="gensmall">Display posts from previous:</span> <select name="st" id="st"><option value="0" selected="selected">All posts</option><option value="1">1 day</option><option value="7">7 days</option><option value="14">2 weeks</option><option value="30">1 month</option><option value="90">3 months</option><option value="180">6 months</option><option value="365">1 year</option></select> <span class="gensmall">Sort by</span> <select name="sk" id="sk"><option value="a">Author</option><option value="t" selected="selected">Post time</option><option value="s">Subject</option></select> <select name="sd" id="sd"><option value="a" selected="selected">Ascending</option><option value="d">Descending</option></select> <input class="btnlite" type="submit" value="Go" name="sort" /></form></td>
</tr>
</table>
<table width="100%" cellspacing="1">
<tr>
<td align="left" valign="middle" nowrap="nowrap">
<a href="./posting.php?mode=post&f=12"><img src="./styles/subsilverPlus/imageset/en/button_topic_new.gif" alt="Post new topic" title="Post new topic" /></a> <a href="./posting.php?mode=reply&f=12&t=39844"><img src="./styles/subsilverPlus/imageset/en/button_topic_reply.gif" alt="Reply to topic" title="Reply to topic" /></a> </td>
<td class="nav" valign="middle" nowrap="nowrap"> Page <strong>1</strong> of <strong>1</strong><br /></td>
<td class="gensmall" nowrap="nowrap"> [ 1 post ] </td>
<td class="gensmall" width="100%" align="right" nowrap="nowrap"></td>
</tr>
</table>
</div>
<div id="pagefooter"></div>
<br clear="all" />
<table class="tablebg" width="100%" cellspacing="1" cellpadding="0" style="margin-top: 5px;">
<tr>
<td class="row1">
<p class="breadcrumbs"><a href="./index.php">Board index</a> » <a href="./viewforum.php?f=29">PureBasic</a> » <a href="./viewforum.php?f=12">Tricks 'n' Tips</a></p>
<p class="datetime">All times are UTC + 1 hour [ <abbr title="Daylight Saving Time">DST</abbr> ]</p>
</td>
</tr>
</table> <br clear="all" />
<table class="tablebg" width="100%" cellspacing="1">
<tr>
<td class="cat"><h4>Who is online</h4></td>
</tr>
<tr>
<td class="row1"><p class="gensmall">Users browsing this forum: <a href="./memberlist.php?mode=viewprofile&u=4751">Vera</a> and 0 guests</p></td>
</tr>
</table>
<br clear="all" />
<table width="100%" cellspacing="1">
<tr>
<td width="40%" valign="top" nowrap="nowrap" align="left"></td>
<td align="right" valign="top" nowrap="nowrap"><span class="gensmall">You <strong>can</strong> post new topics in this forum<br />You <strong>can</strong> reply to topics in this forum<br />You <strong>can</strong> edit your posts in this forum<br />You <strong>can</strong> delete your posts in this forum<br /></span></td>
</tr>
</table>
<br clear="all" />
<table width="100%" cellspacing="0">
<tr>
<td><form method="post" name="search" action="./search.php?t=39844"><span class="gensmall">Search for:</span> <input class="post" type="text" name="keywords" size="20" /> <input class="btnlite" type="submit" value="Go" /></form></td>
<td align="right"> <form method="post" name="jumpbox" action="./viewforum.php" onsubmit="if(document.jumpbox.f.value == -1){return false;}">
<table cellspacing="0" cellpadding="0" border="0">
<tr>
<td nowrap="nowrap"><span class="gensmall">Jump to:</span> <select name="f" onchange="if(this.options[this.selectedIndex].value != -1){ document.forms['jumpbox'].submit() }">
<option value="-1">Select a forum</option>
<option value="-1">------------------</option> <option value="29">PureBasic</option>
<option value="13"> Coding Questions</option>
<option value="16"> Game Programming</option>
<option value="18"> The PureBasic Editor</option>
<option value="22"> The Visual Designer</option>
<option value="7"> General Discussion</option>
<option value="3"> Feature Requests and Wishlists</option>
<option value="12" selected="selected"> Tricks 'n' Tips</option>
<option value="30">Bug Reports</option>
<option value="4"> Bugs - Windows</option>
<option value="23"> Bugs - Linux</option>
<option value="24"> Bugs - Mac OSX</option>
<option value="31">OS Specific</option>
<option value="10"> AmigaOS</option>
<option value="15"> Linux</option>
<option value="5"> Windows</option>
<option value="19"> Mac OSX</option>
<option value="32">Miscellaneous</option>
<option value="14"> Announcement</option>
<option value="17"> Off Topic</option>
<option value="33">Showcase</option>
<option value="27"> Applications - Feedback and Discussion</option>
<option value="25"> PureFORM & JaPBe</option>
<option value="26"> TailBite </option>
</select> <input class="btnlite" type="submit" value="Go" /></td>
</tr>
</table>
</form>
</td>
</tr>
</table>
</div><!-- / wrapcentre -->
<!--
We request you retain the full copyright notice below including the link to www.phpbb.com.
This not only gives respect to the large amount of time given freely by the developers
but also helps build interest, traffic and use of phpBB3. If you (honestly) cannot retain
the full copyright we ask you at least leave in place the "Powered by phpBB" line, with
"phpBB" linked to www.phpbb.com. If you refuse to include even this then support on our
forums may be affected.
The phpBB Group : 2006
//-->
<!--
phpBB style name: subsilver+
Based on style: subsilver2 (this is the default phpBB3 style)
Author: Sevdin Filiz ( http://www.canversoft.net/ )
//-->
<div align=center>
<script type="text/javascript"><!--
google_ad_client = "pub-9400838095205149";
/* 728x90, forum anglais */
google_ad_slot = "3681155193";
google_ad_width = 728;
google_ad_height = 90;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
<br> <br>
</div>
<div id="wrapfooter">
<br /><br /> <span class="copyright">Powered by <a href="http://www.phpbb.com/">phpBB</a> © 2008 phpBB Group <br />subSilver+ theme by <a href="http://www.canversoft.net/" title="kurumsal ve bireysel web çözümleri" target="_blank">Canver Software</a>, sponsor <a href="http://www.sanalmodifiye.com/" title="Sanal Modifiye" target="_blank">Sanal Modifiye</a>
</span>
</div>
</div><!-- / wrapmain -->
</body>
</html>