[sword-devel] Here's a quick sample of a BCB6 front-end I'm developing for personal research using CLX

Jonathan Mickelson sword-devel@crosswire.org
Fri, 09 Apr 2004 11:02:49 -0400

Yes, I'm using the SWORD API.  I'm using standard sword-api calls; very 
simple when you're back down to the basics.

My objective publicly is to become a helpful, contributing member of 
Crosswire and  the sword project.
At the moment, this means developing some simple working examples of 
sword-api in use that can be employed by interested parties with various 
levels of programming skills.  I want the examples to show the 
minimalist approach to having a working program that can then be 
enhanced, hacked, etc.  Having something working in your hands is very 

My personal objectives, for my inhouse program (PlowShare), is to 
develop my dream bible tool considering my own goals and desires and not 
for public release (too many support issues/questions/complaints for a 
personal tool).  When some UI feature works real well, I'll add it to 
the list of tips and tricks.  I greatly prefer CLX over VCL primarily 
because CLX has an HTML widget that has made that first screen shot 
possible with 10-15 of coding (once the development environment is setup 

The screen shot was to garner interest in the Sword API and this 

The rest of this text is from a previous posting.  My preference is too 
have some other develops from scratch also, compare notes and make sure 
we have all the information corrected and documented for others.  So, I 
will help you.
This thread will archive the neccesary steps to compile your own Sword 
Project from scratch using BCB 6.0

Later, this material will be consolidated into a tutorial.

Create a new Borland BCB 6 project
[I am building a CLX project though either CLX or VCL (standard) may be 
used. ]

1) modify the Project Options dialog box.
  TAB "Directories/Conditional"

  Include Path =

  Library Path =

  Conditional Defines  (VERY IMPORTANT)

2) here is my simple program to display module names and descriptions on 
a form.
// download and install BibleCS 1.5.6.  This creates all the proper 
production directories.
// download some bible modules
// test that BibleCS is working properly
// Add a memo component to the form (it's under the "Standard" tab)
// Create Form Events for OnDestroy and OnShow
// judiciously use the code below putting things in their proper place
// compile and run
// the form should appear with a list of module names and descriptions
#include <clx.h>    // used for CLX projects
#pragma hdrstop

#include "MySampleProject.h"
#include <string>
#include <swmgr.h>
#include <swconfig.h>
#include <markupfiltmgr.h>

#define WM_VERSE (WM_APP + 1995)
extern AnsiString startVerse;

using namespace sword;

//#pragma package(smart_init)
#pragma resource "*.xfm"

SWConfig *userPrefs;
SWMgr *mainmgr;
SWConfig *optionsconf;

TForm1 *Form1;

__fastcall TForm1::TForm1(TComponent* Owner)
  : TForm(Owner)

void __fastcall TForm1::FormDestroy(TObject *Sender)
  if (mainmgr)
      delete mainmgr;
  if (userPrefs)
      delete userPrefs;
  if (optionsconf)
      delete optionsconf;

void __fastcall TForm1::FormShow(TObject *Sender)
//    MyLibrary = new SWMgr(0, 0, true, new 

  ModMap::iterator it;
  SWModule *MyMod;

  optionsconf = new SWConfig("./options.conf");

      mainmgr = new SWMgr(0, 0, false, new MarkupFilterMgr(FMT_RTF, 
        userPrefs = 0;

      userPrefs = new SWConfig("./userprefs.conf");
      if ((mainmgr->config) && (userPrefs))
      (*(mainmgr->config)) += (*userPrefs);
  catch (...)

  if (!mainmgr->config)

  for (it = mainmgr->Modules.begin(); it != mainmgr->Modules.end(); it++)
      MyMod = (*it).second;
        if (!strcmp((*it).second->Type(), "Biblical Texts"))
// End of code