Recent

Author Topic: TStateMachine  (Read 20417 times)

avra

  • Hero Member
  • *****
  • Posts: 2530
    • Additional info
TStateMachine
« on: July 30, 2012, 01:19:50 pm »
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
« Last Edit: July 30, 2012, 01:27:16 pm by avra »
ct2laz - Conversion between Lazarus and CodeTyphon
bithelpers - Bit manipulation for standard types
pasettimino - Siemens S7 PLC lib

Chronos

  • Full Member
  • ***
  • Posts: 242
    • PascalClassLibrary
Re: TStateMachine
« Reply #1 on: July 31, 2012, 09:49:40 am »
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

  • Hero Member
  • *****
  • Posts: 5740
  • Add to the wiki - it's free ;)
    • FPCUp, PaperTiger scanning and other open source projects
Re: TStateMachine
« Reply #2 on: July 31, 2012, 12:27:05 pm »
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!
Want quicker answers to your questions? Read http://wiki.lazarus.freepascal.org/Lazarus_Faq#What_is_the_correct_way_to_ask_questions_in_the_forum.3F

Open source including papertiger OCR/PDF scanning:
https://bitbucket.org/reiniero

Lazarus trunk+FPC trunk x86, Windows x64 unless otherwise specified

picstart

  • Full Member
  • ***
  • Posts: 236
Re: TStateMachine
« Reply #3 on: July 31, 2012, 03:18:46 pm »
Quality software actually worked on WIN7 pro 32 laz 9.30.4  FPC 2.6.0 without modification
Great solution
Thanks

jack616

  • Sr. Member
  • ****
  • Posts: 268
Re: TStateMachine
« Reply #4 on: July 31, 2012, 03:26:34 pm »
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

  • Hero Member
  • *****
  • Posts: 5740
  • Add to the wiki - it's free ;)
    • FPCUp, PaperTiger scanning and other open source projects
Re: TStateMachine
« Reply #5 on: July 31, 2012, 03:47:03 pm »
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.
« Last Edit: July 31, 2012, 03:50:20 pm by BigChimp »
Want quicker answers to your questions? Read http://wiki.lazarus.freepascal.org/Lazarus_Faq#What_is_the_correct_way_to_ask_questions_in_the_forum.3F

Open source including papertiger OCR/PDF scanning:
https://bitbucket.org/reiniero

Lazarus trunk+FPC trunk x86, Windows x64 unless otherwise specified

jack616

  • Sr. Member
  • ****
  • Posts: 268
Re: TStateMachine
« Reply #6 on: August 01, 2012, 04:19:04 pm »
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

  • Hero Member
  • *****
  • Posts: 2530
    • Additional info
Re: TStateMachine
« Reply #7 on: August 06, 2012, 06:11:32 pm »
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!
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.
« Last Edit: August 06, 2012, 06:24:30 pm by avra »
ct2laz - Conversion between Lazarus and CodeTyphon
bithelpers - Bit manipulation for standard types
pasettimino - Siemens S7 PLC lib

BigChimp

  • Hero Member
  • *****
  • Posts: 5740
  • Add to the wiki - it's free ;)
    • FPCUp, PaperTiger scanning and other open source projects
Re: TStateMachine
« Reply #8 on: August 12, 2012, 09:06:25 am »
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
Want quicker answers to your questions? Read http://wiki.lazarus.freepascal.org/Lazarus_Faq#What_is_the_correct_way_to_ask_questions_in_the_forum.3F

Open source including papertiger OCR/PDF scanning:
https://bitbucket.org/reiniero

Lazarus trunk+FPC trunk x86, Windows x64 unless otherwise specified

ireverse

  • Guest
Re: TStateMachine
« Reply #9 on: September 17, 2012, 09:58:42 am »
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

  • Hero Member
  • *****
  • Posts: 2530
    • Additional info
Re: TStateMachine
« Reply #10 on: September 18, 2012, 01:44:48 pm »
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... :-(
ct2laz - Conversion between Lazarus and CodeTyphon
bithelpers - Bit manipulation for standard types
pasettimino - Siemens S7 PLC lib

v.denis

  • Guest
Re: TStateMachine
« Reply #11 on: September 18, 2012, 03:40:07 pm »
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.
« Last Edit: September 18, 2012, 04:23:43 pm by v.denis »

BigChimp

  • Hero Member
  • *****
  • Posts: 5740
  • Add to the wiki - it's free ;)
    • FPCUp, PaperTiger scanning and other open source projects
Re: TStateMachine
« Reply #12 on: July 23, 2013, 10:35:49 am »
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...)
Want quicker answers to your questions? Read http://wiki.lazarus.freepascal.org/Lazarus_Faq#What_is_the_correct_way_to_ask_questions_in_the_forum.3F

Open source including papertiger OCR/PDF scanning:
https://bitbucket.org/reiniero

Lazarus trunk+FPC trunk x86, Windows x64 unless otherwise specified

avra

  • Hero Member
  • *****
  • Posts: 2530
    • Additional info
Re: TStateMachine
« Reply #13 on: July 24, 2013, 11:43:24 pm »
Perhaps replacing the graphics part of things with
Taazz' port of SimpleGraph would be useful:
Sorry, too complex for me. I give up.  %)
ct2laz - Conversion between Lazarus and CodeTyphon
bithelpers - Bit manipulation for standard types
pasettimino - Siemens S7 PLC lib

taazz

  • Hero Member
  • *****
  • Posts: 5368
Re: TStateMachine
« Reply #14 on: July 25, 2013, 07:49:55 am »
What is to complex? I can help with part of the work. What you need to do?
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

 

TinyPortal © 2005-2018