Changing Screen Cursor to Wait

2015-07-10 Thread Berkhan Dipso
Hi;

 

I'm trying to develop a Calc Extension in Java, and I'm new at it. I'm not
fully sure that I got the relations between: Desktop, Toolbar, Frame,
Component, Control, WindowPeer etc.

 

So; What I need is to change screen cursor to WAIT when a tool button is
pressed. I'm using the code below:

 

public static XWindowPeer getWindowPeer(XFrame _xFrame) {

XWindow xWindow = _xFrame.getContainerWindow();

XWindowPeer xWindowPeer = (XWindowPeer)
UnoRuntime.queryInterface(XWindowPeer.class, xWindow);

return xWindowPeer;

}

 

public static void changeCursor(XComponentContext m_xContext,
com.sun.star.frame.XFrame m_xFrame, int cursorPointer) {

XWindowPeer peer = getWindowPeer(m_xFrame);

try {

Object oPointer =
m_xContext.getServiceManager().createInstanceWithContext(com.sun.star.awt.P
ointer, m_xContext);

XPointer xPointer = (XPointer)
UnoRuntime.queryInterface(XPointer.class, oPointer);

xPointer.setType(cursorPointer);

 

if (peer != null) {

peer.setPointer(xPointer);

}

 

} catch (com.sun.star.uno.Exception ex) {

throw new java.lang.RuntimeException(cannot happen... +
ex.getMessage());

}

}

 

USAGE WITHIN THE CODE:

SheetOperations.changeCursor(m_xContext, m_xFrame,
com.sun.star.awt.SystemPointer.WAIT);

 

The problem is that; it is not working stable. So I'm not sure if this is
the right way to change the screen cursor. 

And also I'm not writing any code to change the cursor back to normal, but
somehow it changes back to normal after leaving my code.

 

Regards

 

Berkhan Dipşo

Solutions Architect

Tel  : +90 (216) 469 96 00 (14)

GSM  : +90 (533) 03 03 550

 

PRM YAZILIM

Oracle Gold Partner

Primavera Specialized

 http://www.prmyazilim.com/ www.prmyazilim.com

 

 http://www.linkedin/company/prm-yazilim
http://www.linkedin/company/prm-yazilim

 http://www.twitter.com/prmyazilim http://www.twitter.com/prmyazilim

 

6-10 Temmuz - İSTANBUL

Primavera eğitimlerine ön kayıt icin:

 http://apps.primavera-tr.com/drupal/node/15
http://apps.primavera-tr.com/drupal/node/15

 



Re: Changing Screen Cursor to Wait

2015-07-10 Thread Oliver Brinzing

Hi Berkhan,

not sure, but maybe this old thread can help:

http://osdir.com/ml/openoffice.devel.api/2008-05/msg00165.html

Regards
Oliver



-
To unsubscribe, e-mail: api-unsubscr...@openoffice.apache.org
For additional commands, e-mail: api-h...@openoffice.apache.org