简体   繁体   中英

SWT Browser — get selected text

I am using a Browser view in my application and i need to get the text selected by user. I tried creating mouse event but nothing is working. I am using following link to create the browser:

http://180.179.103.253/q3/twapp/process.php?mdl=onetimeurl&id=1061&deviceid=9d2aefc2-a386-4afc-b307-44f41ec8311d&test=1

I also checked in documentation, there is no method like getSelectionText() in SWT browser.

you could achieve this by executing java script function in the browser from your View.Write a java script to get the selection the text and execute it in the browser. Look at the Browser API:

browser.execute(script);
browser.evaluate(script);

Look at BrowserFunction interface for java-javascript call back mechanism

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM