OSDN Git Service

ログ窓でEnterを押すと、カーソルが最新の瓶に移動してしまう問題修正(ID=431)
authorC.Ponapalt <ponapalt@shillest.net>
Wed, 15 Feb 2006 09:49:54 +0000 (09:49 +0000)
committerC.Ponapalt <ponapalt@shillest.net>
Wed, 15 Feb 2006 09:49:54 +0000 (09:49 +0000)
(リストコントロールをサブクラス化しています。もっとスマートな方法あるかも)

bottleclient/LogForm.dfm
bottleclient/LogForm.pas

index 762d78f..ee6728e 100755 (executable)
@@ -54,12 +54,12 @@ object frmLog: TfrmLog
       OnClick = mnSaveLogXMLClick
     end
     object tbtnDownloadLog: TToolButton
-      Left = 80
+      Left = 82
       Top = 0
       Action = frmSender.actDownloadLog
     end
     object ToolButton1: TToolButton
-      Left = 103
+      Left = 105
       Top = 0
       Width = 8
       Caption = 'ToolButton1'
@@ -67,12 +67,12 @@ object frmLog: TfrmLog
       Style = tbsSeparator
     end
     object tbtnInsertCue: TToolButton
-      Left = 111
+      Left = 113
       Top = 0
       Action = frmSender.actInsertCue
     end
     object tbtnFindBottle: TToolButton
-      Left = 134
+      Left = 136
       Top = 0
       Hint = #12508#12488#12523#12434#26908#32034#12377#12427
       Caption = #26908#32034'(&F)'
@@ -80,7 +80,7 @@ object frmLog: TfrmLog
       OnClick = tbtnFindBottleClick
     end
     object tbtnPreviewStyle: TToolButton
-      Left = 157
+      Left = 159
       Top = 0
       Hint = #12525#12464#12503#12524#12499#12517#12540#12398#34920#31034#24418#24335#12434#22793#26356#12375#12414#12377
       Caption = #12503#12524#12499#12517#12540#12473#12479#12452#12523
@@ -90,7 +90,7 @@ object frmLog: TfrmLog
       OnClick = tbtnPreviewStyleClick
     end
     object tbtnListPreviewStyle: TToolButton
-      Left = 191
+      Left = 195
       Top = 0
       Hint = #12522#12473#12488#12398#12473#12463#12522#12503#12488#34920#31034#24418#24335#12434#22793#26356#12375#12414#12377
       Caption = #12473#12463#12522#12503#12488#34920#31034#24418#24335
@@ -100,7 +100,7 @@ object frmLog: TfrmLog
       OnClick = tbtnListPreviewStyleClick
     end
     object ToolButton2: TToolButton
-      Left = 225
+      Left = 231
       Top = 0
       Width = 8
       Caption = 'ToolButton2'
@@ -108,17 +108,17 @@ object frmLog: TfrmLog
       Style = tbsSeparator
     end
     object tbtnVoteMessage: TToolButton
-      Left = 233
+      Left = 239
       Top = 0
       Action = frmSender.actVoteMessage
     end
     object tbtnAgreeMessage: TToolButton
-      Left = 256
+      Left = 262
       Top = 0
       Action = frmSender.actAgreeMessage
     end
     object tbtnSendEditor: TToolButton
-      Left = 279
+      Left = 285
       Top = 0
       Action = frmSender.actSendToEditor
     end
@@ -127,13 +127,13 @@ object frmLog: TfrmLog
     Left = 0
     Top = 22
     Width = 599
-    Height = 287
+    Height = 294
     Align = alClient
     BevelOuter = bvNone
     TabOrder = 1
     object StatusBar: TStatusBar
       Left = 0
-      Top = 268
+      Top = 275
       Width = 599
       Height = 19
       Panels = <
@@ -143,18 +143,19 @@ object frmLog: TfrmLog
         item
           Width = 50
         end>
+      SimplePanel = False
     end
     object pnlPanel: TPanel
       Left = 0
       Top = 0
       Width = 599
-      Height = 268
+      Height = 275
       Align = alClient
       BevelOuter = bvNone
       TabOrder = 1
       object Splitter: TSplitter
         Left = 0
-        Top = 156
+        Top = 163
         Width = 599
         Height = 3
         Cursor = crVSplit
@@ -165,7 +166,7 @@ object frmLog: TfrmLog
         Left = 0
         Top = 0
         Width = 599
-        Height = 156
+        Height = 163
         Align = alClient
         TabOrder = 0
         object tabBottleLog: TTabControl
@@ -189,6 +190,7 @@ object frmLog: TfrmLog
           Top = 27
           Width = 597
           Height = 16
+          DragReorder = False
           Sections = <
             item
               Alignment = taRightJustify
@@ -230,7 +232,7 @@ object frmLog: TfrmLog
           Left = 1
           Top = 43
           Width = 597
-          Height = 112
+          Height = 119
           Style = lbVirtualOwnerDraw
           Align = alClient
           DragMode = dmAutomatic
@@ -244,14 +246,13 @@ object frmLog: TfrmLog
           OnDragOver = lvwLogDragOver
           OnDrawItem = lvwLogDrawItem
           OnEndDrag = lvwLogEndDrag
-          OnKeyPress = lvwLogKeyPress
           OnMouseDown = lvwLogMouseDown
           OnStartDrag = lvwLogStartDrag
         end
       end
       object pnlPreviewArea: TPanel
         Left = 0
-        Top = 159
+        Top = 166
         Width = 599
         Height = 109
         Align = alBottom
index a4b021b..b6ab598 100755 (executable)
@@ -82,7 +82,6 @@ type
     procedure tbtnClearClick(Sender: TObject);
     procedure FormCreate(Sender: TObject);
     procedure lvwLogDblClick(Sender: TObject);
-    procedure lvwLogKeyPress(Sender: TObject; var Key: Char);
     procedure FormDestroy(Sender: TObject);
     procedure lvwLogClick(Sender: TObject);
     procedure mnSaveLogClick(Sender: TObject);
@@ -143,6 +142,8 @@ type
     // \83\8a\83X\83g\83r\83\85\81[\83h\83\89\83b\83O\83h\83\8d\83b\83v\8aÖ\98A
     FLVScrollDir: TLVScrollDir; // \83X\83N\83\8d\81[\83\8b\95û\8cü
     FLVDragDest: integer;    //\83h\83\8d\83b\83v\82·\82é\88Ê\92u(\82·\82®\89º\82É\82­\82é\83A\83C\83e\83\80\82ÌIndex)
+    // \83\8a\83X\83g\83{\83b\83N\83X\82Ì\83L\81[\83C\83x\83\93\83g\83t\83b\83N\97p
+    FLVWndMethod: TWndMethod;
     //
     procedure UpdateScript(const Script: String);
     procedure UpdateScriptConversationColor(const Script: String);
@@ -162,6 +163,7 @@ type
       LogList, Result: TBottleLogList; UntilIndex: integer = -1);
     procedure DrawListSection(const SectionIndex, Top: Integer;
       const Text: string; const LeftMargin: Integer = 0);
+    procedure lvwLogWindowProc(var Msg: TMessage);
   protected
     procedure CreateParams(var Params: TCreateParams); override;
   public
@@ -270,6 +272,9 @@ end;
 procedure TfrmLog.FormCreate(Sender: TObject);
 var i: integer;
 begin
+  FLVWndMethod := lvwLog.WindowProc;
+  lvwLog.WindowProc := lvwLogWindowProc;
+
   FLVDragDest := -1; // \83\8a\83X\83g\83r\83\85\81[\82Ì\83h\83\89\83b\83O\92\86\82Å\82Í\82È\82¢
   FBottleLogList := TObjectList.Create;
 
@@ -326,6 +331,8 @@ begin
   Pref.LogWindowDividerPos := pnlPreviewArea.Height;
 
   FreeAndNil(FBottleLogList);
+
+  lvwLog.WindowProc := FLVWndMethod;
 end;
 
 procedure TfrmLog.lvwLogDblClick(Sender: TObject);
@@ -420,11 +427,6 @@ begin
   end;
 end;
 
-procedure TfrmLog.lvwLogKeyPress(Sender: TObject; var Key: Char);
-begin
-  if Key = #13 then lvwLogDblClick(Sender);
-end;
-
 procedure TfrmLog.CreateParams(var Params: TCreateParams);
 begin
   inherited;
@@ -1829,4 +1831,17 @@ begin
   end;
 end;
 
+procedure TfrmLog.lvwLogWindowProc(var Msg: TMessage);
+begin
+  if Msg.Msg = WM_CHAR then begin
+    if Msg.WParam = 13 then begin
+      lvwLogDblClick(lvwLog);
+      Msg.Result := 0;
+    end;
+    Exit;
+  end;
+
+  FLVWndMethod(Msg);
+end;
+
 end.