The DataCAD Developer Network (DDN) is an online resource for information and support for DCAL® (DataCAD Applications Language) developers as well as anyone interested in creating fonts, toolbars, hatch patterns, or linetypes for use in DataCAD.
#71849 by dhs
Thu Jul 13, 2017 10:41 pm
Hi,
I s there an existing method to allow entry of distances in a VCL form? I am looking for is something to format a distance for display in an edit field, and also to parse the input from that field and return a number in 1/32".
Hopefully this exists and I just haven't found it ... It would be possible to write my own logic based on the scale type, but there are quite a few scale types and the logic must already exist in DataCAD itself so I am hoping I can hook into that.
Rgds,
David H.
#71906 by dhs
Tue Jul 25, 2017 12:37 pm
Thanks Joe,

I had not considered cvdisst because I felt that it formatted a string for display rather than for input (e.g. for the DataCAD's Arch scale an input of 12.11.31/32 is formatted as '12-11 31/32' by cvdisst if Units is disabled in the scale type menu, or as 12'-11 31/32" if units are enabled).

So it seems that if I want to be able to accept distance input in a VCL form I do in fact need to write both format & parse functions. They need to take into account not only the current scale type but also various other parameters (e.g. dofloat, sig digits for mm scale, 32nds/64ths/128ths etc for Arch scale, and possibly other settings for other scale types), so it is not a particularly simple piece of code.
... When I think about it, the formatting code could probably use cvdisst as a starting point and just replace spaces and dashes with dots (for Arch Scale) and remove units characters(you can of course use cvdisst in a VCL form that is part of a DCAL for Delphi project so long as you include UInterfaces in the uses clause). Might just work ...

I've put aside the project that I was working on when I asked this question, but will most likely return to it at some point (was more of a concept than a very worked out project). If I do come back to it I will be tempted to just accept mm or decimal inch inputs at least in the initial version, as they will both be pretty simple to parse.

Regards,
David H.
#74012 by dhs
Fri Jun 01, 2018 10:10 am
ok, a year later and I am starting to look at D4D again, and have discovered that the procedures I was looking for did in fact exist all along (and are used in the sample AEC_Model macro, which is how I found them).

To convert a distance to string (in the input format) use:



To convert a distance string (in the input format) back to a double use:


Glad to have found these, as they did seem to be glaring omissions from the interface if they did not exist!

Rgds,
David H.
#74142 by dhs
Mon Jun 18, 2018 12:54 pm
Looking at the code in the sample AEC_Model macro, and I notice it allows the user to enter a comma in the distance/angle/number input field. I can't think of any distance or angle format that requires (or even allows) a comma in the input.

Can anybody enlighten me as to when a comma would be acceptable in a distance or angle entry ?

Thanks,
David H.
#74144 by David A. Giesselman
Mon Jun 18, 2018 3:08 pm
Josh is correct. A comma is used as a decimal separator in a large portion of the world.

Dave

Who is online

Users browsing this forum: No registered users and 25 guests

About DataCAD Forum

The DataCAD Forum is a FREE online community we provide to enhance your experience with DataCAD.

We hope you'll visit often to get answers, share ideas, and interact with other DataCAD users around the world.

DataCAD

Software for Architects Since 1984