Skip to main content
Inspiring
May 13, 2009 4:39 PM UTC
Answered

No more ElementRange in SelectionEvent?

Just keeping on top of the nightly builds to make sure I don't slip too far behind, and I've made the relevant changes where EditManager is concerned

noFocusSelectionFormat -> unfocusedSelectionFormat

focusSelectionFormat -> focusedSelectionFormat

selectAll() -> setSelection(0, editManager.absoluteEnd?) (not sure on this one)

But the one that stopped me was that SelectionEvent no longer contained a reference to an ElementRange which I was using heavily to traverse the TLF "DOM", from firstParagraph to lastParagraph.

I've reverted to a previous Gumbo nightly so no problems at all, but I wondered if there was any info on upcoming changes with regards to this last point (getting an ElementRange from a selection)?

This topic is closed to new replies. Start a new post to keep the conversation going.
rdermerCorrect answer
Inspiring
May 13, 2009 5:01 PM UTC

Use the selectionState property of SelectionEvent and call ElementRange.createElementRange.

Hope that helps

Richard

6 replies

Known Participant
Oct 23, 2009 8:57 AM UTC

Hi,

And how can you have the SelectionState with the "old version" of SelectionEvent? (it have only an ElementRange)

It's my actual problem...

Thank you

Translate
Inspiring
Oct 23, 2009 11:16 PM UTC

You can construct an ElementRange using static function ElementRange.createElementRange.  SelectionState has sufficient information for that.  See the releasenotes for an explanation of the change to SelectionEvent.

Hope that helps,

Richard

Translate
Inspiring
May 13, 2009 5:46 PM UTC

That got it, I should have seen that. Thanks Richard and Nikos.

Translate
rdermerCorrect answer
Inspiring
May 13, 2009 5:01 PM UTC

Use the selectionState property of SelectionEvent and call ElementRange.createElementRange.

Hope that helps

Richard

Translate
Inspiring
May 13, 2009 5:07 PM UTC

var selectionState:SelectionState = e.selectionState;

var selectedElementRange:ElementRange = ElementRange.createElementRange(selectionState.textFlow, selectionState.absoluteStart, selectionState.absoluteEnd);

Translate
Inspiring
May 13, 2009 5:10 PM UTC

Yes - that's it.

Sorry for the API churn - there's an API review process that we are following.  Its slowly grinding to a halt though.

Richard

Translate