Recent

Author Topic: Form problem  (Read 12954 times)

user5

  • Sr. Member
  • ****
  • Posts: 419
Re: Form problem
« Reply #15 on: April 10, 2015, 12:20:48 pm »
First, thank you all for your very nice suggestions. I was really surprised and it made me feel better. I was a bit disheartened. Sorry if I seemed like a jerk. I don't have much experience in multithreading but I will look into that if nothing else works out, howardpc.

Do you know a site where I could learn some simple multithreading? Graeme Geldenhuys, I may follow your suggestion to replace GetTickCount with calls to Epiktimer but I would prefer a form component because I think it would be "immune" to any movements of the form like TTimer, TTrackBar, ProgressBar etc. are. Other than that, GetTickCount works fine but I have some questions about it, like, will it work on all computers, no matter what their speed is? Perhaps as you said, maybe I don't need Epiktimer since I need a timer that moves the needle one pixel every .025 a sec..

Epiktimer etpackage_dsgn.lpk compiled just fine but when I tried to install it, I got messages like "Missing Treeview" and a message that the Epiktimer .lpk file was missing a register procedure, even though I saw one in the code. This may be because my version of Lazarus (1.0.10) is not compatible with Epiktimer 1.0.1, I don't know.

All this is too bad because I've heard nothing but good about Epiktimer. Thanks again so much, you guys.

user5

  • Sr. Member
  • ****
  • Posts: 419
Re: Form problem
« Reply #16 on: April 10, 2015, 12:28:54 pm »
First, thank you all for your very nice suggestions. I was really surprised and it made me feel better. I was a bit disheartened. Sorry if I seemed like a jerk. I don't have much experience in multithreading but I will look into that if nothing else works out, howardpc. Do you know a site where I could learn some simple multithreading?

Graeme Geldenhuys, I may follow your suggestion to replace GetTickCount with calls to Epiktimer but I would prefer a form component because I think it would be "immune" to any movements of the form like TTimer, TTrackBar, ProgressBar etc. are. Other than that, GetTickCount works fine but I have some questions about it, like, will it work on all computers no matter what their speed is? Perhaps as you said, maybe I don't need Epiktimer since I need a timer that moves the needle one pixel every .025 a sec..

Epiktimer etpackage_dsgn.lpk compiled just fine but when I tried to install it, I got messages like "Missing Treeview" and a message that the Epiktimer .lpk file was missing a register procedure, even though I saw one in the code. This may be because my version of Lazarus (1.0.10) is not compatible with Epiktimer 1.0.1, I don't know.

All this is too bad because I've heard nothing but good about Epiktimer. Thanks again so much, you guys. Sorry if this note posted twice; I had some problems with formatting.

user5

  • Sr. Member
  • ****
  • Posts: 419
Re: Form problem
« Reply #17 on: April 10, 2015, 12:33:41 pm »
This is just a test. My replies and posts don't seem to be appearing so I don't know what is going on.

Signal

  • New Member
  • *
  • Posts: 41
Re: Form problem
« Reply #18 on: April 10, 2015, 12:38:31 pm »
I use epik timer. It installs under the System Tab without problems in Linux. I don't know if it does the same under Windows.

I don't think anybody mentioned this earlier in the thread, but TTimer is load sensitive and its settings are only approximate. It is unsuitable for applications requiring high accuracy or repeatability.

BTW, your test post just showed up as I was writing this.

Graeme

  • Hero Member
  • *****
  • Posts: 1527
    • Graeme on the web
Re: Form problem
« Reply #19 on: April 10, 2015, 12:57:22 pm »
Epiktimer etpackage_dsgn.lpk compiled just fine but when I tried to install it, I got messages like "Missing Treeview"
Then it is another package causing your Lazarus to fail a recompile of the IDE, because there is NO reference to any Treeview component anywhere in the EpikTimer code.

BTW:
Where did you get the EpikTimer code from? Sometimes there are multiple locations on the internet hosting the same packages - causing confusion with "latest versions". The latest code should come from here: https://github.com/graemeg/epiktimer

Quote
and a message that the Epiktimer .lpk file was missing a register procedure, even though I saw one in the code. This may be because my version of Lazarus (1.0.10) is not compatible with Epiktimer 1.0.1, I don't know.
I just tested and it installs fine here on a old and new Lazarus. The EpikTimer component should appear in the "System" component palette. I haven't touch the etpackage_dsgn.lpk for a very long time, so it shouldn't have any problems with your Lazarus v1.0.10.
--
fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal
http://fpgui.sourceforge.net/

user5

  • Sr. Member
  • ****
  • Posts: 419
Re: Form problem
« Reply #20 on: April 10, 2015, 02:50:54 pm »
Graeme Geldenhuys, I downloaded Epiktimer from the place you mentioned. BTW, I took you up on your suggestion to use Epiktimer in my code without using the component and it works great as a timer using elapsed time so I'm going to replace GetTickCount with Epiktimer since the latter uses actual time rather than ticks. This doesn't solve the problem of form activities being paused when the form is moved but
I may try to install the Epiktimer again. Thanks.

user5

  • Sr. Member
  • ****
  • Posts: 419
Re: Form problem
« Reply #21 on: April 10, 2015, 06:26:49 pm »
Well, good news and bad news in case anyone's interested and I can understand if no one is since I've unintentionally hogged enough discussion time. This should be my last post for a while, though. (Stop cheering so loud, hah, hah)

The good news is that I was finally able to install the Epiktimer component but it too pauses when the form is moved, which I'll just have to live with. Perhaps I can mitigate the problem by also pausing the audio or having the play needle 'catch up' to the soundtrack.

Anyway, I'm defininitely going to use Epiktimer instead of GetTickCount. Epiktimer is very smooth, very accurate and isn't affected by other media programs. Bye for now.

All praise to Lazarus.

sam707

  • Guest
Re: Form problem
« Reply #22 on: April 10, 2015, 06:47:00 pm »
i believe that when you press the title bar of a form under windows, windows takes a picture (sort of bitmap, frozen at instant T) to prepare it for moving around. If so, the only choice you have is to go multithreading for deep accuracy. However, be aware that LCL is NOT thread safe at canvas drawing (at least under windows, only main thread can draw), and all changes would apear after the use of the TThread.Synchronize method, while your application goes back to its ProcessMessages method.

see TThread, TApplication.ProcessMessages, TThread.Synchronize
       TControl.Refresh, TControl.Repaint, TControl.Invalidate

http://lazarus-ccr.sourceforge.net/docs/lcl/controls/tcontrol.html
« Last Edit: April 10, 2015, 06:56:07 pm by sam707 »

taazz

  • Hero Member
  • *****
  • Posts: 5368
Re: Form problem
« Reply #23 on: April 10, 2015, 08:05:38 pm »
i believe that when you press the title bar of a form under windows, windows takes a picture (sort of bitmap, frozen at instant T) to prepare it for moving around.

Food for thought. Why did it work when he used a ttimer and stopped working when he created hes own timing loop?
Good judgement is the result of experience … Experience is the result of bad judgement.

OS : Windows 7 64 bit
Laz: Lazarus 1.4.4 FPC 2.6.4 i386-win32-win32/win64

sam707

  • Guest
Re: Form problem
« Reply #24 on: April 10, 2015, 11:11:18 pm »

Food for thought. Why did it work when he used a ttimer and stopped working when he created hes own timing loop?

I have no clue around what you are talking about! I suggest you to find a restaurant if you can't help the topic with "constructive" ideas

Graeme

  • Hero Member
  • *****
  • Posts: 1527
    • Graeme on the web
Re: Form problem
« Reply #25 on: April 11, 2015, 12:31:50 am »
i believe that when you press the title bar of a form under windows, windows takes a picture (sort of bitmap, frozen at instant T) to prepare it for moving around. If so, the only choice you have is to go multithreading for deep accuracy.
That is definitely not true in all cases. I have multiple fpGUI applications here that do many things in the background and update the user interface continuously. I can happily move the window around in Windows, Linux and FreeBSD, and the user interface still updates without problem. Some of these apps are multi-threaded, and some (like the Sprite demo I mentioned before) simply use a timer.
--
fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal
http://fpgui.sourceforge.net/

taazz

  • Hero Member
  • *****
  • Posts: 5368
Re: Form problem
« Reply #26 on: April 11, 2015, 12:47:15 am »
This is a simple question but I don't know the answer and I need help.

When I click on the top border of my form, all the action that's taking place on the form pauses until I release the left mouse button.

Is there a way to stop this from happening?


Food for thought. Why did it work when he used a ttimer and stopped working when he created hes own timing loop?

I have no clue around what you are talking about! I suggest you to find a restaurant if you can't help the topic with "constructive" ideas
Thanks for your inputs. I always appreciate helpful comments and I plan to continue using the great platform of Lazarus.

Before I incorporated my recent code, I was using TTimer to drive the needle and blaazen, you are quite correct that moving the form has no effect on the needle when using TTimer but I have found TTimer to be a bit inaccurate and the needle is unsurprisingly slowed down when running my program at the same time that another media program is running.

This means that I would have to have some kind of real time process that corrected the slowdown. With TTimer I do have a calibration menu selection that allows the user to recalibrate and speed up the needle if necessary but this is rather cumbersome so I recently wrote some code using GetTickCount instead of TTimer.

This new stuff is great in that it runs well even if other programs are running but it does present the problem of the needle stopping when the title bar is clicked on, no matter what waveform is showing, to answer your question. My next new subject post will have a question or two about GetTickCount.

I suppose all this is due to the fact that TTimer is an integral part of Lazarus while my code using GetTickCount is not but if I could find a way to solve this problem then I could have my cake and eat it too. Thanx.

Is this clear now? No? Oh well I'm off to do something constructive, enough time wasted.
Good judgement is the result of experience … Experience is the result of bad judgement.

OS : Windows 7 64 bit
Laz: Lazarus 1.4.4 FPC 2.6.4 i386-win32-win32/win64

sam707

  • Guest
Re: Form problem
« Reply #27 on: April 11, 2015, 01:54:44 am »
now i know taazz means literally "born to troll" :D

 

TinyPortal © 2005-2018