Ultimate Amiga

Please login or register.

Login with username, password and session length
Advanced search  
Pages: [1]   Go Down

Author Topic: Need some help with a text-engine  (Read 4472 times)

0 Members and 1 Guest are viewing this topic.

puni_gds

  • A600
  • *
  • Karma: 0
  • Offline Offline
  • Posts: 14
    • http://www.classicamiga.com
Need some help with a text-engine
« on: January 27, 2007, 07:14:59 PM »

Hi,

I'm quite new to this forum, as I registred only a few weeks ago. Currently I'm trying to create a small program that plays Protracker modules. I've managed to set up a selector for the modules, which seems to be working ok. Along with the module selector, I would also like to implement a small section with articles. This section will be placed on the right side of the screen and limited to a medium sized black box.

It has been many years since I last did some coding, and I'm really having difficulties with the text-routine. The thing I'm trying to do is as follows:

Have a menu like this: (just an example)

Article 1
Article 2
Article 3
Article 4
Article 5

When I click on Article 1, I want it to show the relevant text in the same box. I've tried using the set zone command, along with the ordinary text command, but it is not working as I want. Are there any other ways of doing this? Hope to receive some input on how to view short texts in a box, and how you can switch between them.

Thanks in advance for your help. :)
Logged
Please feel free to visit Classicamiga
- Your guide for everything Amiga!

Sidewinder

  • Forum Mod
  • A600
  • *****
  • Karma: 0
  • Offline Offline
  • Gender: Male
  • Posts: 155
    • http://www.liquido2.com/
Re: Need some help with a text-engine
« Reply #1 on: January 28, 2007, 05:40:13 PM »

Welcome to the Amos Factory puni_gds.  Here is a quick and dirty example of how I would do what you describe using AMOS text windows:

Code: [Select]

Screen Open 0,640,200,8,Hires
Wind Open 1,472,0,21,10,1
Border 0,0,2
Paper 0
Curs Off
Reserve Zone 10

Do
   Proc CREATE_MENU
   Proc CHECK_ZONES

   CLICKED_ZONE=Param

   'Use CLICKED_ZONE to find which zone was clicked and load the article

   If CLICKED_ZONE=10
      End
   Else
      Proc DISPLAY_ARTICLE[CLICKED_ZONE]
   End If
Loop


Procedure CREATE_MENU
   Reset Zone
   Clw
   Print Zone$("Article 1",1)
   Print Zone$("Article 2",2)
   Print Zone$("Article 3",3)
   Print
   Print Zone$("End",10)
End Proc

Procedure CHECK_ZONES
   'Check is the mouse is over a zone and if the left mouse button has
   'been clicked (the left button is bit 1).

   Repeat
      A=Mouse Zone
   Until A>0 and(Mouse Click and %1)
End Proc[A]

Procedure DISPLAY_ARTICLE[A]
   Reset Zone
   Clw

   'Print the article text here.
   Print "Article ";A

   Print
   Print Zone$("Back",1)

   Repeat
      Proc CHECK_ZONES
   Until Param=1
End Proc


The main loop generates the menu by calling CREATE_MENU which uses Text Zone$().  CHECK_ZONES then waits for the user to click one of the menu options.  If it's not the "End" option, then DISPLAY_ARTICLE is called to display the article using Print statements.

Give it a try and tell me if it's what you're looking for.
Logged
- Sidewinder

puni_gds

  • A600
  • *
  • Karma: 0
  • Offline Offline
  • Posts: 14
    • http://www.classicamiga.com
Re: Need some help with a text-engine
« Reply #2 on: January 28, 2007, 07:03:32 PM »

Hi Sidewinder,

Thank you very much for the solution you gave me to the problem I had. I gave your source a try and it was just what I was looking for. Cheers and thanks again! :)
Logged
Please feel free to visit Classicamiga
- Your guide for everything Amiga!
Pages: [1]   Go Up
 

TinyPortal 2.2.2 © 2005-2022