Sign in to follow this  
Followers 0
suthers

GUICtrlSetImage() producing corrupt image display

8 posts in this topic

Hi All,

My GUI App has Pic controls created by GuiCtrlCreatePic(). Their content can be selected by the user clicking on radio buttons. It was previously compiled under V3.2.1.4 and worked. Running or compiling under Beta V3.2.13.9 the images become corrupted when GUICtrlSetImage() is called to change them. Pixels are missing, carried over from the previous image, etc. Multiple changes of image don't help. The corruptions are reproducable, not random. If the GUI window is hidden, then shown, or minimised then maximised, then the corruptions disapear....until the next time GUICtrlSetImage() is called to change them and then they corrupt again.

The full script is 1168 lines long and won't work outside its installation environment, so I'll post snippits below. If the full code would be useful I can send it directly to interested parties.

;control creation
$30DayImagePicID = GUICtrlCreatePic(@ScriptDir & "\gold30dayinit.gif", $30DayImageLeftAlign, $TopAlignGraph30Day, 250, 155)
$LiveImagePicID = GUICtrlCreatePic(@ScriptDir & "\goldliveinit.gif", $LiveImageLeftAlign, $TopAlignGraphLive, 640, 400)

;image changing - this function is called when the user changes the radio buttons in the GUI
Func UpdateGUIWithNewGraphs()
    If $ActiveGraphType = "gold" Then
        GUICtrlSetImage($30DayImagePicID, $GraphGold30dayFileAndPath)
        GUICtrlSetImage($LiveImagePicID, $GraphGoldLiveFileAndPath)
        FixCorruptedPicControls(); my workaround
    Else
        GUICtrlSetImage($30DayImagePicID, $GraphSilver30dayFileAndPath)
        GUICtrlSetImage($LiveImagePicID, $GraphSilverLiveFileAndPath)
        FixCorruptedPicControls(); my workaround
    EndIf
EndFunc  ;==>UpdateGUIWithNewGraphs

Func FixCorruptedPicControls(); this is my workaround for the new unicode autoit version which corrupts the image pic controls when changing pics
    GUISetState (@SW_HIDE,$MainGUIHandle)
    GUISetState (@SW_SHOW,$MainGUIHandle)
EndFunc

The workaround is not satisfactory as it introduces a BIG flicker (obviously).

Ideas?

Shalom

Bill

Share this post


Link to post
Share on other sites



suthers

From help:

If a picture is set as a background picture, as the other controls will overlap, it's important to disable the pic control: GuiCtrlSetState(-1,$GUI_DISABLE).

Share this post


Link to post
Share on other sites

suthers

It's not a background picture. They are actually being used as controls. They are clickable and trigger events. And there is no overlap with other controls.

Share this post


Link to post
Share on other sites

It's not a background picture. They are actually being used as controls. They are clickable and trigger events. And there is no overlap with other controls.

Can you post a small and working example to duplicate the problem?

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

Can you post a small and working example to duplicate the problem?

Mmmm...have thought about that and shuddered at trying to trim the code down to something neat & small. How do I include the images for the pic controls in the post? I'm at work at the moment, so no chance right now....

Edited by suthers

Share this post


Link to post
Share on other sites

Oh Wow Sundance :-) That looks like just what I need! I'll try it out & post back results. Give me a few days....

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