@@ -93,6 +93,12 @@ void StateUpdatePreview(object sender, UIStateUpdate update)
9393 var fl = ( UIState . FunctionList ) update . NewState ;
9494 enable = ShouldProcessFunctionListSelectedItemChange ( fl . SelectedItemText ) ;
9595 }
96+ else if ( update . Update == UIStateUpdate . UpdateType . FormulaEditExcelToolTipChange )
97+ {
98+ // If if has just been hidden, we need no extra processing and can skip the Main thread call
99+ var fe = ( UIState . FormulaEdit ) update . NewState ;
100+ enable = fe . ExcelToolTipWindow != IntPtr . Zero ;
101+ }
96102 else
97103 {
98104 enable = true ; // allow the update event to be raised by default
@@ -180,8 +186,8 @@ void StateUpdate(object sender, UIStateUpdate update)
180186 FormulaEditEnd ( ) ;
181187 break ;
182188 case UIStateUpdate . UpdateType . FormulaEditExcelToolTipChange :
183- // No action (for now)
184- // The ExcelToolTipWindow is hidden when we display our Arguments ToolTip
189+ //var fett = (UIState.FormulaEdit)update.NewState;
190+ //FormulaEditExcelToolTipShow(fett. ExcelToolTipWindow);
185191 break ;
186192 case UIStateUpdate . UpdateType . SelectDataSourceShow :
187193 case UIStateUpdate . UpdateType . SelectDataSourceWindowChange :
@@ -288,28 +294,28 @@ void FormulaEditTextChange(string formulaPrefix, Rect editWindowBounds, IntPtr e
288294 // We have a function name and we want to show info
289295 if ( _argumentsToolTip != null )
290296 {
291- if ( ! _argumentsToolTip . Visible )
297+ // NOTE: Hiding just once doesn't help - the tooltip pops up again
298+ // TODO: Try to move it off-screen, behind or make invisible
299+ //if (!_argumentsToolTip.Visible)
300+ //{
301+ // // Fiddle a bit with the ExcelToolTip if it is already visible when we first show our FunctionEdit ToolTip
302+ // // At other times, the explicit UI update should catch and hide as appropriate
303+ // if (excelToolTipWindow != IntPtr.Zero)
304+ // {
305+ // Win32Helper.HideWindow(excelToolTipWindow);
306+ // }
307+ //}
308+
309+ // For now we try to keep out of its way...
310+ int moveDown = 0 ;
311+ if ( excelToolTipWindow != IntPtr . Zero )
292312 {
293- #if DEBUG
294- // Fiddle a bit with the ExcelToolTip if it is already visible when we first show our FunctionEdit ToolTip
295- if ( excelToolTipWindow != IntPtr . Zero )
296- {
297- try
298- {
299- Win32Helper . HideWindow ( excelToolTipWindow ) ;
300- //var currentBounds = Win32Helper.GetWindowBounds(excelToolTipWindow);
301- //Win32Helper.MoveWindow(excelToolTipWindow, (int)currentBounds.X, (int)currentBounds.Y + 100, (int)currentBounds.Width, (int)currentBounds.Height, true);
302- }
303- catch ( Exception ex )
304- {
305- Debug . Print ( "!!!!!!!!!!!!XXXXXXXXXXXXXXXXXXXXX!!!!!!!!!!!!!!!!!!!!!!!! " + ex . ToString ( ) ) ;
306- }
307-
308- }
309- #endif
313+ // TODO: Maybe get its height...?
314+ moveDown = 18 ;
310315 }
311- var infoText = GetFunctionIntelliSense ( functionInfo , currentArgIndex ) ;
312- _argumentsToolTip . ShowToolTip ( infoText , ( int ) editWindowBounds . Left , ( int ) editWindowBounds . Bottom + 5 ) ;
316+
317+ var infoText = GetFunctionIntelliSense ( functionInfo , currentArgIndex ) ;
318+ _argumentsToolTip . ShowToolTip ( infoText , ( int ) editWindowBounds . Left , ( int ) editWindowBounds . Bottom + 5 + moveDown ) ;
313319 }
314320 else
315321 {
@@ -329,6 +335,15 @@ void FormulaEditTextChange(string formulaPrefix, Rect editWindowBounds, IntPtr e
329335 }
330336 }
331337
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+ //}
332347
333348 // Runs on the main thread
334349 void FunctionListShow ( )
0 commit comments