View on GitHub


extension libraries for yabasic


A yabasic library (c) Michel Clasquin-Johnson 2018. Licensed accordingto the MIT license

This library allows yabasic to display a variety of dialogs in text mode without making use of external commands.

Some routines will perhaps also be made available in graphics mode. Maybe, one day. I am a better text mode programmer, what can I say?

The library is written as a textmode application and must be run in a terminal. It will not be useful in a headless script.

The entire set of libraries focuses on sane defaults and getting basic functionality into yabasic.

The images below are for illustration only. The exact appearance of the dialogs will depend on your system settings.

Developed, at various stages, on elementary OS 0.4 “Loki”, Debian Buster and Lubuntu 18.04 (i.e. Linux), but it should work on any *NIX system that will run yabasic. Testing on Windows has been far more sketchy, since I don’t have a windows box here, but I did what I could in my lunch break at work ;-).

The library should exist either in the same folder as your program (symlinks work) or in the standard yabasic library location on your system.

To use the library, use the command

import clasquinatorlib

If you would rather cut and paste these subroutines into your own program rather than importing this rather large library, or create your own, smaller library with just the routines you need, be my guest (I would appreciate a note of acknowledgement in your code). But some subroutines require supporting routines that you will find at the end of this library. You will have to include those as well.

You should not use this library and one of the others in this set that provides dialogs concurrently, because they replicate subroutine names. Pick the right one for your program and stick with it!

Unlike the other libraries, you cannot use \n to break a line in your text variables. Keep that in mind if compatibility between the libraries is important.

By default, widgets are drawn in cyan, with button and menu triggers in red and the title in blue. But you can override this by setting the GLOBAL variables menu_colour$, title_colour$ and trigger_colour$. There is a routine ChangeColour() to make this easier.

The “buttons” are not mouse-aware.

The first letter of each button or menu item automatically becomes the trigger. Both lower and upper case variants will activate it. It is up to you to ensure that you do not use menu items that start with the same letter.

Hint: You can always number them, e.g.

menuitem1$ = "1.File"

This will make the menu react to the “1” key being pressed, rather than “f” or “F”.

If the text of a message (usually in the variable text$) is too long to fit in one line, it will be truncated. This may vary with the width of the user’s terminal window, so be conservative!

Excessive quote marks (required in other libraries and often supplied by EncloseText$() or "") will be removed by the library to maintain compatibility.

Excessive spaces at the front and back of text$ will be trimmed, but multiple spaces within text$ will be maintained.

This library is currently still in the development stages and not really usable. But watch this space!


This library requires a small number of global variables. You do not need to initialize them, but don’t use the following variable names in your program unless you have a very good reason.

External utilities required

I didn’t quite manage to get away with writing this library without making any system calls. You will need the following commands to be installed on your system.

If you don’t have these, your system is broken and you really, really need to reinstall your operating system. So I’m not going to worry about it.

Routines available:

This library poaches as many ideas as possible from the other four dialog-providing libraries, but there is not 100% compatibility here, so we will not divide things into Common and Clasquinator-specific sections.

a$ = GetDirDlg$("Pick a folder", "Which directory would you like to see?","~")


a$ = GetDirDlg2$("Pick a folder", "Which directory would you like to see?","~")


a$ = GetDirDlg3$("Pick a folder", "Which directory would you like to see?","~")


a$ = GetDirDlg4$("Pick a folder", "Which directory would you like to see?","~")


a$ = InputDlg$("What is your name?", "Who are you?")


a$ = InputDlg2$("What is your name?", "Who are you?")


a$ = MenuDlg$("Main Menu", "File#Edit#Help", 0)


a$ = MenuDlg$("Help Menu", "Help#About", 1, "File#Edit#Help")


As you would expect by now there are commands called MenuDlg2$() and SubMenuDlg2$() and so on to change the appearance of the menus.

a$ = SubMenuDlg2$("Help Menu", "Help#About", "File#Edit#Help")


MessageDlg("This is a simple message dialog. Close it with ENTER or O.","OK")


MessageDlg2("This is a simple message dialog. Close it with ENTER or O.","OK")


a$ = "This is the string to display. Let's make it long so that wordwrap is enforced."
StringDisplayDlg(a$, "String Display Test", "OK")
a$ = "This is the string to display. Let's make it long so that wordwrap is enforced."
StringDisplayDlg2(a$, "String Display Test", "OK")


(Composite of the commands StringDisplayDlg() and StringDisplayDlg2() pictured above)

TextFileDlg2("./pg4.txt", "The Gettysburg Address", "OK")


WaitDlg2(1, "Please wait")
wait 4 //this is where you would do other stuff


YesNoDlg("Can you see this? Press Y if you can.", "Yes!", "No")


YesNoDlg4("Erase all data from the hard drive?.", "No!", "Yes")