Does Maxgui draw a panel twice after setshape?
BlitzMax Forums/MaxGUI Module/Does Maxgui draw a panel twice after setshape?
| ||
What I want to ask is: If panel A. is created onto panel B., with all sides aligned, and I do a SetGadgetShape panel B., followed by a SetGadgetShape panel A., does Maxgui draw panel A. twice? And (more importantly): if so, can this be prevented? |
| ||
If panel A. is created onto panel B., with all sides aligned, and I do a SetGadgetShape panel B., followed by a SetGadgetShape panel A., does Maxgui draw panel A. twice? Yes. But why would you do a SetGadgetShape for both, if all sides are aligned? If there is nothing special going on it would be enough to resize the parent. |
| ||
@jsp Indeed, something special is going on. ;) In panel A I have a bunch of buttons and whatnot, and via a hook I monitor the size of Panel B and draw A in a different shape and position, when certain size-conditions of B are met. So I want A to resize with its Parent, but not in the same rate. I figured that an other layout of the edges wouldn't make a difference? Or does it work in such a way, that Panel A is not redrawn by Maxgui if its shape is independent of B? (EDGE_CENTERED?) |
| ||
It depends a how the gadgets on top look like and their position. Do you may have a picture before and after? |
| ||
I have no pictures, because I haven't finished this part yet. But it's not that difficult. Imagine a large panel and a smaller panel inside, filled with square buttons. The small panel needs to stay as snug as possible around its content. So if the large panel stretches its width, the small one does also, until there is enough room for the buttons to fill the gab, and get re-aranged to the bottom left or right. At witch point the topside of the small panel drops until it hits the top of the highest buttons. (it also works the other way around) So if I resize the large panel, change the shape of the small one and re-arange the buttons, are the buttons drawn three times? |
| ||
I'm sorry, but all align stuff is only meant to adjust the position or size depending of the parent size and it will only align, relative or center to a certain edge. From what I read you want it to jump into a new position, the gap, and that is not possible by SetGadgetLayout. You have to do it by code, calculate the gap and then reposition the button. But maybe you do that already and just don't want the buttons moving while the gap gets bigger, then use SetGadgetLayout and fix one corner of the buttons, for example the bottom left. Align to bottom left and leave the other edges centered, the gap will then appear on the right side. And yes the buttons may drawn 3 times, but that does not have to be a problem, you need to check if it flickers too much. |
| ||
http://blitzbasic.com/Community/posts.php?topic=97491 There are two commands for enable and disable gadget repainting in windows. You may have some use for them! |
| ||
@JSP Thanks for your explanation. I've coded my "practice-runs" more or less the way you describe in your advice. It flickered enough to be needing a warning for a possible epileptic attack, if watched for more than 5 minutes. HA! @Jon Wow! This works like a charm! |
| ||
Good stuff! A note though, those commands are windows only. On the mac you shouldn't need to worry about it as rendering is handled differently. |