| View previous topic :: View next topic |
| Author |
Message |
Hortalonus Valued Contributor


Joined: 15 Mar 2002 Posts: 344 Location: Western USA
|
Posted: Thu Mar 06, 2003 5:39 am Post subject: Mouseover problem with bitmaps |
|
|
| I know this mouseover trick has been hashed and rehashed before... but I am having trouble adapting any of the existing mouseover examples to use with bitmap elements. I want to be able to hide and show differnent bitmaps when the mouse is placed over a visible bitmap. This one has really got me stumped... anyone have success doing this that could point me in the right direction? |
|
| Back to top |
|
 |
SnarlingSheep Professional Member


Joined: 13 Mar 2001 Posts: 759 Location: Michigan
|
Posted: Thu Mar 06, 2003 6:09 am Post subject: |
|
|
Here's a quick example that should help you out.
| Code: |
OPTION DECIMALSEP,"."
%%BmpX = 0
%%BmpY = 0
%%BmpW = 100
%%BmpH = 100
%%BmpOff = "C:\WINDOWS\Bubbles.bmp"
%%BmpOn = "C:\WINDOWS\Circles.bmp"
Title Bitmap Mouseover
DIALOG CREATE,Bitmap Mouseover,-1,0,240,160
DIALOG ADD,BITMAP,Bitmap,%%BmpX,%%BmpY,%%BmpW,%%BmpH,%%BmpOff,,STRETCH
REM *** Modified by Dialog Designer on 3/6/2003 - 00:47 ***
DIALOG SHOW
REM Use %%Over variable so bitmap doesn't continually update if mouse isn't over BMP
%%Over = No
:Timer
REM Find Window position to subtract from Mouse position
%%WinX = @WINPOS("Bitmap Mouseover",L)
%%WinY = @WINPOS("Bitmap Mouseover",T)
REM Add 25 for titlebar of Window
%%WinY = @FADD(%%WinY,25)
%%MouseX = @FSUB(@MOUSEPOS(X),%%WinX)
%%MouseY = @FSUB(@MOUSEPOS(Y),%%WinY)
REM See if Mouse is past top and left
IF @BOTH(@GREATER(%%MouseX,%%BmpX),@GREATER(%%MouseY,%%BmpY))
REM Make sure Mouse is not past bottom and right
IF @BOTH(@NOT(@GREATER(%%MouseX,%%BmpW)),@NOT(@GREATER(%%MouseY,%%BmpH)))
IF @EQUAL(%%Over,No)
DIALOG SET,Bitmap,%%BmpOn
%%Over = Yes
END
ELSE
IF @EQUAL(%%Over,Yes)
DIALOG SET,Bitmap,%%BmpOff
%%Over = No
END
END
ELSE
IF @EQUAL(%%Over,Yes)
DIALOG SET,Bitmap,%%BmpOff
%%Over = No
END
END
:Evloop
wait event,0.1
goto @event()
:Close
exit
|
_________________ -Sheep
My pockets hurt... |
|
| Back to top |
|
 |
Hortalonus Valued Contributor


Joined: 15 Mar 2002 Posts: 344 Location: Western USA
|
Posted: Thu Mar 06, 2003 6:16 pm Post subject: |
|
|
Thanks SnarlingSheep!
Your code works really good... the only problem I have is that my dialog is completely skinned with multiple bitmaps. I can't seem to modify your example to work with the 9 bitmap buttons I have. My objective is to have the button highlighted and the cursor change to a hand when the mouse is over the bitmap button, and then back again when it is moved away. I don't want to use BitButtons because they don't have a transparent style to use when you put them on top of a bitmap background. |
|
| Back to top |
|
 |
SnarlingSheep Professional Member


Joined: 13 Mar 2001 Posts: 759 Location: Michigan
|
Posted: Thu Mar 06, 2003 6:34 pm Post subject: |
|
|
Well for the cursor problem you should be able to add in the HAND style on the bitmaps you would like it on.
As for the rest, if you want you can e-mail me your code(or a rough draft of it if it's top secret ) and the bitmaps and when I get the chance I will fix it up for you. _________________ -Sheep
My pockets hurt... |
|
| Back to top |
|
 |
Hortalonus Valued Contributor


Joined: 15 Mar 2002 Posts: 344 Location: Western USA
|
Posted: Thu Mar 06, 2003 8:33 pm Post subject: |
|
|
Ha! I can't believe I forgot the HAND style for the bitmaps! Thanks for the reminder... as for the code I will email it to you soon along with the bitmaps. Thanks very much for your help!  |
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You can attach files in this forum You can download files in this forum
|
|