wctltya Posted February 21, 2017 Report Share Posted February 21, 2017 How can I change(replace) the image(run time) of an Image Button widget? Its not about the button states enabled/pressed/disabled, but the complete image. Assuming the new image is already opened in gdispImage imageNew for example. And the same question for Image Box widget? Whether just opening the new image gwinImageOpenFile(ghImageBox, "newImage.gif") is enough? Link to comment Share on other sites More sharing options...
Joel Bodenmann Posted February 21, 2017 Report Share Posted February 21, 2017 Assuming that you're using the built-in image button rendering function of the button widget you just pass a different gdispImage* pointer via the custom parameter to the rendering function. The button widget doesn't store the pointer to your image at all, it just takes the custom parameter of the rendering function and casts it to (gdispImage*) that's all. Therefore, changing the image works like this: gwinSetCustomDraw(ghMyButton, gwinButtonDraw_Image, &myNewImage); With the images of the list box widget it's a different story because the image is actually being stored as part of the list item object. Changing the image is simply a matter of using the corresponding high-level API that has been added exactly for this: gwinListItemSetImage(ghMyImage, 0, &myNewListItemImage); Link to comment Share on other sites More sharing options...
wctltya Posted February 21, 2017 Author Report Share Posted February 21, 2017 Thank you Joel. Works fine. 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