Hi ruds,
Here's a suggestion that could work. I haven't tried it out myself, but it
could be worth a try.

The first thing you would need to do is prevent the loss of focus from the
selected text in your RichTextArea when the user clicks on a cell in the
colour palette. You might be able to prevent the loss of focus by calling
the DOM.eventPreventDefault() method whenever the click event on the colour
palette cell occurs.

The other part of the problem is somehow retrieving the selected text so
that you can apply the select colour to it. This could be done by retrieving
the selected text at the moment of the click on the colour palette cell. You
should be able to accomplish this by writing a quick JSNI method that
returns the currently selected text. As a precondition to actually changing
the selected text colour, you might also want to verify that the selected
text is indeed contained in the RichTextArea.

Give it a try and let us know how it goes.

Hope that helps,
-Sumit Chandel

On Tue, Oct 14, 2008 at 7:51 AM, ruds <[EMAIL PROTECTED]> wrote:

>
> Hello there,
> i have the following situation:
> a RichtextArea with a toolbar to style the text.
> within the toolbar there is a button for a color palette which is a
> popup with a grid in it.
>
>  i have done an Event listener for the toolbar items so to keep the
> RichtextArea focused all the time when playing with the toolbar menu.
> Except for the color palette which is making a problem when clicking
> on the cell to select the color.
>
> although the table listener is implemented in the Event Listener which
> is an inner class as advised by the example done in kitchen sink
> /**
>   * We use an inner Event Listener class to avoid exposing event
> methods on the
>   * RichTextToolbar itself.
>   */
> Now when selecting the color everything is working fine except when i
> have a text selected and i need to change the color of it. i have
> realized that when clicking on the cell i am losing the focus of the
> RichTextArea and thus losing my selection of the text.
> how can i prevent losing the focus on the selected text?
> any suggestions/advice?
>
> regards,
> ruds
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/Google-Web-Toolkit?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to