Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 51244 Details for
Bug 159441
[OLE] OleControlSite does not embed MapPoint Control properly
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read
this important communication.
sample application
MapPointFocusBug.java (text/plain), 5.49 KB, created by
Yuri Magrisso
on 2006-10-02 07:06:38 EDT
(
hide
)
Description:
sample application
Filename:
MIME Type:
Creator:
Yuri Magrisso
Created:
2006-10-02 07:06:38 EDT
Size:
5.49 KB
patch
obsolete
>import org.eclipse.swt.SWT; >import org.eclipse.swt.events.MouseAdapter; >import org.eclipse.swt.events.MouseEvent; >import org.eclipse.swt.events.ShellAdapter; >import org.eclipse.swt.events.ShellEvent; >import org.eclipse.swt.graphics.Point; >import org.eclipse.swt.layout.FillLayout; >import org.eclipse.swt.ole.win32.OLE; >import org.eclipse.swt.ole.win32.OleAutomation; >import org.eclipse.swt.ole.win32.OleControlSite; >import org.eclipse.swt.ole.win32.OleEvent; >import org.eclipse.swt.ole.win32.OleFrame; >import org.eclipse.swt.ole.win32.OleListener; >import org.eclipse.swt.ole.win32.Variant; >import org.eclipse.swt.widgets.Display; >import org.eclipse.swt.widgets.Shell; >import org.eclipse.swt.widgets.TabFolder; >import org.eclipse.swt.widgets.TabItem; > > >public class MapPointFocusBug >{ > > Shell shell; > Display display; > TabFolder tabFolder; > TabItem tiMapPoint; > TabItem tiBrowser; > > public final static int MAP_POINT_NEW_MAP = 11; > public final static int MAP_POINT_CLOSE_MAP = 15; > public final static int MAP_POINT_MAP = 1; > public final static int GEO_REGION_NORTH_AMERICA = 1; > public final static int GEO_REGION_EUROPE = 2; > public final static int MAP_GOTO_LATLONG = 100794887; > public final static int MAP_SAVED = 100663809; > OleFrame ofMapPoint; > OleControlSite ocMapPoint; > OleAutomation oaMapPoint; > OleAutomation oaMap; > > public final static int BROWSER_NAVIGATE2 = 500; > > OleFrame ofBrowser; > OleControlSite ocBrowser; > OleAutomation oaBrowser; > > /** > * @param args > */ > public static void main(String[] args) > { > MapPointFocusBug mp = new MapPointFocusBug(); > mp.initialize(); > mp.run(); > } > > public void initialize() { > createShell(); > shell.open(); > } > > public void createShell() { > display = new Display(); > shell = new Shell(display); > shell.setText("Shell"); > shell.setSize(new Point(800, 600)); > shell.setLayout(new FillLayout()); > shell.addShellListener(new ShellAdapter() { > public void shellClosed(ShellEvent e) > { > saveAndCloseMap(); > super.shellClosed(e); > } > }); > > tabFolder = new TabFolder(shell, SWT.NONE); > > createMapPointControl(); > tiMapPoint = new TabItem(tabFolder, SWT.NONE); > tiMapPoint.setText("MapPoint"); > tiMapPoint.setControl(ofMapPoint); > > createBrowserControl(); > tiBrowser = new TabItem(tabFolder, SWT.NONE); > tiBrowser.setText("Browser"); > tiBrowser.setControl(ofBrowser); > } > > public void createMapPointControl() { > ofMapPoint = new OleFrame(tabFolder, SWT.NONE); > ocMapPoint = > new OleControlSite(ofMapPoint, SWT.CENTER, "MapPoint.Control"); > ocMapPoint.doVerb(OLE.OLEIVERB_SHOW); > oaMapPoint = new OleAutomation(ocMapPoint); > > // use GEO_REGION_EUROPE if you have MapPoint Europe > Variant mapRegion = new Variant((short)GEO_REGION_NORTH_AMERICA); > oaMapPoint.invoke(MAP_POINT_NEW_MAP, new Variant[] {mapRegion}); > > // SWT Event > ocMapPoint.addMouseListener(new MouseAdapter() { > @Override > public void mouseDown(MouseEvent e) > { > System.out.println("MapPoint MouseDown SWT Event - x: "+e.x+", y: "+e.y); > } > }); > > // MapPoint MouseDown Event > ocMapPoint.addEventListener(210, new OleListener() { > public void handleEvent(OleEvent event) > { > Variant button = event.arguments[0]; > Variant shift = event.arguments[1]; > Variant x = event.arguments[2]; > Variant y = event.arguments[3]; > > System.out.println("MapPoint MouseDown OleEvent - Button: "+button+", Shift: "+shift+", X: "+x+", Y:"+y); > } > }); > > // MapPoint AfterRedraw Event > ocMapPoint.addEventListener(202, new OleListener() { > public void handleEvent(OleEvent event) > { > System.out.println("MapPoint OleEvent - After Redraw"); > } > }); > > Variant vMap = oaMapPoint.getProperty(1); > oaMap = vMap.getAutomation(); > > Variant vLat = new Variant((double)30.42824941189154); > Variant vLon = new Variant((double)-97.67066717147827); > Variant vAlt = new Variant((double)0); > oaMap.invoke(MAP_GOTO_LATLONG, new Variant[] {vLat,vLon,vAlt}); > } > > public void createBrowserControl() { > ofBrowser = new OleFrame(tabFolder, SWT.NONE); > ocBrowser = new OleControlSite(ofBrowser, SWT.CENTER, "Shell.Explorer"); > ocBrowser.doVerb(OLE.OLEIVERB_SHOW); > > ocBrowser.addMouseListener(new MouseAdapter() { > @Override > public void mouseDown(MouseEvent e) > { > System.out.println("Browser MouseDown SWT Event - x: "+e.x+", y: "+e.y); > } > }); > > // Browser BeforeNavigate2 Event > ocBrowser.addEventListener(250, new OleListener() { > public void handleEvent(OleEvent event) > { > //Variant iDispatch = event.arguments[0]; > Variant url = event.arguments[1]; > > System.out.println("URL: "+url.getString()); > } > }); > > oaBrowser = new OleAutomation(ocBrowser); > > Variant vGoogleUrl = > new Variant("http://local.google.com/local?f=q&hl=en&ie=UTF8&z=4&ll=30.43861,-97.670517"); > oaBrowser.invoke(BROWSER_NAVIGATE2, new Variant[] {vGoogleUrl}); > } > > public void run() { > while ( !shell.isDisposed() ) { > if (!display.readAndDispatch()) > display.sleep(); > } > display.dispose(); > } > > protected void saveAndCloseMap() { > Variant vSaved = new Variant(true); > oaMap.setProperty(MAP_SAVED, vSaved); > oaMapPoint.invoke(MAP_POINT_CLOSE_MAP); > } >}
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 159441
: 51244