[prev in list] [next in list] [prev in thread] [next in thread] 

List:       koffice
Subject:    Re: selected cells in kspread from kross
From:       Sebastian Sauer <mail () dipe ! org>
Date:       2008-02-24 23:27:34
Message-ID: 200802250027.34965.mail () dipe ! org
[Download RAW message or body]

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
koffice@kde.org
To unsubscribe please visit:
https://mail.kde.org/mailman/listinfo/koffice
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic