سؤال في Tchecklistbox
#3
هنا حل رائع ليجعل TListView يرفع حدث (raise an event) عند تغير حالة الـ Checkbox لكني فشلت في تطبيقه علي لازاروس

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

كود :
uses CommCtrl; procedure TForm1.FormCreate(Sender: TObject) ; begin OriginalListViewWindowProc := ListView1.WindowProc; ListView1.WindowProc := ListViewWindowProcEx; end; procedure TForm1.ListViewWindowProcEx(var Message: TMessage) ; var listItem : TListItem; begin if Message.Msg = CN_NOTIFY then begin if PNMHdr(Message.LParam)^.Code = LVN_ITEMCHANGED then begin with PNMListView(Message.LParam)^ do begin if (uChanged and LVIF_STATE) <> 0 then begin if ((uNewState and LVIS_STATEIMAGEMASK) shr 12) <> ((uOldState and LVIS_STATEIMAGEMASK) shr 12) then begin listItem := listView1.Items[iItem]; memo1.Lines.Add(Format('%s checked:%s', [listItem.Caption, BoolToStr(listItem.Checked, True)])) ; end; end; end; end; end; //original ListView message handling OriginalListViewWindowProc(Message) ; end; procedure TForm1.GetCheckedButtonClick(Sender: TObject) ; var li : TListItem; begin memo1.Lines.Clear; memo1.Lines.Add('Checked Items:') ; for li in listView1.Items do begin if li.Checked then begin memo1.Lines.Add(Format('%s %s %s', [li.Caption, li.SubItems[0], li.SubItems[1]])) ; end; end; end;

الخطأ هو
كود :
unit1.pas(17,57) Error: Identifier not found "TMessage"
الرد


الردود في هذا الموضوع
سؤال في Tchecklistbox - بواسطة a.atalla - 26-07-2010, 10:21 AM
سؤال في Tchecklistbox - بواسطة shagrouni - 26-07-2010, 10:42 AM
سؤال في Tchecklistbox - بواسطة a.atalla - 27-07-2010, 04:02 AM
سؤال في Tchecklistbox - بواسطة shagrouni - 27-07-2010, 05:18 AM
سؤال في Tchecklistbox - بواسطة a.atalla - 27-07-2010, 09:37 PM

التنقل السريع :


يقوم بقرائة الموضوع: بالاضافة الى ( 1 ) ضيف كريم