From e40928982cbb837154e50ea1b199fbe7f4d04779 Mon Sep 17 00:00:00 2001 From: blikblum Date: Mon, 19 Feb 2007 18:27:29 +0000 Subject: [PATCH] Fixed bug when CreateWnd is called git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@62 8e941d3f-bd1b-0410-a28a-d453659cc2b4 --- components/virtualtreeview/VTConfig.inc | 2 +- components/virtualtreeview/VirtualTrees.pas | 5 +- .../demos/objects/MVCDemoMain.pas | 5 +- .../demos/objects/MVCTypes.pas | 9 +- .../virtualtreeview/demos/objects/mvcdemo.lpi | 152 ++---------------- components/virtualtreeview/vtlogger.pas | 1 + 6 files changed, 27 insertions(+), 147 deletions(-) diff --git a/components/virtualtreeview/VTConfig.inc b/components/virtualtreeview/VTConfig.inc index 7a9147ce3..94b4c9cf0 100644 --- a/components/virtualtreeview/VTConfig.inc +++ b/components/virtualtreeview/VTConfig.inc @@ -29,7 +29,7 @@ {.$define EnableNativeTVM} {.$define EnablePrint} {$define NeedWindows} -{$define EnableNCFunctions} +{.$define EnableNCFunctions} {.$define EnableAdvancedGraphics} {.$define EnableHeader} {.$define EnableTimer} diff --git a/components/virtualtreeview/VirtualTrees.pas b/components/virtualtreeview/VirtualTrees.pas index 51ee415d3..c4a2408f1 100644 --- a/components/virtualtreeview/VirtualTrees.pas +++ b/components/virtualtreeview/VirtualTrees.pas @@ -17909,8 +17909,9 @@ begin PrepareBitmaps(True, True); // Register tree as OLE drop target. - if not (csDesigning in ComponentState) and (toAcceptOLEDrop in FOptions.FMiscOptions) then - RegisterDragDrop(Handle, DragManager as IDropTarget); + // Somehow calling this code causes a SIGSEG + //if not (csDesigning in ComponentState) and (toAcceptOLEDrop in FOptions.FMiscOptions) then + // RegisterDragDrop(Handle, DragManager as IDropTarget); UpdateScrollBars(True); UpdateHeaderRect; diff --git a/components/virtualtreeview/demos/objects/MVCDemoMain.pas b/components/virtualtreeview/demos/objects/MVCDemoMain.pas index 676785cc7..19aa8692d 100644 --- a/components/virtualtreeview/demos/objects/MVCDemoMain.pas +++ b/components/virtualtreeview/demos/objects/MVCDemoMain.pas @@ -17,7 +17,7 @@ interface uses LCLIntf,Messages,SysUtils,Classes,Graphics,Controls,Forms,Dialogs, MVCTypes,MVCPanel,StdCtrls,ExtCtrls,ImgList,VirtualTrees,ComCtrls, - Buttons, LResources; + Buttons, LResources, vtlogger,ipcchannel; type TfmMVCDemo=class(TForm) pnlControls:TPanel; @@ -87,6 +87,9 @@ end; procedure TfmMVCDemo.FormCreate(Sender: TObject); begin + Logger.Channels.Add(TIPCChannel.Create); + Logger.ActiveClasses:=[lcEditLink]; + Logger.Clear; P:=TMVCPanel.Create(Self); with P do begin diff --git a/components/virtualtreeview/demos/objects/MVCTypes.pas b/components/virtualtreeview/demos/objects/MVCTypes.pas index ddb08a0a4..cc83d8fd3 100644 --- a/components/virtualtreeview/demos/objects/MVCTypes.pas +++ b/components/virtualtreeview/demos/objects/MVCTypes.pas @@ -57,7 +57,7 @@ unit MVCTypes; interface uses Windows, LCLIntf,Messages,SysUtils,Graphics,VirtualTrees,Classes,StdCtrls, - Controls,Forms,ImgList,LCLType, delphicompat; + Controls,Forms,ImgList,LCLType, delphicompat, vtlogger; type { TMVCNode is the encapsulation of a single Node in the structure. This implementation is a bit bloated because in my project @@ -832,6 +832,7 @@ end; function TMVCEditLink.BeginEdit: Boolean; begin + Logger.Send(lcEditLink,'FEdit.Handle',FEdit.Handle); Result := True; FEdit.Show; FEdit.SetFocus; @@ -923,17 +924,20 @@ end; procedure TMVCEdit.WMChar(var Message: TWMChar); // handle character keys begin + Logger.EnterMethod(lcEditLink,'WMChar'); // avoid beep if Message.CharCode <> VK_ESCAPE then begin inherited; if Message.CharCode > $20 then AutoAdjustSize; end; + Logger.ExitMethod(lcEditLink,'WMChar'); end; procedure TMVCEdit.WMKeyDown(var Message: TWMKeyDown); // handles some control keys (either redirection to tree, edit window size or clipboard handling) begin + Logger.EnterMethod(lcEditLink,'TMVCEdit.WMKeyDown'); case Message.CharCode of // pretend these keycodes were send to the tree VK_ESCAPE, @@ -967,14 +971,17 @@ begin AutoAdjustSize; end; end; + Logger.ExitMethod(lcEditLink,'TMVCEdit.WMKeyDown'); end; procedure TMVCEdit.WMKillFocus(var Msg: TWMKillFocus); begin + Logger.EnterMethod(lcEditLink,'TMVCEdit.WMKillFocus'); inherited; // FLink.FTree is set to nil if the link doesn't need to notify the tree (e.g. hiding the edit causes // a kill focus message) if Assigned(FLink.FTree) then FLink.FTree.DoCancelEdit; + Logger.ExitMethod(lcEditLink,'TMVCEdit.WMKillFocus'); end; procedure TMVCEdit.AutoAdjustSize; diff --git a/components/virtualtreeview/demos/objects/mvcdemo.lpi b/components/virtualtreeview/demos/objects/mvcdemo.lpi index c735e21b6..3eac47e8b 100644 --- a/components/virtualtreeview/demos/objects/mvcdemo.lpi +++ b/components/virtualtreeview/demos/objects/mvcdemo.lpi @@ -4,17 +4,19 @@ + + + + - - @@ -35,148 +37,31 @@ - + - - - - - - - - - - - - - - - - - - - - - + + - - - - - - - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - - - - - - - - - - - - - - - - - - @@ -184,25 +69,8 @@ - - - - - - - - - - - - - - - - - diff --git a/components/virtualtreeview/vtlogger.pas b/components/virtualtreeview/vtlogger.pas index 111925663..aaadf5943 100644 --- a/components/virtualtreeview/vtlogger.pas +++ b/components/virtualtreeview/vtlogger.pas @@ -27,6 +27,7 @@ const lcScroll = 12; lcPaintDetails = 13; lcCheck = 14; + lcEditLink = 15; var Logger: TLCLLogger;