Skip to main content



      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] Fri, 21 May 2010 23:25 Go to next message
Eclipse UserFriend
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 02:52 Go to previous messageGo to next message
Eclipse UserFriend
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
Re: SWT OLE and PowerPoint- Control Order Matters? [message #535486 is a reply to message #535399] Sun, 23 May 2010 22:57 Go to previous message
Eclipse UserFriend
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: Tue Jul 01 12:57:49 EDT 2025

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

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

Back to the top