⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 134.htm

📁 水木清华的BBS文章
💻 HTM
字号:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>CTerm非常精华下载</title>
</head>
<body bgcolor="#FFFFFF">
<table border="0" width="100%" cellspacing="0" cellpadding="0" height="577">
<tr><td width="32%" rowspan="3" height="123"><img src="DDl_back.jpg" width="300" height="129" alt="DDl_back.jpg"></td><td width="30%" background="DDl_back2.jpg" height="35"><p align="center"><a href="http://bbs.tsinghua.edu.cn"><font face="黑体"><big><big>水木清华★</big></big></font></a></td></tr>
<tr>
<td width="68%" background="DDl_back2.jpg" height="44"><big><big><font face="黑体"><p align="center">         Delphi编程                            (BM: strayli FlyingBoy)          </font></big></big></td></tr>
<tr>
<td width="68%" height="44" bgcolor="#000000"><font face="黑体"><big><big><p   align="center"></big></big><a href="http://cterm.163.net"><img src="banner.gif" width="400" height="60" alt="banner.gif"border="0"></a></font></td>
</tr>
<tr><td width="100%" colspan="2" height="454"> <p align="center">[<a href="index.htm">回到开始</a>][<a href="6.htm">上一层</a>][<a href="135.htm">下一篇</a>]
<hr><p align="left"><small>发信人: redforks (Forks), 信区: Delphi <br>

标  题: Dephi Bug - Read ListBox的itemIndex属性 <br>

发信站: BBS 水木清华站 (Fri Nov 27 20:05:37 1998) WWW-POST <br>

  <br>

当TListBox中没有item时,itemIndex应该是-1,但在D4中,实际读出的却是0,即无法 <br>

通过itemIndex判断ListBox是否为空。可以用下面这个函数代替读itemIndex属性解决: <br>

function GetListBoxItemIndex(ListBox: TListBox): integer; <br>

begin <br>

  assert(ListBox is TListBox); <br>

  with (ListBox as TListBox) do <br>

  begin <br>

    if MultiSelect then <br>

      Result := SendMessage(Handle, LB_GETCARETINDEX, 0, 0) <br>

    else <br>

      Result := SendMessage(Handle, LB_GETCURSEL, 0, 0); <br>

  end; <br>

end; <br>

该函数根据ListBox就能返回这个ListBox的itemIndex.这个BUG,是Dephi 4 中新引入 <br>

的,在以前版本中没有。似乎在Delphi 4 Update 1中已经解决了这个问题。 <br>

  <br>

-- <br>

※ 来源:·BBS 水木清华站 bbs.net.tsinghua.edu.cn·[FROM: 202.119.199.100] <br>

  <br>

</small><hr>
<p align="center">[<a href="index.htm">回到开始</a>][<a href="6.htm">上一层</a>][<a href="135.htm">下一篇</a>]
<p align="center"><a href="http://cterm.163.net">欢迎访问Cterm主页</a></p>
</body>
</html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -