Board index » delphi » Listview starts dragging: Bug or just odd behaviour?
ctimm...@NOSPAMlgrs.com (Chris R. Timmons)
![]() Delphi Developer |
Sun, 27 Oct 2002 03:00:00 GMT
|
ctimm...@NOSPAMlgrs.com (Chris R. Timmons)
![]() Delphi Developer |
Sun, 27 Oct 2002 03:00:00 GMT
Listview starts dragging: Bug or just odd behaviour?
aste...@nospam.iafrica.com (Anthony Steele) wrote in
<8fbm3s$1...@bornews.borland.com>: Quote>unit Unit1; In the listview, set DragMode to dmManual. HTH, Chris. |
Anthony Steel
![]() Delphi Developer |
Mon, 28 Oct 2002 03:00:00 GMT
Re:Listview starts dragging: Bug or just odd behaviour?Quote> Anthony, not dmManual, because this program is cut down from a real world program that has two listviews, and yes, you can drag between them, so I want DragMode to be dmAutomatic. The problem is that dragging is turned on at unwanted times. I tried to fix by setting DragMode to dmManual and coding as follows: procedure TForm1.ListView1Changing(Sender: TObject; Item: TListItem; but so that's not hopeful. I also tried to code around it like this, but this version also has severe procedure TForm1.ListView1Changing(Sender: TObject; Item: TListItem; if csDestroying in ListView1.ComponentState then if Change = ctState then BTW, I am running Delphi 5.0 on Win2K l8r |
Raghavendra Ra
![]() Delphi Developer |
Mon, 28 Oct 2002 03:00:00 GMT
Re:Listview starts dragging: Bug or just odd behaviour?QuoteAnthony Steele <aste...@nospam.iafrica.com> wrote in message Quote> > Anthony, the change by default is is True. |
Anthony Steel
![]() Delphi Developer |
Mon, 28 Oct 2002 03:00:00 GMT
Re:Listview starts dragging: Bug or just odd behaviour?Quote"Raghavendra Rao" <ragh...@geocities.com> wrote in message suggestion relates to unwanted dragging, as starting to drag is not a change that calls the OnChanging event far as I know (OnStartDrag is signalled, and you don't have the option to not Accept). However this brings me to a percieved deficiency in the List view, ie that go back to the original sample, make sure that DragMode is dmAutomatic, and procedure TForm1.ListView1Changing(Sender: TObject; Item: TListItem; if Item = nil then end; Besides the drag mode bug, the output when changing from one item to another *how can these 4 invocations be reliably distingished?* How can I deal only The intension of the original code was as follows (in pseudocode) procedure TForm1.ListView1Changing(Sender: TObject; Item: TListItem; if IsObjectDirty(Item.Data) then end; There is no need to go through this procedure 4 times. Once will do, if you The docs say Change: TItemChange can be "ctState: A change to the list item' l8r |
Greg Chapma
![]() Delphi Developer |
Mon, 28 Oct 2002 03:00:00 GMT
Re:Listview starts dragging: Bug or just odd behaviour?On Wed, 10 May 2000 15:06:35 +0200, "Anthony Steele" Quote<aste...@nospam.iafrica.com> wrote: WM_LBUTTONDOWN VCL Listview The root of the problem is that the listview code in comctl32.dll handles a It looks to me like it would be better to do what the treeview does: use an Greg Chapman |
Chris R. Timmo
![]() Delphi Developer |
Mon, 28 Oct 2002 03:00:00 GMT
Re:Listview starts dragging: Bug or just odd behaviour?aste...@nospam.iafrica.com (Anthony Steele) wrote in <8fdr44$j...@bornews.borland.com>: Quote>> Anthony, I posted a zipped-up example app in borland.public.attachments which If you can't get that group, e-mail me (ctimm...@lgrs.com) and I'll e-mail HTH, Chris. |
Anthony Steel
![]() Delphi Developer |
Tue, 29 Oct 2002 03:00:00 GMT
Re:Listview starts dragging: Bug or just odd behaviour?Quote> It looks to me like it would be better to do what the treeview does: use Yes/No Cancel", with cancel taking you back to the old item? At present I have disabled all that and am always saving changes. Strange that you should mention Tree view, as I first did this on a tree Quote> Anyway, I am not sure this will work, but you might try sending the to work out what you meant, I have coded it (correctly I hope). The implementation below runs, and does not exhibit the dragging bug, but it also never drags unit Unit1; { test program by Anthony Steele interface uses type var implementation {$R *.DFM} uses CommCtrl; procedure TForm1.ListView1Changing(Sender: TObject; Item: TListItem; if ListView1 = nil then if Change = ctState then end; end. ---dfm as before--- |
Greg Chapma
![]() Delphi Developer |
Wed, 30 Oct 2002 03:00:00 GMT
Re:Listview starts dragging: Bug or just odd behaviour?On Fri, 12 May 2000 12:44:33 +0200, "Anthony Steele" Quote<aste...@nospam.iafrica.com> wrote: procedure TForm1.ListView1Changing(Sender: TObject; Item: TListItem; if Change = ctState then end; Normally, WM_NOTIFY messages are sent to the parent of the control which is Ideally, the above code would also only execute when the state change involves a As to your larger question of how to prompt for saving before focus moves from Greg Chapman |
Anthony Steel
![]() Delphi Developer |
Thu, 31 Oct 2002 03:00:00 GMT
Re:Listview starts dragging: Bug or just odd behaviour?"Greg Chapman" <g...@well.com> wrote Quote> If you're comfortable writing a TListView descendant, you can add "no, do not allow the change" I get that message 3 times over. Any clues at to what I'm doing wrong here? unit ListViewEx; { AFS 14 May 2K Quote} uses ComCtrls, CommCtrl, Controls, Messages, Windows; type { should derive from TCustomListView } procedure CNNotify(var Message: TWMNotify); message CN_NOTIFY; procedure ItemChanging(var ListViewChange: TNMListView; var Result: protected published end; implementation function HasFlag(a, b: integer): Boolean; function BooleanToInteger(pb: Boolean): longint; { from ComCtrls} procedure TListViewEx.CNNotify(var Message: TWMNotify); with Message do procedure TlistViewEx.ItemChanging(var ListViewChange: TNMListView; var { MSDN says "Return FALSE to allow the change" } function TlistViewEx.AllowChange(const feOldState, feNewState: TItemStates): { call the event handler if it exists } end; procedure TListViewEx.FakeClick; Perform(CN_NOTIFY, 0, integer(@nmHDR)); end. unit Unit1; interface uses { local} ListViewEx; type function CanChange(const feOldState, feNewState: TItemStates): boolean; public var implementation {$R *.DFM} uses CommCtrl; function Query: Boolean; function TForm1.CanChange(const feOldState, feNewState: TItemStates): { allow item to be deselected ? } end; { as a corollary of the above, don't allow an item to become selected end; procedure TForm1.FormCreate(Sender: TObject); lcCol := lv1.Columns.Add; lv1.DragMode := dmAutomatic; lcItem := lv1.Items.Add; lcItem := lv1.Items.Add; lcItem := lv1.Items.Add; procedure TForm1.FormDestroy(Sender: TObject); end. |
l
![]() Delphi Developer |
Thu, 31 Oct 2002 03:00:00 GMT
Re:Listview starts dragging: Bug or just odd behaviour?As someone else already said, it is not a good idea to put up a dialog while procedure form1.listviewonediting(Sender: TObject; Item: TListItem; var procedure UMOnLVEdit(var msg : TMessage);message UM_ONLVEDIT; As for what is happening in OnChange event, it's something like this If you are using D5, the listview has an event called OnSelectItem which Anthony Steele said something like Quote
|
Anthony Steel
![]() Delphi Developer |
Fri, 01 Nov 2002 03:00:00 GMT
Re:Listview starts dragging: Bug or just odd behaviour?Quote"lj" <linda...@bellatlantic.net> wrote in message Quote
the designers of this control did not cater for that idea. Quote> Showing a message/dialog causes the OnChange event nothing of the sort so the OnEditing event is irrelevant to me. The item in the list has a pointer to an object that is displayed in detail Quote> As for what is happening in OnChange event, it's something like this poking about tomorrow to see if I can get a flag set up to prevent the messagebox repeating. l8r |
1. Odd behaviour with frames - can anyone explain this ?
3. Delphi has odd SQL Server 7 behaviour
4. Palette Load, Odd Behaviour
5. Odd behaviour in TOutline component
6. Resetting a Memo produces odd behaviour
8. Parameter ftDateTime Datatype Odd Behaviour
9. Odd Behaviour With MS Access SQL Links Driver vs ODBC Driver