Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    Programmatically determining scroll location of substring within a label.

    Hi, I'm using Smart GWT 3.1, and I'm trying to implement functionality involving a search feature as follows:

    - I have a Window with a fixed size on the Canvas containing:
    - A vanilla Label whose contents are the contents of a log file sent from the server side. This could be up to a couple hundred K of data. As expected, a scroll bar appears within the label when the contents overflow the fixed size of the Window
    - A DynamicForm allowing the user to enter a substring with which to search the contents of the Label for.

    What I'm trying to do is add some 'magic' within the onItemChanged() handler of the DynamicForm:

    dynamicForm.addItemChangedHandler(new ItemChangedHandler() {
    public void onItemChanged(ItemChangedEvent event) {
    // magic here
    }
    });

    such that it scrolls to the last occurrence in the Label's contents of the substring entered into the DynamicForm, making that visible to the user.

    The label's scrolling functions (scrollToBottom(), scrollToPercentage(), etc) work fine, but I can't find any way to determine *what* scroll location to scroll to.

    In other words, is there any way to determine the scroll location or scroll percentage of a particular substring within the content of a Label?
Working...
X