09-23-2011 08:28 AM
A feature that users of app have been requesting a lot is the ability to highlight text (it's a bible reader app, and text is shown as labels within a scroller). I've enabled selectable so that they can select and copy text to paste elsewhere. I'm at a loss as to how to add the highlighting feature. Are we able to capture what a user has selected? Any possibility to add an extra button to the copy/paste menu? Some suggestions on implementing this would be really appreciated.
09-23-2011 02:49 PM
I don't see any clean way of doing this, but there are certainly messy ways of achieving the effect.
Use selectionBeginIndex and selectionEndIndex as the starting point.
From there you have to decide how you want to implement the highlighting. Maybe add a mouseUp listener and then display an alert asking if they want to highlight the selection (play around with positioning, so it's not obscured by the copy/paste menu). Then maybe create new Sprits behind the text which will just draw a rectangle of the highlight color (use the selectionBeginIndex for positioning - e.g. getChartBoundaries(selectionBeginIndex).x)
I hope this gives you a starting point. You'll have to figure out how to bes implement it for your needs,
09-25-2011 08:51 AM