Recent

Author Topic: Changing pictures after reaching value on the TImage component  (Read 10281 times)

mm7

  • Full Member
  • ***
  • Posts: 193
  • PDP-11 RSX Pascal, Turbo Pascal, Delphi, Lazarus
Re: Changing pictures after reaching value on the TImage component
« Reply #15 on: March 13, 2015, 07:30:54 pm »
Next thing I'd like to achieve is to make proper counters which will show separately how many seats are free (counting green images of seats) or not (red image of seat).
gromar, it is not clear what are you trying to achieve?
An image of a bus with seats, each painted red/green depending on their booking status? or something else?

engkin

  • Hero Member
  • *****
  • Posts: 2513
Re: Changing pictures after reaching value on the TImage component
« Reply #16 on: March 13, 2015, 07:56:10 pm »
Neither link is meant to give a comprehensive list of accepted extensions/types, but Graphics.GetGraphicClassForFileExtension can give a class ...
Thank you for the example. I see that lots of formats are actually supported.
And if this support has been added time ago, and well tested, then why not to update the documentation?

I believe the question is "who will update the documentation?". Remember it's open source project and the answer is simple: the community (read you, me and others). If enough people volunteer then we will have enough people to update the documentation. Take a look at the bugtracker, for instance.

From what you are saying I see that this approach does not apply to FPC/Lazarus. Then how to be sure that some new cool feature I use today, will not change tomorrow, and something will stop compile or work?

Usually a better method gets introduced before removing the older one, and the trend is to try not to break older working code. When changes are needed then they are mentioned in rge wiki like User Changes.

What I mentioned here is just my own opinion and observation.

mm7

  • Full Member
  • ***
  • Posts: 193
  • PDP-11 RSX Pascal, Turbo Pascal, Delphi, Lazarus
Re: Changing pictures after reaching value on the TImage component
« Reply #17 on: March 13, 2015, 08:19:27 pm »
I believe the question is "who will update the documentation?".
I understand that it is community based product. My question was rather regarding a "philosophy" of it - what to believe - the code or the docs? I see that the answer is - Believe the code. Docs are secondary.
Fair enough.

Usually a better method gets introduced before removing the older one, and the trend is to try not to break older working code. When changes are needed then they are mentioned in rge wiki like User Changes.
Thanks! I'll try to remember.

gromar

  • New member
  • *
  • Posts: 7
Re: Changing pictures after reaching value on the TImage component
« Reply #18 on: March 16, 2015, 09:54:06 am »
Next thing I'd like to achieve is to make proper counters which will show separately how many seats are free (counting green images of seats) or not (red image of seat).
gromar, it is not clear what are you trying to achieve?
An image of a bus with seats, each painted red/green depending on their booking status? or something else?
Hello,

exactly that's the thing I'd like to achieve. My visualization shows booking status of seats in the bus. You can see whole bus with seats which should change colours and also numbers of free/ busy seats below the main picture. For example: at first there are 42 free green seats so we can see text: "42 free"; "0 busy". Let's say 2 people will sit on two seats. Main pic will change: there will be 40 seats green and 2 red one. Same with the text below: "40 free" and "2 busy".

taazz

  • Hero Member
  • *****
  • Posts: 5365
Re: Changing pictures after reaching value on the TImage component
« Reply #19 on: March 17, 2015, 06:24:46 am »
here take this sample and add the rest of the seats and the editors.
http://sourceforge.net/projects/codelibrarian/files/Pre_Release/various/BusSeats.zip/download
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

gromar

  • New member
  • *
  • Posts: 7
Re: Changing pictures after reaching value on the TImage component
« Reply #20 on: May 06, 2015, 01:23:10 pm »
Thank you for the code - it helped me a lot with my project. Still I have some questions how to finialize it:

- I can't get the exactly number of seats which are free /busy on visualization ( I would like to see counter which will show how many seats are free and another counter which will show how many seats are busy );
- this part can be tricky - I'm also trying to synchronize signals from bananaPi computer with the visualization. Example: each sensor (which is hidden in each seat) is wired with one module box which is next connected with BananaPi and on this computer user has got the visualization which we are trying write here. All is connected via CAN bus. Using CAN bus with sensors allow you to set separate adress to each seat with sensors. The main goal I'd like to achieve is to pair visualization with those sensors using CAN bus. Has anyone tried earlier to read signals from BananaPI (RX, TX and CANL, CANH) and then make them visualized on screen using Delphi language. I tried to get information on BananaPi forums but unfortunately with no luck :(

In link below I send my actual version of my project.
http://speedy.sh/2fxCC/bus-seats201505061219.tar

Thanks in advance for any information.

User137

  • Hero Member
  • *****
  • Posts: 1791
    • Nxpascal home
Re: Changing pictures after reaching value on the TImage component
« Reply #21 on: May 07, 2015, 04:14:15 am »
You have the data in some kind of arrays? It should be simple task to go through them in a for-loop.

Do not try to read information from visualization, read it from the data itself. Because visualization is also drawn based of the data.

gromar

  • New member
  • *
  • Posts: 7
Re: Changing pictures after reaching value on the TImage component
« Reply #22 on: May 11, 2015, 02:06:05 pm »
Hi again!

I managed to synchronize signals from module box (CAN bus line) to BananaPi using TI SN65HVD230D transceiver. I got information from each ID seat section per one frame (seats 1-32 , 33-64 and status of each seat - free, taken, error and not available). I attach image example of frames I get using ./receive command with can4linux and table content of all ID frames. I wonder how I can next visualize all the process in Delphi. How should I attribute exact frame (from RX/TX signals of BananaPI gpio)  to a correct color and number of seat graphic icon. Thank you in advance for each tip :)

Example:

0.167986     938/0x000003aa : bD  ( 8 ): 00 fc ff ff ff ff ff 3f - noone is sitting
0.167963     938/0x000003aa : bD  ( 8 ): 01 fc ff ff ff ff ff 3f - seat no 1 is taken/ busy
0.167972     938/0x000003aa : bD  ( 8 ): 04 fc ff ff ff ff ff 3f - seat no 2 is taken/ busy
0.167973     938/0x000003aa : bD  ( 8 ): 10 00 fc ff ff ff ff 3f - seat no 3 is taken/busy
0.167973     938/0x000003aa : bD  ( 8 ): 40 00 fc ff ff ff ff 3f - seat no 4 is taken/busy
0.167981     938/0x000003aa : bD  ( 8 ): 00 01 fc ff ff ff ff 3f - seat no 5 is taken/busy
0.168021     938/0x000003aa : bD  ( 8 ): 00 04 fc ff ff ff ff 3f - seat no 6 is taken/busy
0.167986     938/0x000003aa : bD  ( 8 ): 00 10 fc ff ff ff ff 3f - seat no 7 is taken/busy
0.167988     938/0x000003aa : bD  ( 8 ): 00 40 fc ff ff ff ff 3f - seat no 8 is taken/busy
0.168017     938/0x000003aa : bD  ( 8 ): 00 00 fd ff ff ff ff 3f - seat no 9 is taken/busy

0.168023      938/0x000003aa : bD  ( 8 ): 00 00 fc ff ff ff ff 7f - seat no 32 is taken/busy
0.167001      939/0x000003ab : bD  ( 8 ): ff ff ff ff ff fc ff ff - seat no 53 is free
0.167023      939/0x000003ab : bD  ( 8 ): ff ff ff ff ff fd ff ff - seat no 53 is taken/busy

0.167992      938/0x000003aa : bD  ( 8 ): 00 01 fc ff ff ff ff 7f - seat no 5 & 32 are taken/ busy
0.167986      938/0x000003aa : bD  ( 8 ): 05 00 fc ff ff ff ff 3f - seat no 1 & 2 are taken/ busy
0.167965      938/0x000003aa : bD  ( 8 ): 40 01 fc ff ff ff ff 3f - seat no 4 & 5 are taken/ busy

0.167971      938/0x000003aa : bD  ( 8 ): 50 01 fc ff ff ff ff 3f - seat no 3, 4 and 5 are taken/busy
« Last Edit: May 11, 2015, 02:09:08 pm by gromar »

 

TinyPortal © 2005-2018