[IronPython] FlowDocument problem...

Michael Foord fuzzyman at voidspace.org.uk
Sat Feb 27 09:00:40 PST 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
>             pDialog.PrintDocument(printFlowDocument.......)
> This way works fine:
>             visualflowDoc = richTextBox.Document
>             printFlowDoc.Blocks.Add(visualflowDoc.Blocks.LastBlock) # 
> Visual disappears
>             pDialog.PrintDocument(printFlowDoc......)
> 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,

Michael Foord


> donsaw at comcast.net <mailto:donsaw at comcast.net>
>
>
> _______________________________________________
> Users mailing list
> Users at lists.ironpython.com
> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
>    


-- 
http://www.ironpythoninaction.com/
http://www.voidspace.org.uk/blog

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...
URL: <http://lists.ironpython.com/pipermail/users-ironpython.com/attachments/20100227/e6d58d35/attachment.htm>


More information about the Users mailing list