@@ -164,6 +164,10 @@ void StateUpdate(object sender, UIStateUpdate update)
164164 var fetc = ( UIState . FormulaEdit ) update . NewState ;
165165 FormulaEditTextChange ( fetc . FormulaPrefix , fetc . EditWindowBounds , fetc . ExcelToolTipWindow ) ;
166166 break ;
167+ case UIStateUpdate . UpdateType . FormulaEditExcelToolTipChange :
168+ var fett = ( UIState . FormulaEdit ) update . NewState ;
169+ FormulaEditExcelToolTipShow ( fett . EditWindowBounds , fett . ExcelToolTipWindow ) ;
170+ break ;
167171 case UIStateUpdate . UpdateType . FunctionListShow :
168172 var fls = ( UIState . FunctionList ) update . NewState ;
169173 // TODO: TEMP
@@ -185,10 +189,7 @@ void StateUpdate(object sender, UIStateUpdate update)
185189 case UIStateUpdate . UpdateType . FormulaEditEnd :
186190 FormulaEditEnd ( ) ;
187191 break ;
188- case UIStateUpdate . UpdateType . FormulaEditExcelToolTipChange :
189- //var fett = (UIState.FormulaEdit)update.NewState;
190- //FormulaEditExcelToolTipShow(fett.ExcelToolTipWindow);
191- break ;
192+
192193 case UIStateUpdate . UpdateType . SelectDataSourceShow :
193194 case UIStateUpdate . UpdateType . SelectDataSourceWindowChange :
194195 case UIStateUpdate . UpdateType . SelectDataSourceHide :
@@ -277,7 +278,8 @@ void FormulaEditMove(Rect editWindowBounds, IntPtr excelToolTipWindow)
277278 Logger . Display . Warn ( "FormulaEditMode Unexpected null Arguments ToolTip!?" ) ;
278279 return ;
279280 }
280- _argumentsToolTip . MoveToolTip ( ( int ) editWindowBounds . Left , ( int ) editWindowBounds . Bottom + 5 , null ) ;
281+ int topOffset = GetTopOffset ( excelToolTipWindow ) ;
282+ _argumentsToolTip . MoveToolTip ( ( int ) editWindowBounds . Left , ( int ) editWindowBounds . Bottom + 5 , topOffset ) ;
281283 }
282284
283285 // Runs on the main thread
@@ -305,17 +307,9 @@ void FormulaEditTextChange(string formulaPrefix, Rect editWindowBounds, IntPtr e
305307 // Win32Helper.HideWindow(excelToolTipWindow);
306308 // }
307309 //}
308-
309- // For now we try to keep out of its way...
310- int moveDown = 0 ;
311- if ( excelToolTipWindow != IntPtr . Zero )
312- {
313- // TODO: Maybe get its height...?
314- moveDown = 18 ;
315- }
316-
310+ int topOffset = GetTopOffset ( excelToolTipWindow ) ;
317311 var infoText = GetFunctionIntelliSense ( functionInfo , currentArgIndex ) ;
318- _argumentsToolTip . ShowToolTip ( infoText , ( int ) editWindowBounds . Left , ( int ) editWindowBounds . Bottom + 5 + moveDown , null ) ;
312+ _argumentsToolTip . ShowToolTip ( infoText , ( int ) editWindowBounds . Left , ( int ) editWindowBounds . Bottom + 5 , topOffset ) ;
319313 }
320314 else
321315 {
@@ -335,15 +329,29 @@ void FormulaEditTextChange(string formulaPrefix, Rect editWindowBounds, IntPtr e
335329 }
336330 }
337331
338- //void FormulaEditExcelToolTipShow(IntPtr excelToolTipWindow)
339- //{
340- // // Excel tool tip has just been shown
341- // // If we're showing the arguments dialog, hide the Excel tool tip
342- // if (_argumentsToolTip != null && _argumentsToolTip.Visible)
343- // {
344- // Win32Helper.HideWindow(excelToolTipWindow);
345- // }
346- //}
332+
333+ // This helper just keeps us out of the Excel tooltip's way.
334+ int GetTopOffset ( IntPtr excelToolTipWindow )
335+ {
336+ // TODO: Maybe get its height...?
337+ return ( excelToolTipWindow == IntPtr . Zero ) ? 0 : 18 ;
338+ }
339+
340+ void FormulaEditExcelToolTipShow ( Rect editWindowBounds , IntPtr excelToolTipWindow )
341+ {
342+ // // Excel tool tip has just been shown
343+ // // If we're showing the arguments dialog, hide the Excel tool tip
344+ // if (_argumentsToolTip != null && _argumentsToolTip.Visible)
345+ // {
346+ // Win32Helper.HideWindow(excelToolTipWindow);
347+ // }
348+
349+ if ( _argumentsToolTip != null && _argumentsToolTip . Visible )
350+ {
351+ int topOffset = GetTopOffset ( excelToolTipWindow ) ;
352+ _argumentsToolTip . MoveToolTip ( ( int ) editWindowBounds . Left , ( int ) editWindowBounds . Bottom + 5 , topOffset ) ;
353+ }
354+ }
347355
348356 // Runs on the main thread
349357 void FunctionListShow ( )
@@ -378,6 +386,7 @@ void FunctionListSelectedItemChange(string selectedItemText, Rect selectedItemBo
378386 text : new FormattedText { GetFunctionDescriptionOrNull ( functionInfo ) } ,
379387 left : ( int ) listBounds . Right + DescriptionLeftMargin ,
380388 top : ( int ) selectedItemBounds . Bottom - 18 ,
389+ topOffset : 0 ,
381390 listLeft : ( int ) selectedItemBounds . Left ) ;
382391 return ;
383392 }
@@ -389,7 +398,11 @@ void FunctionListSelectedItemChange(string selectedItemText, Rect selectedItemBo
389398
390399 void FunctionListMove ( Rect selectedItemBounds , Rect listBounds )
391400 {
392- _descriptionToolTip . MoveToolTip ( ( int ) listBounds . Right + DescriptionLeftMargin , ( int ) selectedItemBounds . Bottom - 18 , ( int ) selectedItemBounds . Left ) ;
401+ _descriptionToolTip . MoveToolTip (
402+ left : ( int ) listBounds . Right + DescriptionLeftMargin ,
403+ top : ( int ) selectedItemBounds . Bottom - 18 ,
404+ topOffset : 0 ,
405+ listLeft : ( int ) selectedItemBounds . Left ) ;
393406 }
394407
395408 // TODO: Performance / efficiency - cache these somehow
0 commit comments