MobileWill Posted February 22, 2016 Report Posted February 22, 2016 I am using window in a container and the list box doesn't work right. I have it hidden and then visible when a button was pressed. The list box parent is the that page so not tied to any of the other containers that are on top. The issue is I can't interact with it once its displayed on top of the container that has a window in it. Any ideas? It won't even scroll. Must be a conflict with the window or maybe the pixmap? If I use the pixmap image as the drawing routine for the container do I need the window at all? Maybe if I remove the window then the list box will work.
Joel Bodenmann Posted February 22, 2016 Report Posted February 22, 2016 I am not quite sure whether I understand your current situation so please forgive me if I am giving a misleading answer. If you are using the image rendering routine of the container and you are using a pixmap instead of an image then you don't need an additional window to display the pixmap. If you are using the window for anything else then you obviously need it for that thing but the container doesn't require an additional window to use the image rendering routine (with or without using a pixmap as an image).
MobileWill Posted February 22, 2016 Author Report Posted February 22, 2016 Right now I am just loading the pixmap to the window. Tonight I can try using the pixmap as the draw routine of the container and remove the window.
Joel Bodenmann Posted February 22, 2016 Report Posted February 22, 2016 Yes, that would be the intended use. Simply assign gwinContainerDraw_Image() as the rendering routine for the container and pass gdispPixmapGetMemoryImage() as the image pointer to the custom parameter of the rendering routine. Should work out of the box and provide you with a lot of joy
MobileWill Posted February 22, 2016 Author Report Posted February 22, 2016 Then do I need to tell it to redraw once I update the pixmap?
Joel Bodenmann Posted February 22, 2016 Report Posted February 22, 2016 Yes, the container has no idea when the content of the pixmap changed. The pixmap is a glorified array of pixel values. It doesn't generate any events or similar. Just call gwinRedraw() once you want to redraw the container using the modified pixmap.
MobileWill Posted February 22, 2016 Author Report Posted February 22, 2016 Perfect. That way I can do all the updates I need to do and then do the redraw. Thanks for all the help.
MobileWill Posted February 23, 2016 Author Report Posted February 23, 2016 I am a bit confused. Once you set the image as the draw routine. How do you link it to the pixmap object? For the container I have wi.customDraw = gwinContainerDraw_Image; wi.customParam = gdispPixmapGetMemoryImage; If I want can I set the custom draw later instead of on creation of the widget using gwinSetCustomDraw?
MobileWill Posted February 23, 2016 Author Report Posted February 23, 2016 Do I have to make sure the pixmap is setup before creating the container? Any chance I can get a simple example of setting up the container? I am trying to leave the studio code untouched and then update the container after. I have tried both ways.
Joel Bodenmann Posted February 23, 2016 Report Posted February 23, 2016 8 hours ago, MobileWill said: If I want can I set the custom draw later instead of on creation of the widget using gwinSetCustomDraw? Yes, you can. Both the custom rendering routine as well as the custom parameter passed to that routine can be set either in the widget init struct or at any time during runtime using gwinSetCustomDraw(). 7 hours ago, MobileWill said: Any chance I can get a simple example of setting up the container? There you go: container_pixmap_example.zip This is what it should look like:
MobileWill Posted February 23, 2016 Author Report Posted February 23, 2016 (edited) Thanks. Looks like I was pretty close. But I am hitting GDISP_IMAGE_ERR_BADFORMAT. Which happened last night. It was unhanded exception and then finally got the GDISP_IMAGE_ERR_BADFORMAT. I know the surface works because I can Blit it and it shows correctly. I am PM you when my code in a bit. Edited February 23, 2016 by MobileWill
Joel Bodenmann Posted February 23, 2016 Report Posted February 23, 2016 Did you make sure that you enabled the native image format as well as the MEMFS for the GFILE module? Are you able to run the example I posted?
MobileWill Posted February 23, 2016 Author Report Posted February 23, 2016 I did enable both options in gfxconf.h I didn't try the example yet, I just made the changes to my code. (I did it while getting ready for work). I can try it tonight though.
MobileWill Posted February 24, 2016 Author Report Posted February 24, 2016 I found the issue. I forgot to increment the Max Files. I meant to do that and then forgot about it. But now my 2nd pixmap is failing.I can say its supper fast having the container handling the image drawing.
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