Skip to content

Commit 4541b40

Browse files
committed
Try to tack down in-cell click location bug
1 parent 523b49f commit 4541b40

File tree

4 files changed

+9
-8
lines changed

4 files changed

+9
-8
lines changed

Source/ExcelDna.IntelliSense/ToolTipForm.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,7 @@ public ToolTipForm(IntPtr hwndOwner)
5959
{ FontStyle.Bold | FontStyle.Italic, new Font("Segoe UI", 9, FontStyle.Bold | FontStyle.Italic) },
6060

6161
};
62-
// Color.FromArgb(68, 68, 68) Best matches Excel's built-in color, but I think a bit too light
63-
_textColor = Color.FromArgb(68, 68, 68);
62+
_textColor = Color.FromArgb(72, 72, 72);
6463
_linkColor = Color.Blue;
6564
_borderPen = new Pen(Color.FromArgb(195, 195, 195));
6665
_borderLightPen = new Pen(Color.FromArgb(225, 225, 225));

Source/ExcelDna.IntelliSense/UIMonitor/WinEvents.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,8 @@ void OnWinEventReceived(object winEventArgsObj)
172172
{
173173
var winEventArgs = (WinEventArgs)winEventArgsObj;
174174
#if DEBUG
175-
Logger.WinEvents.Verbose($"{winEventArgs.EventType} - Window {winEventArgs.WindowHandle:X} ({Win32Helper.GetClassName(winEventArgs.WindowHandle)} - Object/Child {winEventArgs.ObjectId} / {winEventArgs.ChildId} - Thread {winEventArgs.EventThreadId} at {winEventArgs.EventTimeMs}");
175+
if (winEventArgs.ObjectId != WinEventObjectId.OBJID_CURSOR)
176+
Logger.WinEvents.Verbose($"{winEventArgs.EventType} - Window {winEventArgs.WindowHandle:X} ({Win32Helper.GetClassName(winEventArgs.WindowHandle)} - Object/Child {winEventArgs.ObjectId} / {winEventArgs.ChildId} - Thread {winEventArgs.EventThreadId} at {winEventArgs.EventTimeMs}");
176177
#endif
177178
WinEventReceived?.Invoke(this, winEventArgs);
178179
}

Source/ExcelDna.IntelliSense/UIMonitor/WindowWatcher.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,8 @@ internal WindowChangedEventArgs(IntPtr windowHandle, WinEventHook.WinEvent winEv
7272
Type = ChangeType.LocationChange;
7373
break;
7474
default:
75-
throw new ArgumentException("Unexpected WinEvent type", nameof(winEvent));
75+
// throw new ArgumentException("Unexpected WinEvent type", nameof(winEvent));
76+
break;
7677
}
7778
switch (objectId)
7879
{
@@ -86,7 +87,7 @@ internal WindowChangedEventArgs(IntPtr windowHandle, WinEventHook.WinEvent winEv
8687
ObjectId = ChangeObjectId.Caret;
8788
break;
8889
default:
89-
Debug.Fail("Unexpected ObjectId");
90+
//Debug.Fail("Unexpected ObjectId");
9091
ObjectId = ChangeObjectId.Unknown;
9192
break;
9293
}

Source/ExcelDna.IntelliSense/UIMonitor/XlCall.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,12 +64,12 @@ public static string GetFormulaEditPrefix()
6464
}
6565
if (fmlaInfo.wPointMode == xlModeReady)
6666
{
67-
// Logger.WindowWatcher.Verbose($"LPenHelper PointMode Ready");
67+
Logger.WindowWatcher.Verbose($"LPenHelper PointMode Ready");
6868
return null;
6969
}
7070

71-
//Logger.WindowWatcher.Verbose("LPenHelper Status: PointMode: {0}, Formula: {1}, First: {2}, Last: {3}, Caret: {4}",
72-
// fmlaInfo.wPointMode, Marshal.PtrToStringUni(fmlaInfo.lpch, fmlaInfo.cch), fmlaInfo.ichFirst, fmlaInfo.ichLast, fmlaInfo.ichCaret);
71+
Logger.WindowWatcher.Verbose("LPenHelper Status: PointMode: {0}, Formula: {1}, First: {2}, Last: {3}, Caret: {4}",
72+
fmlaInfo.wPointMode, Marshal.PtrToStringUni(fmlaInfo.lpch, fmlaInfo.cch), fmlaInfo.ichFirst, fmlaInfo.ichLast, fmlaInfo.ichCaret);
7373

7474
var prefixLen = Math.Min(Math.Max(fmlaInfo.ichCaret, fmlaInfo.ichLast), fmlaInfo.cch); // I've never seen ichLast > cch !?
7575
return Marshal.PtrToStringUni(fmlaInfo.lpch, prefixLen);

0 commit comments

Comments
 (0)