Skip to content

neilsreqtoolslib

This library makes the requesters of reqtools.library, a widely used system extension by Nico François, usable from Blitz Basic 2. It needs reqtools.library version 38 or later in LIBS:. When the program starts, the library opens it and prepares its requesters; IsReqToolsActive tells whether that worked. Check it before using any other command: without reqtools.library they open no requester and return what they return when the user cancels.

There are two kinds of commands. The ones with EZ in their name come with a sensible set of options and need only a title and a few values; RTRequest and RTFileRequest take a tag list of reqtools options from the program instead. The library asks reqtools to lock the requester’s parent window while a requester is open; it names no window or screen for the requesters itself.

The file requesters are numbered for the commands that change their settings: 0 is the one of RTEZLoadFile, 1 of RTEZSaveFile, 2 of RTEZPathRequest and 3 of RTEZMultiLoadFile. Each keeps its own directory between calls. RTFileRequest has a requester of its own.

RTASyncRequest and RTASyncPaletteRequest open a requester that stays open while the program goes on; the program asks with RTCheckASyncRequest or RTCheckASyncPaletteRequest whether it is still open and closes it with RTEndASyncRequest or RTEndASyncPaletteRequest. Only one of each can be open at a time.

RTReturnValue returns what reqtools itself answered to the last requester, which tells for example a cancelled requester from a chosen value.

Choosing a file and asking before loading it:

If IsReqToolsActive
  f$=RTEZLoadFile("Choose a file","")
  If f$<>""
    If RTEZRequest("Load","Load "+f$+"?","Load|Cancel")=1
      NPrint "Loading ",f$
    EndIf
  EndIf
EndIf

The fixed bugs of the library are listed in Fixes in neilsreqtoolslib.

Based on the documentation of ReqToolsLib by Neil O’Rourke.

Library number 54.

Commands

IsReqToolsActive

Returns -1 if reqtools.library could be opened and the library’s requesters prepared when the program started, and 0 if not.

Function, result .l. No help text.
No arguments.

Without it, the other commands of the library return what they return when the user cancels, without opening a requester.

RTASyncPaletteRequest

Opens a palette requester, starting at the colour FirstColour, that stays open while the program goes on. Returns -1 if the requester is open.

Function, result .w. Help text: (Title$,FirstColour)
Arguments: $, .l

The program must have a current window. The requester is watched with RTCheckASyncPaletteRequest: the program polls it, as no command lets it wait for the requester.

RTASyncRequest

Opens a message requester that stays open while the program goes on, for example to let the user stop a long task. Returns -1 if the requester is open.

Function, result .w. Help text: (Title$,BodyText$,GadgetText$)
Arguments: $, $, $

The program must have a current window. The requester is then watched with RTCheckASyncRequest: the program polls it, as no command lets it wait for the requester.

RTCheckASyncPaletteRequest

Returns -1 while the requester of RTASyncPaletteRequest is open, and 0 once the user has closed it; how it was closed cannot be told.

Function, result .w. No help text.
No arguments.

RTCheckASyncRequest

Returns -1 while the requester of RTASyncRequest is open; once the user has closed it, the number of the button chosen.

Function, result .w. No help text.
No arguments.

RTEndASyncPaletteRequest

Closes the requester of RTASyncPaletteRequest from the program.

Statement. No help text.
No arguments.

RTEndASyncRequest

Closes the requester of RTASyncRequest from the program. Do not call it after the user has closed the requester.

Statement. No help text.
No arguments.

RTEZFlagsRequest

Like RTEZRequest, but the requester also ends on the window events of IDCMPFlags, for example a disk inserted. Returns the number of the button, or the event’s flag if an event ended it.

Function, result .l. Help text: (Title$,BodyText$,GadgetText$,IDCMPFlags [,ReqPosition])
2 forms:

  • $, $, $, .l
  • $, $, $, .l, .l

An empty Title$ gives the requester reqtools’ default title. An empty GadgetText$ gives a requester without buttons, which only an event can end; use that with care.

RTEZFontRequest

Opens the font requester and returns the address of a TextAttr structure of the chosen font, its name, size, style and flags; 0 if the user cancels.

Function, result .l. Help text: (Title$)
Arguments: $

The structure belongs to the library and changes with the next call; the name points into the requester.

RTEZFreePattern

Removes the pattern gadget of a file requester again, 0 for loading, 1 for saving and 3 for the multi-load requester. Other numbers do nothing.

Statement. Help text: Requester#
Arguments: .l

RTEZGetLong

Asks the user for a number, with the text BodyText$ and the optional DefaultValue in the input field. Returns the number.

Function, result .l. Help text: (Title$,BodyText$ [,DefaultValue])
2 forms:

  • $, $
  • $, $, .l

Without DefaultValue, the input field starts with 0. When the user cancels, the command returns DefaultValue, or 0 without it; only RTReturnValue, 0 after a cancel, tells a cancel from a number that was entered.

RTEZGetLongRange

Like RTEZGetLong, but the number must lie between Min and Max, both included. Returns 0 if the user cancels.

Function, result .l. Help text: (Title$,BodyText$,Min,Max [,DefaultValue])
2 forms:

  • $, $, .l, .l
  • $, $, .l, .l, .l

Without DefaultValue, the input field starts with 0, also when 0 lies outside Min and Max; the requester then asks for a number in the range when the user confirms.

RTEZGetString

Asks the user for a text of up to MaxChars characters, with the text BodyText$ and the optional DefaultString in the input field. Returns the text, or an empty string if the user cancels.

Function, result $. Help text: (Title$,BodyText$,MaxChars [,DefaultString])
2 forms:

  • $, $, .l
  • $, $, .l, $

RTEZLoadFile

Opens the file requester for loading and returns the path of the chosen file, the directory and the file name. An empty string if the user cancels.

Function, result $. Help text: (Title$,Filename$)
Arguments: $, $

Filename$ is the file name the requester starts with; it is not changed. The requester shows only the files that match a pattern after RTEZSetPattern.

RTEZMultiLoadFile

Opens a file requester in which the user can choose several files. Returns -1 if files were chosen and 0 if the user cancels; the paths of the files then come from RTNextPathEntry.

Function, result .l. Help text: (Title$)
Arguments: $

The list of the previous call is freed first, also when the user cancels.

RTEZPaletteRequest

Opens the palette requester, starting at the colour FirstColour. Returns the colour selected last, or -1 if the user cancels.

Function, result .l. Help text: (Title$,FirstColour)
Arguments: $, .l

RTEZPathRequest

Opens a requester for choosing a directory and returns it, with a / at its end unless it ends in :. An empty string if the user cancels.

Function, result $. Help text: (Title$)
Arguments: $

RTEZRequest

Opens a message requester with the text BodyText$ and the buttons of GadgetText$, separated by |. Returns the number of the button chosen, counted from 1 at the left; the rightmost button, usually Cancel, gives 0.

Function, result .w. Help text: (Title$,BodyText$,GadgetText$ [,ReqPosition [,DefaultResponse,Flags]])
3 forms:

  • $, any, $
  • $, any, $, .l
  • $, any, $, .l, .l, .l

An empty Title$ gives the requester reqtools’ default title. A _ before a letter of a button makes that letter its keyboard shortcut; a Chr$(10) in the body text starts a new line. BodyText$ may also be the address of a text.

ReqPosition places the requester: 0 at the mouse pointer, 1 in the centre of the window, 2 in the centre of the screen (the default), 3 at the top left of the window, 4 at the top left of the screen. DefaultResponse is the button that Return chooses, 1 by default. Flags adds 1 to switch Return off, 2 to limit the shortcuts to Left Amiga with V and B, and 4 to centre the text. All three apply to this call only.

RTEZSaveFile

Opens the file requester for saving and returns the path of the chosen file; an empty string if the user cancels. Its button says Save, double-clicking a file does not choose it, and a directory that does not exist can be created.

Function, result $. Help text: (Title$,Filename$)
Arguments: $, $

Filename$ is the file name the requester starts with.

RTEZScreenModeRequest

Opens the screen mode requester and returns the address of a block with the chosen mode; 0 if the user cancels.

Function, result .l. Help text: (Title$ [,DisplayFlags])
2 forms:

  • $
  • $, .l

The block holds the display ID (a long), width, height, depth and overscan type (words) and the autoscroll setting (a long). DisplayFlags chooses the gadgets of the requester, as the SCREQF_ flags of reqtools; without it, the requester has width, height and depth gadgets. The flags stay until a mode is chosen.

RTEZSetDefaultDirectory

Sets the directory that a file requester shows, 0 for loading, 1 for saving, 2 for the path requester and 3 for the multi-load requester. Other numbers do nothing.

Statement. Help text: Requester#,Directory$
Arguments: .l, $

RTEZSetPattern

Adds a pattern gadget to a file requester and sets its pattern, so that the requester shows only the matching files; 0 for loading, 1 for saving, 3 for the multi-load requester. Other numbers do nothing.

Statement. Help text: Requester#,Pattern$
Arguments: .l, $

RTFileRequest

Opens a file requester of its own, set up by the reqtools tag list at the address TagList, and returns the path of the chosen file. An empty string if the user cancels.

Function, result $. Help text: (Title$,FileName$,TagList)
Arguments: $, $, .l

RTLockWindow

Locks the window Window# against input, with a wait pointer, until RTUnlockWindow. Returns the lock that RTUnlockWindow needs; keep it.

Function, result .l. Help text: (Window#)
Arguments: .l

RTNextPathEntry

The path of the next file chosen with RTEZMultiLoadFile, or an empty string after the last one.

Function, result $. No help text.
No arguments.

RTRequest

Opens a message requester like RTEZRequest, set up by the reqtools tag list at the address TagList. Returns the number of the button chosen.

Function, result .l. Help text: (BodyText$,GadgetText$,TagList)
Arguments: $, $, .l

RTReturnValue

What reqtools answered to the last requester of the library, for example 0 after a cancelled number requester.

Function, result .l. Help text: -- return value of last RT command
No arguments.

The commands that check or end an asynchronous requester and the window commands do not change it.

RTRevision

The revision number of the reqtools.library in use.

Function, result .w. No help text.
No arguments.

RTUnlockWindow

Unlocks the window Window# that was locked with RTLockWindow; Lock is the value that returned.

Statement. Help text: Window#,Lock
Arguments: .l, .l

RTVersion

The version number of the reqtools.library in use.

Function, result .w. No help text.
No arguments.