inplace editor doesn't lose focus when it should

Hello,

I am using an ADVStringGrid on a form with a combobox in one of the columns. Once the combo drop down is displayed it doesn't go away until the mouse is clicked, but I want it to close up when the mouse leaves. As you can see in the screenshot below, the mouse is hovering over another control and the hint isn't showing because the combobox still has focus.

I've added code to the grids "mouseleave' event, and it gets triggered when I click on a cell, which implies that the grid has lost focus and the editor has focus, but there is no 'autocloseup' property or 'mouseleave' event for the editor.


  object sgFlights: TAdvStringGrid
    Cursor = crDefault
    Hint = 'Flights on the left, aircraft on the right'
    ColCount = 2
    DrawingStyle = gdsClassic
    Options = [goFixedVertLine, goFixedHorzLine, goVertLine, goHorzLine, goRangeSelect, goEditing]
     OnExit = sgFlightsExit
    OnMouseLeave = sgFlightsMouseLeave
    HoverRowCells = [hcNormal, hcSelected]
    OnGetEditorType = sgFlightsGetEditorType
    OnGetEditorProp = sgFlightsGetEditorProp
    Filter = <>
    Look = glStandard
    Lookup = True
    LookupHistory = True
    MouseActions.DirectComboClose = True
    MouseActions.DirectComboDrop = True
    MouseActions.DirectEdit = True
    Navigation.AdvanceOnEnter = True
    Navigation.AdvanceOnEnterLoop = False
    Navigation.AdvanceDirection = adTopBottom
    Navigation.AllowCtrlEnter = False
    Navigation.AdvanceAuto = True
    Navigation.CursorWalkEditor = True
    Version = '7.0.4.0'
  end


cheers,

Marc Pelletier

Do you call grid.HideInplaceEdit from the OnMouseLeave event?

Sorry, I'm having trouble with the editor in Firefox. My image didn't show up and now I can't edit my post or include an image with my reply..... not impressed with the forum software. 


Hello Bruno,

If I add this:
void __fastcall TfmFlightMatcher::sgFlightsMouseLeave(TObject *Sender)
{
    sgFlights->HideInplaceEdit();
}
then the combobox immediately closes when I click on it. I suspect I need to add this event to the combobox, not the grid, but I can't figure out where to do that.

I tried
void __fastcall TfmFlightMatcher::FormActivate(TObject *Sender) {
   sgFlights->Combobox->OnMouseLeave = CollapseCombo;
}
void __fastcall TfmFlightMatcher::CollapseCombo(TObject *Sender) {
   sgFlights->HideInplaceEdit();
}

but that never gets called.

cheers,

Marc