Recent

Author Topic: About Tchecklistbox  (Read 9326 times)

a.atalla

  • Jr. Member
  • **
  • Posts: 82
About Tchecklistbox
« on: July 11, 2010, 02:25:07 pm »
on my small application i used a Tchecklistbox  which has some items
i can control the checkboxes  but i need to make an event handler for each item
i only found   CheckListBox1ClickCheck  but this work when i check any of the items
i need a seperate handler for each item
Lazarus 1.0.8 | FPC 2.6.2 x64  | Arch Linux x64 | Windows 7-x86

theo

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1927
Re: About Tchecklistbox
« Reply #1 on: July 11, 2010, 03:01:23 pm »
Doesn't OnItemClick work?

Code: [Select]
procedure TForm1.CheckListBox1ItemClick(Sender: TObject; Index: integer);
begin
  if CheckListBox1.Checked[Index] then
  CheckListBox1.Items[index]:='checked' else CheckListBox1.Items[index]:='not checked';
end;

a.atalla

  • Jr. Member
  • **
  • Posts: 82
Re: About Tchecklistbox
« Reply #2 on: July 11, 2010, 05:57:41 pm »
Thanks
it work perfectly ,i didnot notice this event ...LOL
Lazarus 1.0.8 | FPC 2.6.2 x64  | Arch Linux x64 | Windows 7-x86

a.atalla

  • Jr. Member
  • **
  • Posts: 82
Re: About Tchecklistbox
« Reply #3 on: July 17, 2010, 07:30:07 am »
Can i add an icon to each item in the checklistbox i saw it in many applications
can it be done in lazarus?
just like this application in gnome

http://i.imgur.com/VzoNJ.png
« Last Edit: July 17, 2010, 07:52:04 am by a.atalla »
Lazarus 1.0.8 | FPC 2.6.2 x64  | Arch Linux x64 | Windows 7-x86

Marc

  • Administrator
  • Hero Member
  • *
  • Posts: 2582
Re: About Tchecklistbox
« Reply #4 on: July 17, 2010, 08:10:47 pm »
IIRC this is possible with a TListview or you can use a ownerdraw checklistbox
//--
{$I stdsig.inc}
//-I still can't read someones mind
//-Bugs reported here will be forgotten. Use the bug tracker

a.atalla

  • Jr. Member
  • **
  • Posts: 82
Re: About Tchecklistbox
« Reply #5 on: July 26, 2010, 12:05:18 am »
Tlistview is great  but it doesnot have the event  OnItemClick

itried to use onChange for the lisview but it doesnot work as i wish cause it execute the event in 2 cases  (selected changes or checked changes ) and my needs it to work only when i change the checked proberty only


about the ownerdraw listbox is there any tutorial to show how to do it ????????/
« Last Edit: July 26, 2010, 11:20:19 am by a.atalla »
Lazarus 1.0.8 | FPC 2.6.2 x64  | Arch Linux x64 | Windows 7-x86

a.atalla

  • Jr. Member
  • **
  • Posts: 82
Re: About Tchecklistbox
« Reply #6 on: July 27, 2010, 04:57:20 am »
This is  a perfect solution to make the listview raise n event when the checked status is changed
but i couldnot apply it for lazarus  :(

http://delphi.about.com/od/delphitips2007/qt/listviewchecked.htm

any help
Lazarus 1.0.8 | FPC 2.6.2 x64  | Arch Linux x64 | Windows 7-x86

Marc

  • Administrator
  • Hero Member
  • *
  • Posts: 2582
Re: About Tchecklistbox
« Reply #7 on: July 27, 2010, 02:37:03 pm »
File a bugrep with a feature request to add this. To me is shouldn't be to difficult to add this to the widgetsets.
//--
{$I stdsig.inc}
//-I still can't read someones mind
//-Bugs reported here will be forgotten. Use the bug tracker

 

TinyPortal © 2005-2018