Use of Space Gadget with Graphics Primitives?

5 posts / 0 new
Last post
tbreeden
tbreeden's picture
Offline
Last seen: 4 years 2 months ago
Joined: 2010-12-09 03:10
Use of Space Gadget with Graphics Primitives?
I'd like to create a window with some Reaction string gadgets, buttons, and a fuelgauge at the top, and draw into the rest of the window with Graphics library calls. eg, something like a spreadsheet with control gadgets, but the cells drawn rather than constructed with gadgets. It looks like the Reaction Space gadget is designed to be used for something like this, but I'm having trouble understanding how to use it that way. I can't simple use the window's RastPort with calls to IGraphics.Move(), Draw(), Text(), because it seems that even a "transparent" Space Gadget resides in a Layout that tends to backfill away anything there. Is there a way to stop any rendering into the area of the Space gadget? I can create a SPACE_RenderHook and render upon Update from Intuition and/or call RefreshGList() when I make a change to the sheet, but am not sure how to avoid having to redraw all of the sheet every time the hook is called - set up my own clip regions? The Space gadget example in the SDK does not do anything more than just display its area box values. Any suggestins or pointers appreciated. Thanks, Tom
thomas
thomas's picture
Offline
Last seen: 3 days 5 hours ago
Joined: 2011-05-16 14:23
I am not sure if I understand
I am not sure if I understand your problem. As long as nobody touches your window, the space gadget remains untouched, too, so you can just draw into it. And if the user changes the size of the window, the size of the space area changes, too, and you have to redraw everything anyway. If you want to avoid flicker, you could draw into an off-screen bitmap and then blit the bitmap into the window. Here is an example: http://thomas-rapp.homepage.t-online.de/examples/diagram.c
tbreeden
tbreeden's picture
Offline
Last seen: 4 years 2 months ago
Joined: 2010-12-09 03:10
I am not sure if I understand
I am not sure if I understand your problem. As long as nobody touches your window, the space gadget remains untouched, too, ... If you want to avoid flicker, ...
Ahh, I think I see how it goes now. Many thanks for the complete example. It works very nicely. I tried various alternatives to see what effect they had. I found that setting SPACE_Transparent to TRUE pretty much eliminated all flicker even without double buffering, for this example. Adding a WaitTOF() to the hook procedure might have helped too, but not so obviously. I did have trouble when I tried to use SPACE_AreaBox to get the inner area when using a SPACE_BevelStyle other than none. GetAttr() seemed to work, but the IBox values did not make any sense. GetAttrs() for GA_LEFT,GA_TOP, GA_WIDTH,GA_HEIGHT did work fine, but included the bevel in those values, making it hard not to RectFill() over the bevel. The main flicker occurred when the user is resizing the window, because so many WMHINewSize messages come in so quickly. I could not find any Reaction "interim sizing" flag or anything, but it would seem that it would make sense not to refresh the contents until the user was finished resizing. Tom
thomas
thomas's picture
Offline
Last seen: 3 days 5 hours ago
Joined: 2011-05-16 14:23
I changed the example to use
I changed the example to use SPACE_AreaBox instead of the object's coordinates. Regarding newsize, I don't know if it helps, but you can receive an IDCMP_SIZEVERIFY when the user hits the size gadget. Perhaps you can then check the IntuiMessage->Qualifier field to see if the button is still pressed. (But be aware that moving the mouse with the keyboard does not set IEQUALIFIER_LBUTTON).
tbreeden
tbreeden's picture
Offline
Last seen: 4 years 2 months ago
Joined: 2010-12-09 03:10
I changed the example to use
I changed the example to use SPACE_AreaBox instead of the object's coordinates.
Thanks. I was convinced that I should put into the TagData a pointer to an IBox in my code, and that the GetAttrA() would copy the limits into that. Seems like that's the way some of the other get attrs for IBoxes work, like WA_WindowBox, and WA_Zoom. But using SPACE_AreaBox its own way seems to be what I wanted - if the Space gadget has a bevel, that is preserved using these limits. BTW, I am working in Modula-2. If you are interested in seeing the translation, I put it into the "my source codes" section here.
Regarding newsize, I don't know if it helps, but you can receive an IDCMP_SIZEVERIFY when the user hits the size gadget. Perhaps you can then check the IntuiMessage->Qualifier field to see if the button is still pressed.
Did not think there was any built-in way. Tom
Log in or register to post comments