Hi Torben,
I cannot seem to replicate my previous timer formats using the current snapshot release. The Ramp timer only shows the furthest ramp and I cannot set it to .z so it only shows 1/10th sec - it always defaults to 3 decimal places The âShow only nearest Rampâ option seems to have no effect.
Seems that FormatDateTime cannot output 1/10th seconds, only milliseconds. I will have to introduce my own FormatDateTime function then :-/ (I still like the flexibility of specifying your own format, rather than using the former âshow in secondsâ, âtruncateâ etc. options).
I will also investigate the ramp issue.
Torbenâs right, the 1/10th second problem is a shortcoming in Delphi itself, not the mAirList code!
Also .z in a FormatDateTime string does NOT do what Charlie thinks. For example, .500 formatted with .z will still display as .500; but .005 formatted with .z will display as .5 (geddit?!?!!???!?!).
Maybe the easiest solution would be introduce a new mAirList-only formatting string âcodeâ of zz which means âleftmost character of the formatted zzz result (aka: tenths of a second, truncated from the mS value).â That should be reasonably easy for Torben to code for (by using two FormatDateTime calls, or using a single call substituting zzz for zz; then suitably âhackingâ the returned result before passing it on to the caller).
Just my suggestion ⌠;D
BFN
CAD
Instead of counting the zâs, Iâd better introduce new variables, say âuâ for 1/10th and âvâ for 1/100th of a second. Hereâs my proposed solution:
function MyFormatDateTime(Formatting: string; DateTime: TDateTime): string;
begin
Formatting := StringReplace(Formatting, 'u', Copy(FormatDateTime('zzz', DateTime), 1, 1), [rfReplaceAll]);
Formatting := StringReplace(Formatting, 'v', Copy(FormatDateTime('zzz', DateTime), 1, 2), [rfReplaceAll]);
Result := FormatDateTime(Formatting, DateTime);
end;
Itâs important to perform the substitution before the call to FormatDateTime, as the latter might insert any of these characters into the text (âSundayâ).
Would that be ok?
Personally, Iâd just like them to be similar to the Player timer - Specifically the âShow time in seconds (instead of 1/10th sec)â option I appreciate that the progress bars offer greater resolution than 1sec but itâd be âniceâ if the GUI objects can be configured to mimic the Player/Cartwall countdowns⌠IMHO, 3 decimal places is a bit âbigâ and a little too accurate (unless youâre one of Cadâs scripts!). Didnât know about zzz vs z - never used it but itâs sending me to sleep just thinking about it!
Any practical solution (that keeps everybody happy) would be welcomed
The solution mentioned above seems to work. Iâll upload a new snapshot tommorrow.
Build 516 is ready, introducing the âuâ and âvâ variables mentioned above. Let me know if it works.
Torben: nice work! (Any thoughts yet on the âshrinkingâ duration at EOF in PFL Player? )
Charlie: itâs because people like Herr Doktor and myself not only arenât rendered comatose by (for example) the difference between zzz vs. z, but also know, care, and fret about it; that all the software that you really like (such as mAirList) âjust works.â ;D
BFN
CAD
I canât get the Intro Timer to display either a u or a v⌠What I mean is, it DOES display the u or v and not the .x decimal value - the Time Remaining counter is OK. Also, the Intro still does not show all ramps in the ramp1/ramp2/ramp3 format. Iâm using Intro: ss.u or nn:ss.u and Remaining: nn:ss.u
Cad - Understand perfectly, appreciate that a hell of a lot of work goes in âbehind the scenesâ to make certain features work how we want
[quote=âTorben, post:4, topic:5201â]Hereâs my proposed solution:
function MyFormatDateTime(Formatting: string; DateTime: TDateTime): string;
begin
Formatting := StringReplace(Formatting, 'u', Copy(FormatDateTime('zzz', DateTime), 1, 1), [rfReplaceAll]);
Formatting := StringReplace(Formatting, 'v', Copy(FormatDateTime('zzz', DateTime), 1, 2), [rfReplaceAll]);
Result := FormatDateTime(Formatting, DateTime);
end;
[/quote]
Er ⌠I understand the idea, but âŚ
I think you need two Booleans to store whether or not the original Formatting contains â.uâ and â.vâ (respectively); assign the FormatDateTime result to a new temporary string instead of to Result; then use those Booleans to perform the correct right-end truncation before setting Result to the (possibly truncated) temp. string. Donât you?
Otherwise, youâll just get milliseconds in the Result, unless Iâm missing something glaringly obvious?
BFN
CAD