English Amiga Board


Go Back   English Amiga Board > Coders > Coders. Language > Coders. AMOS

 
 
Thread Tools
Old 01 January 2018, 08:35   #1
ricky500
Registered User
ricky500's Avatar
 
Join Date: Nov 2008
Location: New Hampshire, USA
Age: 32
Posts: 129
Highlighting Zones

I'm looking for a way to high light text zones when the mouse is moved over it and then un-highlight it when the mouse moves off it. (Like how a hyper text link will change color when you move the mouse over it in a browser)
ricky500 is offline  
AdSense AdSense  
Old 01 January 2018, 10:57   #2
Dan
Registered User
Dan's Avatar
 
Join Date: Nov 2004
Location: Germany
Posts: 376
Like this ?

PHP Code:
Screen Open 0,640,200,16,lowres Flash Off 
Reserve Zone 10
Dim LINK
(10,4) : Rem Link(x,0)=state/not used   x,1=x x,2=y x,3=x1 x,4=y1      
Dim LINKTEXT
$(10)

Reserve Zone 11

Double Buffer 
Bob Update Off 
Autoback 0

rem setting up zone

For X=1 To 10
   TXT
$="Text Zone"+Str$(X)
   
LINKTEXT$(X)=TXT$
   
   
LINK(X,0)=0
   LINK
(X,1)=10+(X*5)
   
LINK(X,2)=10+(X*8)
   
LINK(X,3)=LINK(X,1)+(Len(TXT$)*8) : Rem 8 means font width 
   LINK
(X,4)=LINK(X,2)+Rem 9 here is font height 8 1  

   Set Zone X
,LINK(X,1),LINK(X,2)-9 To LINK(X,3),LINK(X,4)-Rem -9 here adjust to how the text x,y,txtis rendered on y 

Next X

rem main loop
Repeat 
   Cls 
   MX
=X Mouse
   MY
=Y Mouse
   M
=Mouse Zone
   Ink 2
   Text 10
,9,"Zone Under cursor="+Str$(M)

rem draw text:
   For 
X=1 To 10
      Ink 2
      
If M=X Then Ink 4   rem if mouse is under zonedraw the text in red, else white will be drawn 
      Text LINK
(X,1),LINK(X,2),LINKTEXT$(X)
   
Next 
   
   Screen Swap 
Wait Vbl 
Until Mouse Key
=
For a bit faster version, without double buffering, add rem in front of :

PHP Code:
Double Buffer 
Bob Update Off 
Autoback 0

...

cls 
and change
PHP Code:
Text 0,9,"Zone Under cursor="+Str$(M
to

PHP Code:
Text 0,9,"Zone Under cursor="+Str$(M)+"  " 

Last edited by Dan; 01 January 2018 at 11:16.
Dan is online now  
Old 02 January 2018, 00:15   #3
ricky500
Registered User
ricky500's Avatar
 
Join Date: Nov 2008
Location: New Hampshire, USA
Age: 32
Posts: 129
Yes! Thanks. :-)
ricky500 is offline  
AdSense AdSense  
 


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Similar Threads
Thread Thread Starter Forum Replies Last Post
Polygon Zones, and why not? volvo_0ne Coders. AMOS 24 30 January 2016 21:20
Request: Text Editor with C syntax highlighting Morbane request.Apps 8 03 January 2012 11:10
[nitpick] Time zones problem Akira project.EAB 15 02 September 2002 05:24

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 08:21.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2018, vBulletin Solutions Inc.
Page generated in 0.08888 seconds with 13 queries