Hi Christoph,
Alle 16:26, sabato 17 marzo 2007, Christoph Jopp ha scritto:
> Hi Paolo,
>
> I played a bit around with your code and found following:
>
> You can hand an array of TextRanges to .select()
>
> So the code
>
> oCurrCon = ThisComponent.CurrentController
> oSelect() = ThisComponent.getCurrentController().getSelection()
> oSelect().getByIndex(1).setString("ciao")
> oCurrCon.select(oSelect())
>
> Does nearly what you want, but has still some problems.
>
> The changed TextRange will not be "visibly" selected in this multiple
> selection
This is exactly what I would to avoid, so this is not a solution for me
> but will do so in a single selection
>
> oCurrCon.select(oSelect().getByIndex(1))
>
> All other - unchanged - elements of the array will.
Simply because the select method does not recognize the XTextRanges container
as a valid object to select
In practice, this instruction:
oCurrCon.select(oSelect())
equivals to this one:
oCurrCon.select(Null)
In other words, the XTextRanges container that you get from the
getCurrentSelection call is simply ignored by the select method
> Somehow the TextRanges in the array seem to be not updated properly.
> Also, if you let the Controller visibly select a single TextRange first,
> you can change visible selection to another TextRange but also can't
> create a visible multiple selection afterwards through
> CurrentController.select(...).
this is the point.
>
> If this is no bug, I find it not very reasonable at least.
Nobody can say that this is a bug because it seems that there is no
documentation about what can be passed to the select method and what results
you may expect.
Anyway I would consider reasonable that if an object is the output of a
getSelection() call the same object should be selectable.
>
> Maybe I'll find a workaround later.
You'll be welcome :-)
ciao
Paolo M
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]