mr.underperson Posted May 8, 2006 Share Posted May 8, 2006 (edited) Here's the problem. I have a GUI, and on it is a small graphic indicating that some condition is OK.It's a preference dialog, and if the user changes the data, the function rechecksto see it's still okay. So far so good.When the control is first created, the function is called for an initial check:$my_img = GUICtrlCreateIcon(@ScriptDir & "\my.dll", 1, 10, 10, 16, 16) DoTheChange()This works great, and the "OK" icon is displayed at 16x16. (I don't know how AutoIt knows I want to use the small icon, but I presume it realises that at 16x16, only the small one would fit.)The trouble comes when I update later. Instead of the small icon being displayed, I get the large version (even if I use a dll with only a small version, it simply enlarges it!) so only the top-left corner is seen. pseudo-code:func DoTheChange() $icon = 1 if $somecondition then $icon = 2; icon index in dll endif GUICtrlSetImage($my_img, @ScriptDir & "\my.dll", $icon, 0) endfuncIf I resize the window, or switch to another application and back, it displays perfectly (and at the correct size), but not when initially changed, i.e. when the user changes the data and wants to see the result. That's when I want to see it, too! It's like the gui needs to be "refreshed", but I can't find a function for that.I've tried simply recreating the control, and that works fine, but because it's on a tab, it now shows through all the tabs, so I'm stuck using GUICtrlSetImage() which doesn't update correctly. I know that resizing the window and back quickly would work, but really, I'd rather not go there. Is there a trick?-mu Edited May 8, 2006 by mr.underperson Link to comment Share on other sites More sharing options...
Thatsgreat2345 Posted May 8, 2006 Share Posted May 8, 2006 probaly cuz ur trying to use a dll as a picture ? Link to comment Share on other sites More sharing options...
mr.underperson Posted May 9, 2006 Author Share Posted May 9, 2006 it's icons, inside the dll. -mu Link to comment Share on other sites More sharing options...
Valuater Posted May 9, 2006 Share Posted May 9, 2006 try GUICtrlSetState ( controlID, state ) use, focus, show... try them all inside the function 8) Link to comment Share on other sites More sharing options...
Thatsgreat2345 Posted May 9, 2006 Share Posted May 9, 2006 one thing is im not sure if you can actualy do that and use a .dll , as an icon image even though it may be inside it, is it a custom .dll image? or the default one set by the system, if its custom id advise checking out reshack which would allow you to get the icon out Link to comment Share on other sites More sharing options...
mr.underperson Posted May 9, 2006 Author Share Posted May 9, 2006 nonono thatsgreat2345! that part works fine. The function is, in fact, specifically for working with icon resources, hence the "iconID" parameter. GUICtrlSetState! YES!That works!A quick $GUI_SHOW after flipping the icon does the trick, thanks Valuater!-mu Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now