Sign in to follow this  
Followers 0
erebus

Picture controls

5 posts in this topic

Hello,

I have a GUI and I want every 5 seconds a picture to rotate on it and after the last picture displays to start all over again. What I did to accomplish this was to create an empty GuiCtrlCreatePic control and then modify its data using GuiCtrlSetImage function.

However, I noticed that every time I used the GuiCtrlSetImage function, the program occupied 4-6% CPU instantly (for a second or less) not to mention some flickering (regardless of the fact that the image was resized or not). This behavior and the fact that in this way the program would read the hard disk for the image's data endlessly, made me start thinking of an image caching scenario. Here are my thoughts/tests so far:

1) Instead of reading again and again the files and just changing the control's data, design all the controls the first time and hide/show the appropriate control each time, accordingly. Pros: Less CPU time (not more than 2% instead of 6% on my system). Cons: More flickering when hiding/showing.

2) Design all the controls one above the other and play with the $GUI_ONTOP attribute. Cons: A lot of flickering (and didn't manage to make it work properly).

3) Use FileRead to read each image's contents, store them in variables and use a function (?) to feed the control (GuiCtrlSetData or GuiCtrlSetImage don't work). Didn't manage to make it work at all.

So any ideas or any direction of how to accomplish this, would be more than welcome. I want to mention again that the aim is triple: Less possible flickering, less I/O traffic, less CPU time needed.

Thank you,

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Main problem is in GUICtrlSetImage() wich is cause of flickering, search my posts about flickering on this forum, especially this one.

See my Radar project in my signature. It's doing exactly the same as you need, display 6 GIF pictures in endless loop by GUICtrlSetImage. It has flickering, I didn't make workaround for it still.

But now when I'm working on using data from resouces (also pictures) I discovered STM_SETIMAGE message. It can be used instead of (flicker buggy) GUICtrlSetImage maybe. Look at my Add and use binary data to/from resources post

Edited by Zedna

Share this post


Link to post
Share on other sites

Very nice example, thank you. I will check it out for sure! :)

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

I'm thinking about some other ways for GUICtrlSetImage flickering worlaround.

Now when CallBack was introduced (as UDF) it may be used for subclassing which maybe can be the right way for some workaround.

Maybe sometimes in the future I will play with it ...

EDIT:

But I think GUICtrlSetImage flickering is Autoit bug

and the best solution would be if Autoit developers could make fix for this.

Edited by Zedna

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

I'm thinking about some other ways for GUICtrlSetImage flickering workaround.

Here is ultimate Auto3Lib & GDI+ alternative for GUICtrlSetImage()

I think this will not flicker.

EDIT: Maybe as HWnd can be used also GUICtrlGetHandle() for existing picture control

Edited by Zedna

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0