2

When developing a WebOS application with Enyo, is it possible to access the clipboard contents? That is, if I copy a bit of text to the clipboard on a Touchpad or Pre device , can I programmatically grab that piece of text, or programmatically replace it?

From what I've read in the SDK documents, I assume I'd need a Service to do this. Is this correct?

If so, which service? Are there a list of services available, and/or is there a way to reflect into the framework to see which services are available?

(New to WebOS development, so error on the side of speaking loudly and slowly)

Alana Storm
  • 164,128
  • 91
  • 395
  • 599

1 Answers1

2

I think you are looking for the getClipboard method on the enyo.dom. However, when I try:

enyo.dom.getClipboard(enyo.bind(this, "gotClipboard"));


gotClipboard: function() {
    this.log(JSON.stringify(arguments));
}

I just get {"0",""}, even though I have text in the clipboard. It makes me wonder if this isn't fully baked yet. One argument will be the text in the clipboard when it works.

If I try the companion enyo.dom.setClipboard, I get a NOT_FOUND_ERR: DOM Exception 8.

Found both of these functions in here: https://developer.palm.com/content/api/reference/enyo/enyo-api-reference.html

Joe
  • 2,407
  • 18
  • 20
  • I found that last night and poked around at the source of getClipboard and setClipboard. Both look like they're reading and writing from a textarea that's been inserted into the dom. Lot sof promise in enyo, but it's still pretty doughy. – Alana Storm Jul 06 '11 at 21:23
  • Yeah, I'm not impressed with that either. Haven't found any other methods out there though. – Joe Jul 07 '11 at 15:38