#2917 How to install pclTextBox pod for Fantom (or any pod really)

Gary Sat 18 May

I thought this may be helpful for those that are new to the Fantom ecosystem (like myself):

Installing a library in Fantom generally involves downloading the library's '.pod' file and placing it in the appropriate location where Fantom can access it. Here are the detailed steps to install a library like pclTextBox or any other Fantom library:

1. Download the Pod:

Visit the library's website or repository where the '.pod' files are hosted. In your case, go to the 'pclTextBox' page: https://peterlane.codeberg.page/fantom/#Fantom-Pods-pclTextBox mentioned by pcl. Download the '.pod' file that corresponds to the library.

2. Place the Pod:

Locate the 'lib/fan/' directory in your Fantom installation. This is typically where Fantom expects to find .pod files.

/usr/local/Cellar/fantom/1.0.80/libexec/lib/fan  // default path using HomeBrew on Mac
C:\fantom-1.0.80\lib\fan  // on Windows Desktop PC (using manual install to the C drive)
C:\Program Files\fantom-1.0.80\lib\fan   // using Windows installer by Fantom Factory

Place the downloaded .pod file into this directory.

3. Verify Installation:

Open a command line or terminal. Run fan -version to ensure your Fantom environment is working. Run fan -pods to see a list of all installed pods. Check to see if the new library pod (pclTextBox) appears in this list.

4. Use the Library in Your Code:

In your Fantom source files, use the using keyword to include the library. Here’s an example:

using pclTextBox::Format

class Main {
    static Void main() {
        echo("Formatted Output: ")
        Format.show("hello ~a\n", ["world"])            // => "hello world"
        Format.show("~5a = ~10,5F\n", ["pi", Float.pi]) // => "   pi =    3.14159"

This example uses the Format class from the pclTextBox pod.

5. Compile and Run Your Fantom Program:

Compile your program by running 'fan yourFilename.fan'. Replace 'yourFilename.fan' with the actual name of your Fantom file. If there are no errors and the setup is correct, your program should run and use the functionalities provided by the 'pclTextBox' library.

Always ensure you have the correct version of the library that is compatible with your version of Fantom. If you have any issues with finding the library's '.pod' file, you may need to contact the library maintainer or check on relevant forums or repositories where the library is discussed or hosted. This process should get the 'pclTextBox' library up and running in your Fantom environment, allowing you to use its formatting capabilities as needed.

SlimerDude Mon 20 May

Thanks Gary - that's really useful!

pcl Mon 20 May

I'm flattered @Gary, but please be aware that I'm not in anyway a "Professsor". pcl on this forum is preferred, thankyou.

Gary Thu 30 May

No problem guys! My pleasure! :)

Login or Signup to reply.