[IronPython] FlowDocument problem...
fuzzyman at voidspace.org.uk
Sat Feb 27 18:00:40 CET 2010
On 27/02/2010 14:27, Don Sawatzky wrote:
> I have a FlowDocument as a visual in a RichTextBox that I want to
> print. However, I want to print the visual with different page
> attributes. So, I tried the most IronPythonic way.
> printFlowDocument = FlowDocument(); etc.....
> printFlowDocument.Blocks = visualFlowDocument.Blocks #
> Won't work because Blocks is read-only attribute
> This way works fine:
> visualflowDoc = richTextBox.Document
> printFlowDoc.Blocks.Add(visualflowDoc.Blocks.LastBlock) #
> Visual disappears
> visualFlowDoc.Blocks.Add(printFlowDoc.Blocks.LastBlock) # Visual reappears
> The Add method of Blocks, which is a Collection, acts as a "copy and
> delete", and I hoped it would act as a Python "list.append". I wonder
> if there is a more IronPythonic way to do this or if .Net Collection
> is not broadly wrapped by Python list. I know that getitem, setitem,
> and iteration work.
The problem is that FlowDocument is a visual element, so if you take
bits of it and put them in another visual element then they aren't going
to be shown in the other one.
IronPython does a lot to make .NET collections behave as Python
collections (you can use the in operator, the del operator etc), but it
doesn't change their fundamental behavior.
All the best,
> donsaw at comcast.net <mailto:donsaw at comcast.net>
> Users mailing list
> Users at lists.ironpython.com
READ CAREFULLY. By accepting and reading this email you agree, on behalf of your employer, to release me from all obligations and waivers arising from any and all NON-NEGOTIATED agreements, licenses, terms-of-service, shrinkwrap, clickwrap, browsewrap, confidentiality, non-disclosure, non-compete and acceptable use policies ("BOGUS AGREEMENTS") that I have entered into with your employer, its partners, licensors, agents and assigns, in perpetuity, without prejudice to my ongoing rights and privileges. You further represent that you have the authority to release me from any BOGUS AGREEMENTS on behalf of your employer.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Ironpython-users