TStateMachine lazarus / 5-Lazarus Extra Components ---------------------------------------------------------------------- avra · 2012-07-30 11:19 I have converted a Delphi TStateMachine to Lazarus from this link: http://melander.dk/delphi/statemachine, both visual components and demo. Although it works well in runtime (tested only in Windows), in design mode I have a connector lines updating problem. When I move or do something with any of the controls I see connector lines painted for a short eye blink moment, but they are erased immediately after that. Single click on a component helps temporary but just until clicked somewhere else. Please, please someone more experienced take a look and help with this design mode repainting problem (this is my first conversion of someone else's Delphi component). I am looking at it for quite some time and I am getting lost here. I have tried to change various things in mouse and paint methods, but without success so I am stuck here. For more info about the component just take a look at the attached automated pizza ordering machine demo and try to make an order via simulated phone. Benefit is that all states are visual in both design mode and runtime, and you can visually set or change their relations and transitions. Once you write code for a state/event it is completed, and if you enter new things or change transitions you just change visual presentation or properties and the old code can stay. If you code all this by hand you can quickly make a maintenance mess and loose compass as complexity raises. With these components you can also visualize transitions for yourself very nicely (single image is a thousand words, and you know current state with a single quick look), or you can single step through states for debugging purposes. Visual flow chart presentation is also clear even to most non-programmers, so can be nicely used sometimes if needed for state presentation to your users. Btw. I know it's a bad idea to have both component and demo in the same dir but that was a quick tmp fix for IDE not having unit in the path, and I don't think it's the cause of the problem. WinXP, CT 2.70, Laz 1.1 svn 20120719, FPC 2.7.1 svn 37429 ---------------------------------------------------------------------- Chronos · 2012-07-31 07:49 This is nice example of design-time capabilities of IDE. But in design-time if I move some node all links are visible and doesn't disappear. So I am not see problem to fix. Lazarus trunk 37960 from 2012-07-17 FPC 2.6.0 on winxp. ---------------------------------------------------------------------- BigChimp · 2012-07-31 10:27 Very nice components!! I have no graphical problems either, on Lazarus 1.1. (SVN r38091), FPC x86 2.6.1, Windows Vista x64. I wonder whether the original author would consent to add these to the Lazarus LCL?? (Had a look at the license and am guessing it may not be compatible to (modified) LGPL) If not, this would be a wonderful addition to Lazarus CCR! ---------------------------------------------------------------------- picstart · 2012-07-31 13:18 Quality software actually worked on WIN7 pro 32 laz 9.30.4  FPC 2.6.0 without modification Great solution Thanks ---------------------------------------------------------------------- jack616 · 2012-07-31 13:26 I have paint issues running on win-7 64 - compiled as 64bit win optimised level 1 - no debug info etc Runtime horizontal sliding  of sizer bars causes "ghost" painting - but only when moving left to right Its as if the screen isnt being updated fast enough. Left side is aligned left... right side is aligned full. I do have fixed panels above and below. no graphics in windows but they do contain treeViews so that may be slowing things down. It shouldnt on my hardware though. Dont know if its related to the above issue though. ---------------------------------------------------------------------- BigChimp · 2012-07-31 13:47 No problems here on x64 Lazarus 1.1 (r38091) with FPC 2.7.1 r21987 on Vista x64. If I move the form sizer bars in runtime with -O1 without debug info I get slight flickering when moving the right or bottom edge of the form (not left or top). I can certainly live with that. ---------------------------------------------------------------------- jack616 · 2012-08-01 14:19 After a bit more checking my issue is related to the amount of files listed in the fileListview section. The more files the worse it get. At 70 files its very bad. I could upload a .exe demonstrating if thats any help to anyone  (I've now compiled it as Win-32 and seen the same effect on vista-32) I havn't had time to look into it too much - maybe it needs an application.processmessages somewhere or maybe I just didnt configure something right.  I just thought it worth mentioning here. ---------------------------------------------------------------------- avra · 2012-08-06 16:11 Quote from: BigChimp on July 31, 2012, 12:27:05 pmI wonder whether the original author would consent to add these to the Lazarus LCL?? (Had a look at the license and am guessing it may not be compatible to (modified) LGPL). If not, this would be a wonderful addition to Lazarus CCR!Well I was thinking about contacting him after design mode is fixed. I have also seen that author has made a custom property editor for even easier transitions, but it is not working and it is commented out so I guess it is for some future version. I was also hoping that after my initial port, someone will try to port it to Linux or some other OS. Then it would be a real Lazarus CCR candidate. @all: It is very strange to hear that some have it working without problems, since on 4 machines with different Lazarus and Windows versions I have the same problem. Maybe I didn't explain it well? I have made a flash screencast showing the connector lines flickering problem that I have, that can be seen in any browser with provided HTML loader. Please, please take a look and report if you see different behavior then shown in the screencast video: https://anonfiles.com/file/31b22db2f24c2a3e93ea5c76146eb362 p.s. Sorry for the strange download link, but unfortunately forum does not let me upload files bigger then 250KB, and screencast has 612KB. ---------------------------------------------------------------------- BigChimp · 2012-08-12 07:06 Nope, no problems. Recorded a (messy) screencast with Camtasia: https://anonfiles.com/file/e21fc26ea7ccf1011cb22eede89f7ad0 - connector lines don't flicker when moving object - connnector lines don't flicker or flicker minimally when resizing form Win Vista x64, Lazarus SVN x86, FPC 2.6.1 ---------------------------------------------------------------------- ireverse · 2012-09-17 07:58 Hello, I've just downloaded your package, greate work, and I have the same problem as you, Lazarus 1.0, FPC 2.6.0 ---------------------------------------------------------------------- avra · 2012-09-18 11:44 Thanks everyone for testing. However I could not figure out why the same code works on some systems and it doesn't work on others. If anyone has an idea I'm all ears... :-( ---------------------------------------------------------------------- v.denis · 2012-09-18 13:40 Nice work! First I thought such behavior is by-design. But trying it in Delphi, lines are drawn in design-time. Really interesting what's causing that. ---------------------------------------------------------------------- BigChimp · 2013-07-23 08:35 Perhaps replacing the graphics part of things with Taazz' port of SimpleGraph would be useful: forum.lazarus.freepascal.org/index.php/topic,21471 (Haven't checked if the licenses bite each other...) ---------------------------------------------------------------------- avra · 2013-07-24 21:43 Quote from: BigChimp on July 23, 2013, 10:35:49 amPerhaps replacing the graphics part of things with Taazz' port of SimpleGraph would be useful:Sorry, too complex for me. I give up. ---------------------------------------------------------------------- taazz · 2013-07-25 05:49 What is to complex? I can help with part of the work. What you need to do? ---------------------------------------------------------------------- avra · 2013-07-25 09:56 Quote from: taazz on July 25, 2013, 07:49:55 amWhat is too complex? I can help with part of the work. What you need to do?After too much time being spent I have lost the interest and at the end implemented what I needed in Delphi. I have made the original Delphi conversion and fixed few things here and there, but I couldn't fix already mentioned design mode bug that doesn't seam to show for every Lazarus user (it shows in all my Lazarus/CodeTyphon/fpcup installations on Win7-32, Win7-64 and WinXP). Everyone with time and knowledge to fix this is more then welcome to try! ---------------------------------------------------------------------- taazz · 2013-07-25 10:01 oh, ok. I have no need for a state machine component set at this point, some time in the future maybe. ---------------------------------------------------------------------- avra · 2013-07-25 10:04 Thanks anyway for showing good will... ---------------------------------------------------------------------- matthius · 2024-09-09 10:51 Hello ! I have tested State Machine on GNU Linux. It seems ok : https://lazaruscomponents.com/2024/09/09/state-diagram/ Please share and choose a license. I prefer sourceforge. ---------------------------------------------------------------------- avra · 2024-09-09 22:44 Quote from: matthius on September 09, 2024, 12:51:16 pmI have tested State Machine on GNU Linux. It seems ok : https://lazaruscomponents.com/2024/09/09/state-diagram/ Thank you for testing. I know that runtime works, but did you test design mode as described here: "...in design mode I have a connector lines updating problem. When I move or do something with any of the controls I see connector lines painted for a short eye blink moment, but they are erased immediately after that. Single click on a component helps temporary but just until clicked somewhere else." I am interested to see design mode working properly, because without it I do not see it useful. QuotePlease share and choose a license. I prefer sourceforge.I will share it when design time bug is fixed. I can not change the original author license, which is Creative Commons Attribution-Share Alike 3.0 Unported License, as seen on his page https://melander.dk/delphi/statemachine. ---------------------------------------------------------------------- matthius · 2024-09-10 12:20 Quote from: avra on September 10, 2024, 12:44:55 amThank you for testing. I know that runtime works, but did you test design mode as described here: "...in design mode I have a connector lines updating problem. When I move or do something with any of the controls I see connector lines painted for a short eye blink moment, but they are erased immediately after that. Single click on a component helps temporary but just until clicked somewhere else." I am interested to see design mode working properly, because without it I do not see it useful. Component did not compile on GNU Linux. So i traduced it more to Lazarus. But in design time it works on GNU Linux. Lines are not blinking or erased. ---------------------------------------------------------------------- af0815 · 2024-09-11 10:12 Quote from: matthius on September 09, 2024, 12:51:16 pmI have tested State Machine on GNU Linux. Your Version is not working in WIndows. The ClipCursor is missing, because it is hided by conditional compiling. ---------------------------------------------------------------------- Thaddy · 2024-09-11 15:13 It is very old code, worked for years, and is not a full featured statemachine. ---------------------------------------------------------------------- matthius · 2024-09-11 21:40 Now it works on Windows, GNU Linux, Mac OS. ---------------------------------------------------------------------- ArminLinder · 2025-12-30 19:59 Quote from: Thaddy on September 11, 2024, 05:13:06 pmIt is very old code, worked for years, and is not a full featured statemachine. Have been working on (much simpler) state machine code recently, nevertheless it served my purpose nicely. Just out of interest ... is there a complete list of features a state machine needs to have, so one can call it "full featured"? What do you think is missing? And, btw, where can I find the code? The links given above appear to be dead. Best regards from Bavaria, Armin ---------------------------------------------------------------------- avra · 2026-01-05 17:13 Quote from: ArminLinder on December 30, 2025, 08:59:40 pmAnd, btw, where can I find the code? The links given above appear to be dead. I have just checked both the Lazarus version from 1st post, and also D7 original version from Melander site, and links are working. ---------------------------------------------------------------------- elkhalafy · 2026-01-28 06:35 Hi avra I hope Port GLXengine to Lazarus please Thank you