Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » SWT OLE and PowerPoint- Control Order Matters?(SWT OLE and PowerPoint- Why does control order matters?)
SWT OLE and PowerPoint- Control Order Matters? [message #535309] Sat, 22 May 2010 03:25 Go to next message
No real name is currently offline No real nameFriend
Messages: 17
Registered: March 2010
Junior Member
I have an embedded OLE widget in my SWT app. When I add another control (i.e. a button) after it, things show OK. However, when I add the control before the OLE widget, the PowerPoint content is not show. Below is the example code with the 'addBefore' flag. This requires a dummy PowerPoint file stub.pptx in 'user.home'. I have searched a bunch but have not found anything. Any suggestions?

import java.io.File;
import org.eclipse.swt.SWT;
import org.eclipse.swt.SWTError;
import org.eclipse.swt.layout.FillLayout;
import org.eclipse.swt.ole.win32.OLE;
import org.eclipse.swt.ole.win32.OleClientSite;
import org.eclipse.swt.ole.win32.OleFrame;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;

public class Snippet263D {

public static void main(String[] args) {
boolean addBefore = false;
OleClientSite clientSite;
OleFrame oleFrame;
Display display = new Display();
final Shell shell = new Shell(display);
shell.setText("PowerPoint Example");
shell.setLayout(new FillLayout());
Composite panel = new Composite(shell, SWT.BORDER);
FillLayout layout = new FillLayout();
panel.setLayout(layout);
Button bb = null;
if (addBefore)
bb = new Button(panel, SWT.PUSH);
try {
oleFrame = new OleFrame(panel, SWT.NONE);
String home = System.getProperty("user.home");
File fileBeingEdited = new File(home + "/stub.pptx");
clientSite = new OleClientSite(oleFrame, SWT.NONE, fileBeingEdited);
clientSite.doVerb(OLE.OLEIVERB_INPLACEACTIVATE);
} catch (SWTError e) {
e.printStackTrace();
display.dispose();
return;
}
if (! addBefore)
bb = new Button(panel, SWT.PUSH);
bb.setText("Widget 2");
shell.setSize(800, 600);
shell.open();
while (!shell.isDisposed()) {
if (!display.readAndDispatch())
display.sleep();
}
display.dispose();
}
}
Re: SWT OLE and PowerPoint- Control Order Matters? [message #535399 is a reply to message #535309] Sun, 23 May 2010 06:52 Go to previous messageGo to next message
Vijay RajFriend
Messages: 608
Registered: July 2009
Senior Member
The content is showing but since the ole is not the focused one hence ole toolbara nd status dont show......(in case of button true)

click on the ole and see


---------------------
why, mr. Anderson, why, why do you persist?
Because I Choose To.
Regards,
Vijay
Re: SWT OLE and PowerPoint- Control Order Matters? [message #535486 is a reply to message #535399] Mon, 24 May 2010 02:57 Go to previous message
No real name is currently offline No real nameFriend
Messages: 17
Registered: March 2010
Junior Member
Vijay,
Many thanks.
I added a setFocus() and things appear without the need to click in the area.
i.e.
. . .
shell.open();
oleFrame.setFocus();
while (!shell.isDisposed()) {
. . .
Previous Topic:Building Swt 64 bit
Next Topic:SWT equivalent to AWT EventQueue replace?
Goto Forum:
  


Current Time: Fri Apr 19 22:56:52 GMT 2024

Powered by FUDForum. Page generated in 0.03368 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top