I have a panel, and I want to know if the mouse enters it.
I thought I had a clever solution for this...
MouseX(Panel) would be less than 0 if the mouse was to the left of the panel, and greater than the width of the panel if it was to the right of it.
But Blitz won't allow me to use a Panel with MouseX. It will only allow me to use a Canvas, or nothing, which basically leaves me with screen coordinates.
Now, my panel has a canvas INSIDE it, but the canvas can scroll around, and change scale. Oy, would it be a pain to try to base my mouse being in my panel on that. Especially if I decided to do something crazy like use more than one canvas in my panel and scrolling them all around together.
So I can get the mouse position on the screen. Okay, that's not so bad. I'll just get the position of the panel on the screem and it's width and... CRAP!
Why is there no way to get the position of a panel on the screen?
Oh sure, there's a way to get the position of a panel inside the client space of it's parent gadget. But what have I got to do here, step back through all the parents of each gadget calculating its position in the client area of its parent, and take into account the size of the parent, minus the size of the client area of the parent to calculate the correct coordinates...
HEADACHE!
All I want to do is know if my mouse is in a certain region! A region which resizes automatically with the window.
I could create a canvas, but the draw order of gadgets if I can even control it seems backward (Gadgets created last are drawn first? Huh?) and it would probably slow my app down.
So what option do I have left? Creating a simple MouseOver(Gadget) function seems out of the question what with all the recursion crap. Too much trouble. So I am left with one option, and that is to try to manually code this for this one specific case taking into account the parents I know the panel has.
Maybe I should check the code archives first though and see if someone else has solved this.
I thought I had a clever solution for this...
MouseX(Panel) would be less than 0 if the mouse was to the left of the panel, and greater than the width of the panel if it was to the right of it.
But Blitz won't allow me to use a Panel with MouseX. It will only allow me to use a Canvas, or nothing, which basically leaves me with screen coordinates.
Now, my panel has a canvas INSIDE it, but the canvas can scroll around, and change scale. Oy, would it be a pain to try to base my mouse being in my panel on that. Especially if I decided to do something crazy like use more than one canvas in my panel and scrolling them all around together.
So I can get the mouse position on the screen. Okay, that's not so bad. I'll just get the position of the panel on the screem and it's width and... CRAP!
Why is there no way to get the position of a panel on the screen?
Oh sure, there's a way to get the position of a panel inside the client space of it's parent gadget. But what have I got to do here, step back through all the parents of each gadget calculating its position in the client area of its parent, and take into account the size of the parent, minus the size of the client area of the parent to calculate the correct coordinates...
HEADACHE!
All I want to do is know if my mouse is in a certain region! A region which resizes automatically with the window.
I could create a canvas, but the draw order of gadgets if I can even control it seems backward (Gadgets created last are drawn first? Huh?) and it would probably slow my app down.
So what option do I have left? Creating a simple MouseOver(Gadget) function seems out of the question what with all the recursion crap. Too much trouble. So I am left with one option, and that is to try to manually code this for this one specific case taking into account the parents I know the panel has.
Maybe I should check the code archives first though and see if someone else has solved this.