[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 112: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 112: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 112: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 112: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 5077: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3937)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 5079: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3937)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 5080: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3937)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 5081: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3937)
forum.datacad.com • View topic - Distances in VCL form (DCAL for Delphi)
Page 1 of 1

Distances in VCL form (DCAL for Delphi)

PostPosted: Thu Jul 13, 2017 10:41 pm
by dhs
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.

Re: Distances in VCL form (DCAL for Delphi)

PostPosted: Wed Jul 19, 2017 7:45 pm
by Jsosnowski

Re: Distances in VCL form (DCAL for Delphi)

PostPosted: Tue Jul 25, 2017 12:37 pm
by dhs
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.

Re: Distances in VCL form (DCAL for Delphi)

PostPosted: Fri Jun 01, 2018 10:10 am
by dhs
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.

Re: Distances in VCL form (DCAL for Delphi)

PostPosted: Mon Jun 18, 2018 12:54 pm
by dhs
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.

Re: Distances in VCL form (DCAL for Delphi)

PostPosted: Mon Jun 18, 2018 1:24 pm
by joshhuggins

Re: Distances in VCL form (DCAL for Delphi)

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

Dave

Re: Distances in VCL form (DCAL for Delphi)

PostPosted: Mon Jun 18, 2018 5:12 pm
by dhs

Re: Distances in VCL form (DCAL for Delphi)

PostPosted: Thu Oct 04, 2018 2:59 pm
by dhs