@@ -131,7 +131,9 @@ void StateUpdate(object sender, UIStateUpdate update)
131131 FormulaEditMove ( fem . EditWindowBounds , fem . ExcelTooltipBounds ) ;
132132 break ;
133133 case UIStateUpdate . UpdateType . FormulaEditWindowChange :
134- UpdateFormulaEditWindow ( ( update . NewState as UIState . FormulaEdit ) . FormulaEditWindow ) ;
134+ var fewc = ( UIState . FormulaEdit ) update . NewState ;
135+ UpdateFormulaEditWindow ( fewc . FormulaEditWindow ) ;
136+ FormulaEditTextChange ( fewc . FormulaPrefix , fewc . EditWindowBounds , fewc . ExcelTooltipBounds ) ;
135137 break ;
136138 case UIStateUpdate . UpdateType . FormulaEditTextChange :
137139 var fetc = ( UIState . FormulaEdit ) update . NewState ;
@@ -176,7 +178,13 @@ void UpdateFormulaEditWindow(IntPtr formulaEditWindow)
176178 _formulaEditWindow = formulaEditWindow ;
177179 if ( _argumentsToolTip != null )
178180 {
179- _argumentsToolTip . OwnerHandle = _formulaEditWindow ;
181+ _argumentsToolTip . Dispose ( ) ;
182+ _argumentsToolTip = null ;
183+ }
184+ if ( _formulaEditWindow != IntPtr . Zero )
185+ {
186+ _argumentsToolTip = new ToolTipForm ( _formulaEditWindow ) ;
187+ //_argumentsToolTip.OwnerHandle = _formulaEditWindow;
180188 }
181189 }
182190 }
@@ -188,26 +196,33 @@ void UpdateFunctionListWindow(IntPtr functionListWindow)
188196 _functionListWindow = functionListWindow ;
189197 if ( _descriptionToolTip != null )
190198 {
191- _descriptionToolTip . OwnerHandle = _functionListWindow ;
199+ _descriptionToolTip . Dispose ( ) ;
200+ _descriptionToolTip = null ;
192201 }
202+ if ( _functionListWindow != IntPtr . Zero )
203+ {
204+ _descriptionToolTip = new ToolTipForm ( _functionListWindow ) ;
205+ //_descriptionToolTip.OwnerHandle = _functionListWindow;
206+ }
207+
193208 }
194209 }
195210
196211 // Runs on the main thread
197212 void FormulaEditStart ( )
198213 {
199214 Debug . Print ( $ "IntelliSenseDisplay - FormulaEditStart") ;
200- if ( _argumentsToolTip == null )
215+ if ( _formulaEditWindow != IntPtr . Zero && _argumentsToolTip == null )
201216 _argumentsToolTip = new ToolTipForm ( _formulaEditWindow ) ;
202217 }
203218
204219 // Runs on the main thread
205220 void FormulaEditEnd ( )
206221 {
207222 Debug . Print ( $ "IntelliSenseDisplay - FormulaEditEnd") ;
208- _argumentsToolTip . Hide ( ) ;
209- // _argumentsToolTip.Dispose();
210- // _argumentsToolTip = null;
223+ // _argumentsToolTip.Hide();
224+ _argumentsToolTip . Dispose ( ) ;
225+ _argumentsToolTip = null ;
211226 }
212227
213228 // Runs on the main thread
@@ -238,9 +253,12 @@ void FormulaEditTextChange(string formulaPrefix, Rect editWindowBounds, Rect exc
238253 }
239254
240255 // All other paths, we just clear the box
241- _argumentsToolTip . Hide ( ) ;
242- //_argumentsToolTip.Dispose();
243- //_argumentsToolTip = null;
256+ if ( _argumentsToolTip != null )
257+ {
258+ //_argumentsToolTip.Hide();
259+ _argumentsToolTip . Dispose ( ) ;
260+ _argumentsToolTip = null ;
261+ }
244262 }
245263
246264
0 commit comments