Trouble Redrawing Controls

BlitzPlus Forums/BlitzPlus Programming/Trouble Redrawing Controls

Alaric(Posted 2007) [#1]
I'm working on a program that needs to show which control that the user has selected currently. To do this I draw a red box around the gadget using setbuffer(desktopbuffer()). However, I have no good way to get rid of the red box once I draw it. I've been trying to use USER32.DLL userlib commands for quite a while, but for the life of me I can't figure out how to get a control to redraw itself to remove this red box. My latest attempt has been to add this line to my program

RedrawWindow(QueryObject(mainwin,1),0,0,1+256+128) ;This means that RDW_ALLCHILDREN(128), RDW_INVALIDATE(1), And RDW_UPDATENOW(256) are set

I have the userlib installed correctly, (I'm pretty sure at least) but this command causes a crash whenever I run the program. Can anyone tell me why this command crashes the program? Here's a link to the msdn command page. http://msdn2.microsoft.com/en-us/library/aa921313.aspx


Petron(Posted 2007) [#2]
You could use a canvas and load each gadget as an image.


Alaric(Posted 2007) [#3]
Yeah, I know that I could. The problem is that I've already got the program very far by just creating the actual gadgets and it would be much easier just to use a userlib function to redraw the dirty gadgets.


Petron(Posted 2007) [#4]
This is a stupid question, but what does your signature mean?


Alaric(Posted 2007) [#5]
I asked a girl out a couple of weeks ago, and being the geek that I am, I looked up the DNA sequence for a rose online and sent it to her. That's the first 100 nitrogen bases (there are four, adenine, thymine, cytosine, and guanine) that make up the DNA of a rose. I guess I don't make it all that clear in the sig.


William Drescher(Posted 2007) [#6]
When you call the user32.dll command, try calling it like this:

RedrawWindow(QueryObject(mainwin,1),0,0,1 Or 256 Or 128)

or

Const RDW_ALLCHILDREN = 128
Const RDW_INVALIDATE = 1
Const RDW_UPDATENOW = 256

RedrawWindow(QueryObject(mainwin,1),0,0,RDW_INVALIDATE Or RDW_UPDATENOW Or RDW_ALLCHILDREN)


Let me know what happens.


Alaric(Posted 2007) [#7]
Sorry, no good. It still crashes with a "blitzcc.exe has encountered a problem and needs to close. We are sorry for the inconvenience." The only thing that I can think up would be to make a dll that calls it, but... I have yet to figure out how to do that.


Alaric(Posted 2007) [#8]
Another thing that I've tried was to use sendmessageA and WM_PAINT (As well as WM_NCPAINT and WM_PRINT) to refresh the control, but blitz doesn't seem to respond to these messages at all! Is there some reason that these messages don't seem to work in blitz? You'd think that this would be seen as a major glitch in Blitz because if this is missing, then what other messages are?