Re: [Lazarus] How to program with time in milliseconds?
On 05/22/2014 10:32 AM, Michael Schnell wrote: Here I'd like to consider some suggestions (I of course can implement this locally and we can later discuss a release for the fpc RTL or whatever. - function GetHardwareTicks could be a class function so I wold not need to create an instance to use it - FHWTickSupportAvailable could be calculated in the initialization section so that it is not necessary to re-do this for any instance. - property HWTickSupportAvailable could be a class property, as a consequence. - I'd like to use a GetTicks class-function that provides raw ticks and automatically uses GetHardwareTicks if FHWTickSupportAvailable and software ticks if not. I could do this in a very straight forward way: I moved several variables from TEpikTimer private to Implementation var: var FSystemTicks:TimeBaseData; // The system timebase FHWCapabilityDataAvailable:Boolean; // True if hardware tick support is available FHWTickSupportAvailable:Boolean; // True if hardware tick support is available FHWTicks:TimeBaseData; // The hardware timebase StartupCorrelationSample:TimebaseCorrelationData; // Starting ticks correlation snapshot FMicrosecondSystemClockAvailable:Boolean; // true if system has microsecond clock UpdatedCorrelationSample:TimebaseCorrelationData; // Snapshot of last correlation sample (For this, some properties needed to be modified to use set procedures and get functions that access the variables.) I created an initialization section: Initialization begin InitTimebases; end; (To do so I moved several functions out of the TEpikTimer class so there could referenced I redefind a function to be a class function: class function GetHardwareTicks:TickType; // return raw tick value from hardware source I defined a new class function: class function GetTicksFrequency:TickType; I tested this and it works nice for me (Linux X86 32 bit): After the start of the application, I can simply do TEpikTimer.GetTicksFrequency and TEpiktimer.GetHardwareTicks. In fact This is all I need. I feel that it does make sense not to call InitTimebases with any TEpiktimer.Create (Of course this also can be achieved by just checking if it already had been called. But even here the implementation independent variables are necessary.) I don't know if the modified version of EpikTimer.pas in fact is viable as a base for future development. -Michael -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] How to program with time in milliseconds?
(should we start a new mailing list thread ? ) Graeme, While doing the said modifications I could not continue to have function SystemSleep(Milliseconds: Integer):integer; Virtual; function CalibrateCallOverheads(Var TimeBase:TimebaseData) : Integer; Virtual; function CalibrateTickFrequency(Var TimeBase:TimebaseData): Integer; Virtual; as an overidable functions. I understand that these functions are used in the TEpikTimer.Create. Hence when virtual you could create a sibling class of TEpikTimer that provides alternate implementations of these function. Who would want to do this ? Is this necessary ? If yes it might make sense to implement an alternator creator that is called to allow for doing a re-calibration with alternate implementations of these functions. Would it be necessary to support multiple instances of different siblings of TEpikTimer which use individual calibration processes ? -Michael -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] [ANN] Brook 3.0.0 release!
Il 19/05/2014 04:45, silvioprog ha scritto: [snip] We can add a new file, called WHATS_NEW.txt, and it can be rewritten in all new versions, showing what's new in this released version. What do you think of this idea? If, instead of rewriting the WHATS_NEW.txt file each time, you just add a new paragraph on top of it, you may obtain a nice history file telling what's new in each released version, and helping to find regressions, compatibility for users of older versions of fpc/Lazarus, etc. Sort of: What's new in version 3.2.0 (fpc 3.1 Lazarus 2.0.2) What's new in version 3.1.0 (fpc 2.8, Lazarus 1.2.14) . What's new in version 3.0.0 (fpc 2.6.4 - Lazarus 1.2.2) . etc. Just my 5c. Giuliano -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
[Lazarus] Scrolling text
Hello. I need to put in a form an horizontally scrolling text. Something like a StaticText (so I can set text style), but with the text scrolling horizontally, like a markee, just one line, one or two words. Anyone knows any control with this property, or how to do it programmatically in an easy way? Tks ! Daniel -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Scrolling text
Hi, I don't know any component. Basically you can do it with Canvas.TextOut(X, Y, string);. Use timer and OnTimer event will render the text in position x:=x-1. Better approach can be to create a long TBitmap with text and only copy the part of bitmap to canvas. Of course it depends on the length of text too. Solution with bitmap needs more memory but less CPU. Vojtěch __ Od: Daniel Erles der...@gmail.com Komu: Lazarus mailing list lazarus@lists.lazarus.freepascal.org Datum: 23.05.2014 15:47 Předmět: [Lazarus] Scrolling text Hello.I need to put in a form an horizontally scrolling text. Something like a StaticText (so I can set text style), but with the text scrolling horizontally, like a markee, just one line, one or two words. Anyone knows any control with this property, or how to do it programmatically in an easy way?Tks !Daniel -- -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Scrolling text
Thks Vojtech, I'll try the Canvas.TextOut way. I hope it doesen't blink, or so. Let's see. 2014-05-23 10:36 GMT-04:00 Vojtěch Čihák vojtech.ci...@atlas.cz: Hi, I don't know any component. Basically you can do it with Canvas.TextOut(X, Y, string);. Use timer and OnTimer event will render the text in position x:=x-1. Better approach can be to create a long TBitmap with text and only copy the part of bitmap to canvas. Of course it depends on the length of text too. Solution with bitmap needs more memory but less CPU. Vojtěch __ Od: Daniel Erles der...@gmail.com Komu: Lazarus mailing list lazarus@lists.lazarus.freepascal.org Datum: 23.05.2014 15:47 Předmět: [Lazarus] Scrolling text Hello. I need to put in a form an horizontally scrolling text. Something like a StaticText (so I can set text style), but with the text scrolling horizontally, like a markee, just one line, one or two words. Anyone knows any control with this property, or how to do it programmatically in an easy way? Tks ! Daniel -- -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Scrolling text
I use a stringgrid with the right properties set, you have no lines, no header, you can set the size easily to as much as you like. the only “trick” you have to use is that you always have to insert to the first line and not the last ;) Regards, Chris From: Daniel Erles Sent: Friday, May 23, 2014 4:45 PM To: Lazarus mailing list Subject: [Lazarus] Scrolling text Hello. I need to put in a form an horizontally scrolling text. Something like a StaticText (so I can set text style), but with the text scrolling horizontally, like a markee, just one line, one or two words. Anyone knows any control with this property, or how to do it programmatically in an easy way? Tks ! Daniel -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus