Forum > Graphics

Flickering or what?

(1/8) > >>

phoenix27:
In the attached video(i had to keep it within the maximum admitted size so the quality is not good) you can see the problem. When i scroll up or down there is flickering(is that the way it's called?) on the top or bottom edge.  The images are painted in a TPanel contained in a TScrollBox contained into a TTabSheet contained in a TPageControl. I did set the doubleBuffered property of Tpanel and TScrollBox to true but it didn't help. I just do not know how to solve it. Does somebody have any idea?

wp:
It would be better if you'd prepare a small demo project showing the issue. Pack the .pas, .lfm, .lpi and .lpr files into a shared zip which you can upload here (do not add files generated by the compiler because this may exceed the upload size limit). Specifiy the size and count of the images to be displayed so that I can use similar images of my own. Do not upload your full project, remove everything needed, ideally begin a new project from scratch - please understand that I am not inclined to debug a huge project which i do not understand.

phoenix27:
Thank you for you answer. I thought that too although it will require a bit of work because my programming style is messy, to say the least. But from just watching the video did you get any idea on what it could be? I tried, using the same algorithm(only translated to c++) with wxWidgets and c++ and it works well, no flickering. Keep in mind that the images are not TImage instances, they are painted in the onpaint event of the TPanel.A while ago i tried to translate the program in Delphi but using TImage for the images and it worked well. Anyway i'll try to make a little project.

wp:

--- Quote from: phoenix27 on November 13, 2023, 07:16:51 pm ---But from just watching the video did you get any idea on what it could be?

--- End quote ---
No, I did not even see any flicker at all...

440bx:

--- Quote from: phoenix27 on November 13, 2023, 06:35:54 pm ---When i scroll up or down there is flickering(is that the way it's called?) on the top or bottom edge.  The images are painted in a TPanel contained in a TScrollBox contained into a TTabSheet contained in a TPageControl. I did set the doubleBuffered property of Tpanel and TScrollBox to true but it didn't help. I just do not know how to solve it. Does somebody have any idea?

--- End quote ---
My knowledge of TPanel, TScrollbox and other LCL controls is nil but, I'm going to presume you're doing this app in Windows.

What happens is that somewhere in all that code (whatever LCL code controls/does the scrolling) when scrolling happens the bottom part (which got scrolled up) is cleared by the default window handler.    The way to avoid the flickering is to have the background _not_ be cleared when the window is scrolled up.   The easiest way is to have a WM_BACKGROUND message handler that returns "true" indicating the newly exposed part of the window has been erased (even though it hasn't been) and then "overwritten" with the new part of the image (which you are doing but, you are overwriting the cleared background instead of what's left there of the old piciture.)

As far as where in the LCL the WM_BACKGROUND should be processed, I simply don't have a clue.  (I only know pure Windows API and message handlers.)

HTH.



--- Quote from: wp on November 13, 2023, 07:34:37 pm ---
--- Quote from: phoenix27 on November 13, 2023, 07:16:51 pm ---But from just watching the video did you get any idea on what it could be?

--- End quote ---
No, I did not even see any flicker at all...

--- End quote ---
I think he is referring to the slight amount of flicker visible at the bottom of the screen window when the images are scrolled up.

Navigation

[0] Message Index

[#] Next page

Go to full version