UDO or not UDO...

Knowledge exchange related to dycodoc, the visual form and document designer

Moderator: IDEAL Software Support

UDO or not UDO...

Postby nicolasBBS » Wed Dec 15, 2010 3:57 pm

Hello,

I've just purchased the enterprise edition, so I'll have my licence number soon.
I begin working on the demo version, with Delphi 6.

This is a use-case where I don't know exactly how to proceed :
- I use template files created with Dycodoc, which contain some text fields mapped to text boxes, this is OK.
- I need also to add some complex and dynamic drawings to the documents, and I have already written the drawing procedures. They use VPE functions like polyline, polygon...
- My drawing procedures accept the same parameters as writeBox functions, i.e. VFREE constant is allowed.
- I also have the "render" functions, so I can calculate the final coordinates without "printing".

I'd like to define the area "where to draw" in the template file, And it would be great if I could use dynamic sizing for this area. The aim is to have some other template elements dependant from my drawings.

For now I'm able to :
- define the drawing area with a frame in the template, but with static size
- "print" my drawing at the frame position after having dumped the template
I don't know if UDO objects are aimed to this purpose, and nUDOleft, nUDOtop... are not metric coordinates, so I use a frame.

First problem : I can't indicate in the template if my frame has a dynamic size (also impossible with UDO). But I can decide it in my own code, so it is not a big problem.
Second problem : it is too late for modifying the frame size in the template, because I have already dumped it.

I thought I could proceed like this :
- get initial frame coordinates from the template
- "render" my drawing
- modify frame coordinates into the template to adapt its size
- dump the template
- "print" my drawing accordingly to the final place of insertedVpeObject

But I can't, because if I modify the frame coordinates in the template, it will become absolute ! (I hav'nt tried, but I'm quite sure because I don't have access to other properties than nLeft, nRight, nTop, nBottom, so how to define relative coordinates like in dycodoc ?).

Maybe a good solution would be to use UDO, but I would need an event like "onUDORender", to have the possibility to indicate the final size of my drawing. And I'd like to work directly with VPE functions (poligon...) in metric coordinates.

What do you think about it ?

Best regards,

Nicolas.
nicolasBBS
 
Posts: 9
Joined: Fri Dec 10, 2010 5:42 pm

Re: UDO or not UDO...

Postby IDEAL Software Support » Wed Dec 15, 2010 4:12 pm

Using a UDO (User Defined Object) has a major drawback: it is exported as bitmap to PDF. Another drawback is that it can not be used on non-Windows platforms, so if you ever decide to support other platforms, this will cause problems. The main reason for using a UDO is to embed graphics from third party tools, like sophisticated chart-libraries or map libraries, etc.

Regarding your other questions:
You can not modify an object-position by code. object.nLeft, .nRight, etc. are read-only. If you wish to place parts of a template on a dynamic position (e.g. the objects below your drawing), you can create a second template which contains only these objects and dump it at a specific position, using faked margins. I.e. you make the topmost object top-margin dependent and other objects either dependent from this object, or also from the top margin. Before dumping the template you set the margin as desired and then dump the template.
IDEAL Software Support
 
Posts: 1558
Joined: Thu Nov 18, 2004 4:03 pm

Re: UDO or not UDO...

Postby nicolasBBS » Thu Dec 16, 2010 11:09 am

Thank you for your answer.
Ok, UDO is not the solution.
And using a second template with fake margins for objects that depends from my drawing is a working solution.

But if you plan to complete the tool, I think having something like that would be great :

- a new kind of object like a frame, named for example "DynamicUserArea", which supports dynamic sizing and dependences like text boxes
- two new associated events : "onDUArender" and "onDUAwrite"
onDUArender(sender : TVPEngine; var left,top,right,bottom:double; var canSplit:boolean); //VPE could ask the user for the size of his drawing at runtime, and could place it correctly as it does for text boxes.
onDUAwrite(sender : TVPEngine; left,top,right,bottom:double; insertedVPEObject:integer); //VPE could give to the user the occasion to draw, at the updated coordinates, and even it could be called more than one time if the area has been splitted.

Your tool is already very good, but with it, it would be the "best of the best" for me :wink:

Best regards,

Nicolas.
nicolasBBS
 
Posts: 9
Joined: Fri Dec 10, 2010 5:42 pm

Re: UDO or not UDO...

Postby IDEAL Software Support » Thu Dec 16, 2010 1:28 pm

Thank you for your feedback. We have put this onto our "Customer's Wishlist", but we can not make any promises if or when this will be implemented.
IDEAL Software Support
 
Posts: 1558
Joined: Thu Nov 18, 2004 4:03 pm


Return to DCD Open Forum

Who is online

Users browsing this forum: No registered users and 1 guest

cron