public MoveToolTip ( int left, int top, int topOffset, int listLeft = null ) : void | ||
left | int | |
top | int | |
topOffset | int | |
listLeft | int | |
Résultat | void |
// Runs on the main thread void FormulaEditMove(Rect editWindowBounds, IntPtr excelToolTipWindow) { Debug.Print($"IntelliSenseDisplay - FormulaEditMove"); if (_argumentsToolTip == null) { Logger.Display.Warn("FormulaEditMode Unexpected null Arguments ToolTip!?"); return; } int topOffset = GetTopOffset(excelToolTipWindow); _argumentsToolTip.MoveToolTip((int)editWindowBounds.Left, (int)editWindowBounds.Bottom + 5, topOffset); }
void FunctionListMove(Rect selectedItemBounds, Rect listBounds) { _descriptionToolTip.MoveToolTip( left: (int)listBounds.Right + DescriptionLeftMargin, top: (int)selectedItemBounds.Bottom - 18, topOffset: 0, listLeft: (int)selectedItemBounds.Left); }
// Runs on the main thread void FormulaEditMove(Rect editWindowBounds, IntPtr excelToolTipWindow) { Debug.Print($"IntelliSenseDisplay - FormulaEditMove"); if (_argumentsToolTip == null) { Logger.Display.Warn("FormulaEditMode Unexpected null Arguments ToolTip!?"); return; } int topOffset = GetTopOffset(excelToolTipWindow); try { _argumentsToolTip.MoveToolTip((int)editWindowBounds.Left, (int)editWindowBounds.Bottom + 5, topOffset); } catch (Exception ex) { Logger.Display.Warn($"IntelliSenseDisplay - FormulaEditMove Error - {ex}"); // Recycle the Arguments ToolTip - won't show now, but should for the next function _argumentsToolTip.Dispose(); _argumentsToolTip = null; } }
// TODO: Need better formula parsing story here // Here are some ideas: http://fastexcel.wordpress.com/2013/10/27/parsing-functions-from-excel-formulas-using-vba-is-mid-or-a-byte-array-the-best-method/ void FormulaEditStateChanged(StateChangeTypeEnum stateChangeType) { // Check for watcher already disposed // CONSIDER: How to manage threading with disposal...? if (_formulaEditWatcher == null) { return; } if (stateChangeType == StateChangeTypeEnum.Move && _argumentsToolTip != null) { _argumentsToolTip.MoveToolTip( (int)_formulaEditWatcher.EditWindowBounds.Left, (int)_formulaEditWatcher.EditWindowBounds.Bottom + 5); return; } Debug.Print("^^^ FormulaEditStateChanged. CurrentPrefix: " + _formulaEditWatcher.CurrentPrefix); if (_formulaEditWatcher.IsEditingFormula && _formulaEditWatcher.CurrentPrefix != null) { string prefix = _formulaEditWatcher.CurrentPrefix; var match = Regex.Match(prefix, @"^=(?<functionName>\w*)\("); if (match.Success) { string functionName = match.Groups["functionName"].Value; IntelliSenseFunctionInfo functionInfo; if (_functionInfoMap.TryGetValue(functionName, out functionInfo)) { // It's ours! if (_argumentsToolTip == null) { _argumentsToolTip = new ToolTipForm(_windowWatcher.MainWindow); } // TODO: Fix this: Need to consider subformulae int currentArgIndex = _formulaEditWatcher.CurrentPrefix.Count(c => c == ','); _argumentsToolTip.ShowToolTip( GetFunctionIntelliSense(functionInfo, currentArgIndex), (int)_formulaEditWatcher.EditWindowBounds.Left, (int)_formulaEditWatcher.EditWindowBounds.Bottom + 5); return; } } } // All other paths, we just clear the box if (_argumentsToolTip != null) { _argumentsToolTip.Hide(); } }
void FunctionListMove(Rect selectedItemBounds, Rect listBounds) { try { _descriptionToolTip?.MoveToolTip( left: (int)listBounds.Right + DescriptionLeftMargin, top: (int)selectedItemBounds.Bottom - 18, topOffset: 0, listLeft: (int)selectedItemBounds.Left); } catch (Exception ex) { Logger.Display.Warn($"IntelliSenseDisplay - FunctionListMove Error - {ex}"); // Recycle the _DescriptionToolTip - won't show now, but should for the next function _descriptionToolTip?.Dispose(); _descriptionToolTip = null; } }