forum.vdsworld.com Forum Index forum.vdsworld.com
Visit VDSWORLD.com
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


Mouseover problem with bitmaps

 
Post new topic   Reply to topic    forum.vdsworld.com Forum Index -> General Help
View previous topic :: View next topic  
Author Message
Hortalonus
Valued Contributor
Valued Contributor


Joined: 15 Mar 2002
Posts: 344
Location: Western USA

PostPosted: Thu Mar 06, 2003 5:39 am    Post subject: Mouseover problem with bitmaps Reply with quote

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
View user's profile Send private message Send e-mail
SnarlingSheep
Professional Member
Professional Member


Joined: 13 Mar 2001
Posts: 759
Location: Michigan

PostPosted: Thu Mar 06, 2003 6:09 am    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail
Hortalonus
Valued Contributor
Valued Contributor


Joined: 15 Mar 2002
Posts: 344
Location: Western USA

PostPosted: Thu Mar 06, 2003 6:16 pm    Post subject: Reply with quote

Thanks SnarlingSheep! Smile

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
View user's profile Send private message Send e-mail
SnarlingSheep
Professional Member
Professional Member


Joined: 13 Mar 2001
Posts: 759
Location: Michigan

PostPosted: Thu Mar 06, 2003 6:34 pm    Post subject: Reply with quote

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 Smile) and the bitmaps and when I get the chance I will fix it up for you.

_________________
-Sheep
My pockets hurt...
Back to top
View user's profile Send private message Send e-mail
Hortalonus
Valued Contributor
Valued Contributor


Joined: 15 Mar 2002
Posts: 344
Location: Western USA

PostPosted: Thu Mar 06, 2003 8:33 pm    Post subject: Reply with quote

Laughing Laughing Laughing Laughing Laughing

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! Smile
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic   Reply to topic    forum.vdsworld.com Forum Index -> General Help All times are GMT
Page 1 of 1

 
Jump to:  
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

Twitter@vdsworld       RSS

Powered by phpBB © 2001, 2005 phpBB Group