我在ListView1的OnClick事件中,使用ListView1.Selected.Index作为判断点击的
是哪个item 后,处理相应的事。
当我点击ListView1的空白区域时就出现异常提示(project prj*.exe raised exception class EAccessViolation with message 'Access violation at address 0045A970 in module 'prj*.exe'. Read of address 00000004'. Process stopped. Use Step or Run to continue.)。
请问怎样处理这种情况。
是哪个item 后,处理相应的事。
当我点击ListView1的空白区域时就出现异常提示(project prj*.exe raised exception class EAccessViolation with message 'Access violation at address 0045A970 in module 'prj*.exe'. Read of address 00000004'. Process stopped. Use Step or Run to continue.)。
请问怎样处理这种情况。
解决方案 »
- 如何在delphi中调用帮助文件(格式为.chm)?------- 急(在线等)
- 请问一个控件叫什么名字?哪里有下载?
- 程序中如何判断是在98系统、2000系统还是xp系统上运行??
- delphi阶段性学习.
- 请教几个 Delphi 最基本的问题.. 谢谢.
- 窗体第一次调用后,第二调用为什么出现access violation at dress .....提示
- 如何实现瑞星那样淡入淡出的程序启动界面?
- 怎样在ocx种添加属性? tmd 老子又要出血了,高分!
- 谁能告诉我printsetup控件哪里有?如何调用?即答即得。
- 请教如何获得TDBLookupComboBox类控件中的文本
- 怪问题,看了你也许还是不明白!
- “download by netants"的click事件
我的目的是要点击其中的的某一项后,进入另一个窗体,当前的listview 所在的窗体被释放掉。我在OnClick中用来判断其存在和执行的语句是
if ListView.Selected.Index in [0..7] then
case ListView.Selected.Index of
0,4:;
1,2,3:TreeView1.Items.Item[2].Selected := true;
5,6,7:TreeView1.Items.Item[3].Selected := true;
end;
(我是用TreeView1控制不同窗体的显示,想模拟Outlook里面单击某个箱后进入这个箱子的窗口。)
我把上面的语句放在ONCHANGE事件也是出现上面的错误。
但更节约系统开销,你那样一点击就要执行,我这儿只要是选择了
某一项才执行,岂不是好些吗?以下是我的一段代码。
用下面两句可以判断是否点到空白。
if lv1.SelCount<1 then
exit; procedure Tlbsd.lv1SelectItem(Sender: TObject; Item: TListItem;
Selected: Boolean);
var
i:integer;
begin
if lv1.SelCount<1 then //请注意这两行
exit; //请注意这两行
nowpx:=lv1.Selected.Index+1;
for i:=0 to lv1.Items.Count-1 do
lv1.Items[i].ImageIndex:=-1;
lv1.Items.Item[nowpx-1].ImageIndex:=16;
end;
To Drate(鸟窝里的虫) ,genphone_ru(票票) 谢谢!
if ListView.Selected.Index in [0..7] then
case ListView.Selected.Index of
0,4:;
1,2,3:TreeView1.Items.Item[2].Selected := true;
5,6,7:TreeView1.Items.Item[3].Selected := true;
end;