Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion

Selection already changed in AfterInPlaceEditOperation with TElTreeInplaceComboBox

Hi,

we are using a TElXTree with EplorerEditMode set to true. After exiting a TElTreeInplaceComboBox via click on another row, the TElXTree's .Selected.Index will already have the new index value when arriving at the editor's .AfterInPlaceEditOperation event.
With the others (at least TElTreeInplaceEdit, TElTreeInplaceCheckBox), the Selected.Index will still have the old value.

The difference also becomes obvious with TElxTree.OnItemFocused:
  • with e. g. TElTreeInplaceEdit it's AfterInPlaceEditOperation -> OnItemFocused
  • with TElTreeInplaceComboBox it's OnItemFocused -> AfterInPlaceEditOperation
I'd expect the sequence to always be the first one, especially if "The AfterOperation methods are bound to OnExit events of the editors by default" from
still holds.

We have tested with Delphi 11.3 + LMD 2022.10 and 13.1 + 2025.4 (the older one also has the "no parent window bug" with the CheckBox, which seems to be irrelevant in this regard, though)

Can this be addressed or am I missing something/should not rely on the sequence?

Thanks for checking and all the best,
Stefan (Konzeptum)

Comments

  • 5 Comments sorted by Votes Date Added
  • Hi,

    Thank you for the report. Need some time to look.
  • Some code in the combo box related inplace-editors are executed synchronously. Via sending message to itself (PostMessage) way. Most probably this is made intentionally, but currently I cannot find out why exactly. So, I've added new SyncCompleteOperation global variable, which can be set to True to call the corresponding internal code synchronously (like in other inplace-editors).  You are welcome to test it. 

    We plan to publish next minor release soon, and this workaround will be included in it.
  • Hi,

    thank you for the workaround and the new version.
    While it solves the original issue for us, further tests have shown that it sems to introduce a new "no parent window" case:

    The majority of subsequent edits of the same cell with a combo will now give me an EInvalidOperation
    Element 'THackInplaceComboBox($04E7FD60)' hat kein übergeordnetes Fenster. Pfad:
    TElTreeInplaceComboBox($037ECDE0)
      .THackInplaceComboBox($04E7FD60)

    Steps (may have to repeat 2 - 3 times):
    1. Activate the combo in a cell by two clicks
    2. Click another cell (same or different row)
    3. Activate the combo in the cell from 1. again by two clicks
    The Exception occurs in InplaceEditorNeeded when setting the ItemIndex of the TElTreeInplaceComboBox that we assign to Editor. We're using a mapped value list, DefaultConversion is set to false. The same combo instance is re-used for all edits that require identical choices. 

    With ElTree.SyncCompleteOperation set to false, I don't get the Exception.

    Tested in Delphi 13.1 (incl May-Patch).

    All the best,
    Stefan (Konzeptum)
  • Most probably this was the reason for async code execution. Anyway, I cannot reproduce the issue now. Can you create a small test project and attach here (or send it to our support e-mail)?
  • edited May 13 Posts: 14Vote Up0Vote Down
    Hi,

    I didn't recall that the double clicking was provided for by our own event handler, so the steps above weren't as obvious as intended, sorry.
    I've attached a small project, where they are applicable as follows:
    1. Double click cell in third colum to activate combo
    2. Single click another cell (same or different row)
    3. Double click cell from step 1 again to go back into same combo
    An additional finding from today: if you hit the Esc key between steps 1 and 2 the exception won't occur.

    Thanks and all the best,
    Stefan (Konzeptum)

    (edit/P. S. the inplace editor instances aren't Free()-ed in the test project, that part is only missing there, not on purpose)
    zip
    zip
    LmdElXTreeInplaceProbs.zip
    75K
Sign In or Register to comment.