Re: selected cells in kspread from kross

Sebastian Sauer <[email protected]>
Newsgroups gmane.comp.kde.koffice
Message-ID <[email protected]>
Marek Schmidt wrote:

> Hi,

and hi Marek :)
 
> is there a way to get a list of currently selected cells in a sheet or
> to get info whether a cell is selected or not?
> 
> I am using kspread 1.6.3 now, but if the feature is available in 2.0 I
> would be glad to know about that too :-)

yes, there are multiple ways in 2.0. You may like to register a listener to be 
able to do something in a script if the selection changed. A good example for 
this is the 
http://websvn.kde.org/trunk/koffice/kspread/plugins/scripting/scripts/myorca.py?view=markup 
script that does something like;

import KSpread
view = KSpread.view()
def selectionChanged():
	print "Selection changed"
view.connect("selectionChanged()", selectionChanged)

The 
http://websvn.kde.org/trunk/koffice/kspread/interfaces/ViewAdaptor.h?view=markup 
class does provide here bunches of functionality to deal with all kind of 
selections. So, what you may like to use is something like;

import KSpread
view = KSpread.view()
(x1,y1,x2,y2) = view.selection()
view.setSelection([x1-1,y-1,x2+1,x2+1])
____________________________________
koffice mailing list
[email protected]
To unsubscribe please visit:
https://mail.kde.org/mailman/listinfo/koffice
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.