English Amiga Board

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

Thread Tools
Old 01 January 2018, 08:35   #1
Registered User
ricky500's Avatar
Join Date: Nov 2008
Location: New Hampshire, USA
Age: 35
Posts: 135
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  
Old 01 January 2018, 10:57   #2
Registered User
Dan's Avatar
Join Date: Nov 2004
Location: Germany
Posts: 526
Like this ?

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

Reserve Zone 11

Double Buffer 
Bob Update Off 
Autoback 0

rem setting up zone

For X=1 To 10
$="Text Zone"+Str$(X)
LINK(X,3)=LINK(X,1)+(Len(TXT$)*8) : Rem 8 means font width 
(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
=X Mouse
=Y Mouse
=Mouse Zone
   Ink 2
   Text 10
,9,"Zone Under cursor="+Str$(M)

rem draw text:
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
   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


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

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

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

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 23:33.

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