Go Back   SmartClient Forums > Smart GWT Technical Q&A
Wiki Register Search Today's Posts Mark Forums Read

Reply
 
Thread Tools Search this Thread
  #1  
Old 2nd Mar 2010, 04:27
edicius.cy edicius.cy is offline
Registered Developer
 
Join Date: Mar 2010
Posts: 3
Default Appending HTML to HTMLPane

Hello there, I'm currently stuck with trying to append HTML to the HTMLPane object. I know of the two methods:

getContents and setContents however the issue I have is that if I were to do:

Code:
setContents(getContents() + "hello")
The content would not really be appended, it would re set the data in the HTMLPane which is not what I want due to:

'The application I am developing is a simple log file that is retrieving remote data and appending it to a front end. The user can then just scroll through the text already there and then select parts they need.'

Right now if I were to use what I posted above, the selection made by the user would be removed every time the setContents was called. I am looking for something similar to VerticalPanel where I can just add the html however I've tried this already and after appending the VerticalPanel object to a Window object I am unable to select the text even with the method 'setCanSelectText(true)'.

Any help would be greatly appreciated,

Many thanks

Ed
Reply With Quote
  #2  
Old 2nd Mar 2010, 06:40
Isomorphic Isomorphic is offline
Administrator
 
Join Date: May 2006
Posts: 38,342
Default

You need to be setting canSelectText in the right place, not on the Window as a whole (which would include the header and icons), but just on the element where selection is allowed.

So two options:

1. when you add a plain GWT widget to a SmartGWT container it's auto-wrapped with a WidgetCanvas. You can wrap it yourself and setCanSelectText() on the WidgetCanvas.

http://www.smartclient.com/smartgwtee/javadoc/com/smartgwt/client/widgets/WidgetCanvas.html

2. subclass Canvas and override getInnerHTML() to return a DIV or other element with a known ID, and then use GWT's low-level DOM manipulation APIs to manipulate it's content.
Reply With Quote
  #3  
Old 2nd Mar 2010, 08:44
edicius.cy edicius.cy is offline
Registered Developer
 
Join Date: Mar 2010
Posts: 3
Default Thanks!

Thankyou for the quick reply, I'll work on this when I am back home.
Reply With Quote
  #4  
Old 11th Mar 2010, 10:16
edicius.cy edicius.cy is offline
Registered Developer
 
Join Date: Mar 2010
Posts: 3
Default Having trouble

Hello there, I thought I'd leave it a while before posting again so I'd have enough time to try out and implement the second option.

Unfortunately I'm not really understanding too well how to actually get the ID of the inner DIV of the HTMLPane/Flow. I know the DOM methods available in GWT and I have enough knowledge in java to understand subclassing.

Any further advice would greatly be appreciated!

Best regards,

Ed
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search


© 2010,2011 Isomorphic Software. All Rights Reserved