[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
RE: [platform-swt-dev] Capturing Drop events over browser widget
|
hi there,
sorry I would to ask about if you use that in C++ or java .. because I want
to use the internet explorer ActiveX control in CDT but I don't know how ..
can you help me plz!!!
<html><DIV></DIV><FONT color=#cc3333></FONT><FONT
color=#ff3333><STRONG>-------------</STRONG><BR></FONT><B><FONT color=red
size=4>AMaN AParT</FONT></B></html>
<BLOCKQUOTE style='PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #A0C6E5
2px solid; MARGIN-RIGHT: 0px'><font
style='FONT-SIZE:11px;FONT-FAMILY:tahoma,sans-serif'><hr color=#A0C6E5
size=1>
From: <i>"Lopez, Edwin R"
<edwin.r.lopez@xxxxxxxxxxx></i><br>Reply-To: <i>"Eclipse
Platform SWT component developers list."
<platform-swt-dev@xxxxxxxxxxx></i><br>To: <i>"swt"
<platform-swt-dev@xxxxxxxxxxx></i><br>Subject: <i>[platform-swt-dev]
Capturing Drop events over browser widget</i><br>Date: <i>Tue, 23 Aug 2005
16:05:03 -0600</i><br>
<br>
<html><head>
<meta http-equiv=Content-Type content="text/html; charset=windows-1252">
<meta name=Generator content="Microsoft SafeHTML">
<style>
</style>
</head>
<body bgcolor="#edf3ed">
<div><font face=Arial size=2>Hello,</font></div>
<div><font face=Arial size=2></font> </div>
<div><font face=Arial size=2>I'm trying to capture the drop (FileTransfer)
event in a browser widget. I tried hooking a <strong>DropTarget</strong>(
) to the <font face="Courier New">*.swt.browser</font> widget with no
success. Then I tried to go the Ole way and create a
<strong>Shell.Explorer</strong> site automation and try to hook the
<strong>DropTarget</strong>( ) to both the </font><font face=Arial
size=2>OleFrame and OleControlSite with no success. (yeah, I'm kind of
hacking
it)</font></div>
<div><font face=Arial size=2></font> </div>
<div><font face=Arial size=2>I have the feeling that I need to enable
something
in the Ole control and use some sort of OleListener.. but I can't find clear
documentation of how get deep down in the API and capture drag/drop
events.</font></div>
<div><font face=Arial size=2></font> </div>
<div><font face=Arial size=2>Have anyone done anything in this
area?</font></div>
<div><font face=Arial size=2></font> </div>
<div><font face=Arial size=2>Any input would be appreciated. Below is a
short
program demostrating what I'm trying to do. <strong>Step D</strong> is the
one I'm having trouble with, getting the Drop listener to
work.</font></div>
<div><font face=Arial size=2></font> </div>
<div><font face=Arial size=2>Thank you,</font></div>
<div><font face=Arial size=2>-Edwin</font></div>
<div><font face=Arial size=2>
<hr>
</font></div>
<div><font face=Arial size=2></font> </div>
<div><font face=Arial size=2></font> </div>
<div dir=ltr><font size=2><font face="Courier New"><font
color="#0000ff">import</font> org.eclipse.swt.*;<br><font
color="#0000ff">import</font></font></font><font size=2><font face="Courier
New">
org.eclipse.swt.ole.win32.*;<br><font
color="#0000ff">import</font></font></font><font size=2><font face="Courier
New">
org.eclipse.swt.internal.ole.win32.*;<br><font
color="#0000ff">import</font></font></font><font size=2><font face="Courier
New">
org.eclipse.swt.widgets.*;<br><font
color="#0000ff">import</font></font></font><font face="Courier New" size=2>
org.eclipse.swt.events.*;<br><font color="#0000ff">import</font>
org.eclipse.swt.dnd.*;</font></div>
<div dir=ltr><br><font size=2><font face="Courier New"><font
color="#0000ff">public</font> <font
color="#0000ff">class</font></font></font><font face="Courier New" size=2>
test <br>{ </font></div>
<blockquote dir=ltr style="margin-right:0px">
<div><font size=2><font face="Courier New"><font
color="#0000ff">public</font>
<font color="#0000ff">static</font> <font
color="#0000ff">void</font></font></font><font face="Courier New" size=2>
main(String[] args) <br>{</font></div>
<blockquote dir=ltr style="margin-right:0px">
<div><font face="Courier New" size=2> </font><font size=2><font
face="Courier New"><font color="#008000">//a. Create Shell<br></font>Display
display = <font color="#0000ff">new</font></font></font><font
size=2><font face="Courier New"> Display();<br>Shell shell = <font
color="#0000ff">new</font></font></font><font face="Courier New" size=2>
Shell( display );<br>shell.setSize( 610, 400 );</font></div>
<div><br><font size=2><font face="Courier New"><font
color="#008000">//b.
Create Browser (the old way)<br></font>OleFrame frame = <font
color="#0000ff">new</font></font></font><font size=2><font face="Courier
New">
OleFrame( shell, SWT.NONE );<br>OleControlSite site = <font
color="#0000ff">new</font> OleControlSite( frame, SWT.NONE, <font
color="#ff0000">"Shell.Explorer"</font></font></font><font
size=2><font face="Courier New"> );<br>site.doVerb(
OLE.OLEIVERB_INPLACEACTIVATE
);<br>OleAutomation browser = <font
color="#0000ff">new</font></font></font><font face="Courier New" size=2>
OleAutomation( site );<br><br><br></font><font size=2><font
face="Courier New"><font color="#008000">//c. Disable "link
navigation" and go
to google<br></font><font color="#0000ff">int</font>[] nameIds =
browser.getIDsOfNames(<font color="#0000ff">new</font> String[] { <font
color="#ff0000">"RegisterAsDropTarget"</font>} );
</font></font><font size=2><font face="Courier New"><font
color="#008000">//is this really
necessary (I wonder)? <br></font>browser.setProperty(nameIds[0], <font
color="#0000ff">new</font> Variant(<font
color="#0000ff">false</font></font></font><font size=2><font face="Courier
New">) ); <font color="#008000">//true or false --doesn't
work</font></font></font></div>
<div><font size=2><font face="Courier New"><font
color="#008000"></font><br>nameIds = browser.getIDsOfNames( <font
color="#0000ff">new</font> String[] { <font
color="#ff0000">"Navigate"</font>,
<font color="#ff0000">"URL"</font></font></font><font
size=2><font face="Courier New">} );<br>browser.invoke( nameIds[0], <font
color="#0000ff">new</font> Variant[] { <font color="#0000ff">new</font>
Variant(<font
color="#ff0000">"http://www.google.com"</font></font></font><font
size=2><font face="Courier New">) },<br><font color="#0000ff">new</font>
<font color="#0000ff">int</font></font></font><font face="Courier New"
size=2>[] {
nameIds[1] } );<br><br><br></font><font size=2><font face="Courier
New"><font color="#008000">//d. Listen to drop events
???<br></font>DropTarget target = <font
color="#0000ff">new</font></font></font><font size=2><font face="Courier
New">
DropTarget(frame, DND.DROP_COPY ); <font color="#008000"><strong>//
<--help
here!!!</strong><br></font>target.setTransfer( <font
color="#0000ff">new</font></font></font><font size=2><font face="Courier
New">
Transfer[] { FileTransfer.getInstance() } );<br>target.addDropListener(
<font color="#0000ff">new</font></font></font><font size=2><font
face="Courier New"> DropTargetListener()<br>{ <br><font color="#0000ff">
public</font> <font color="#0000ff">void</font>
dragEnter(DropTargetEvent event) {
System.out.println(<font color="#ff0000">"drag
enter"</font></font></font><font size=2><font face="Courier New">);
}<br><font color="#0000ff"> public</font>
<font color="#0000ff">void</font> dragLeave(DropTargetEvent event) {
System.out.println(<font color="#ff0000">"drag
leave"</font></font></font><font size=2><font face="Courier
New">);}<br><font color="#0000ff">
public</font> <font color="#0000ff">void</font>
dragOver(DropTargetEvent event) { System.out.println(<font
color="#ff0000">"drag over"</font></font></font><font size=2><font
face="Courier New">);}<br><font color="#0000ff">
public</font> <font color="#0000ff">void</font>
dragOperationChanged(DropTargetEvent event) { System.out.println(<font
color="#ff0000">"drag changed"</font></font></font><font
size=2><font face="Courier New">);}<br><font color="#0000ff">
public</font> <font color="#0000ff">void</font>
dropAccept(DropTargetEvent event) { System.out.println(<font
color="#ff0000">"drag accept"</font></font></font><font
size=2><font face="Courier New">);}<br><font color="#0000ff">
public</font> <font color="#0000ff">void</font></font></font><font
face="Courier New" size=2>
drop(DropTargetEvent event) <br> {
<br>
String[] files = (String[]) event.data; </font><font size=2><font
face="Courier New"><font color="#008000">//expects FileTransfer
data<br></font><font color="#0000ff">
for</font> (<font color="#0000ff">int</font></font></font><font
face="Courier New" size=2>
p=0;p<files.length; p++)<br>
System.out.println( files[p]
);<br> }</font><font face="Courier New" color="#008000"
size=2>/*drop*/<br></font><font face="Courier New"
size=2>});<br><br><br><br></font><font face="Courier New" color="#008000"
size=2>//e. Show window<br></font><font size=2><font face="Courier
New">frame.setBounds( 0,0, 600, 400 );<br>shell.open();
<br><br><font color="#0000ff">while</font></font></font><font
size=2><font face="Courier New"> (!shell.isDisposed()) <br>{ <br><font
color="#0000ff">
if</font></font></font><font size=2><font face="Courier New">
(!display.readAndDispatch())<br>
display.sleep();<br>} <font
color="#008000">/*while*/</font></font></font></div><font color="#008000">
<div><br></font><font face="Courier New"
size=2>browser.dispose();<br>display.dispose();</font></div></blockquote>
<div dir=ltr><font size=2><font face="Courier New">}<font
color="#008000">/*main*/</font></font></font></div>
<div dir=ltr style="margin-right:0px"><font face="Courier New"
size=2></font> </div></blockquote>
<div dir=ltr><font size=2><font face="Courier New">}<font
color="#008000">/*test*/</font></font></font><font face="Courier New"
size=2>
<br></font></div></body></html>
<br><p>_______________________________________________<br>platform-swt-dev
mailing
list<br>platform-swt-dev@xxxxxxxxxxx<br>https://dev.eclipse.org/mailman/listinfo/platform-swt-dev<br><p></font></BLOCKQUOTE>
_________________________________________________________________
Express yourself instantly with MSN Messenger! Download today it's FREE!
http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/