Board index » cppbuilder » Opentools API hello world project wizard example

Opentools API hello world project wizard example

Hi all.

I am working on making a wxWindows project wizard for BCB6. In trying to figure that
out, I first created a hello world project wizard that just shows a message box.
After getting the hello world project wizard to work, I thought that other people
might be interested in seeing how this is done, so I have put the code for the hello
world wizard on my website. The URL is:

http://www.bcbdev.com/ftp/source/otawizard.zip

To install, open the BPK file and build the project. Once that is done, click the
install button on the package editor.

Note that I did this in BCB6. I also created a BPK file for BCB5, and it seemed to
work. Although I didn't play with it much in BCB5. Also note that my project wizard
doesn't actually create a project (unless you consider ShowMessage a project
generator). That's the next part to figure out.

Harold Howe [TeamB]
http://www.bcbdev.com

 

Re:Opentools API hello world project wizard example


MY SAVIOR!!! hehe.  I've been trying to get the OTA to work for some time
now without success.

Gambit

"Harold Howe [TeamB]" <hh...@bcbdev.com> wrote in message
news:3C830CA6.FE7ACC3A@bcbdev.com...

Quote
> I am working on making a wxWindows project wizard for BCB6. In trying to
> figure that out, I first created a hello world project wizard that just
shows a
> message box. After getting the hello world project wizard to work, I
thought
> that other people might be interested in seeing how this is done, so I
have put
> the code for the hello world wizard on my website. The URL is:

> http://www.bcbdev.com/ftp/source/otawizard.zip

Re:Opentools API hello world project wizard example


Quote
Remy Lebeau [TeamB] wrote:

> MY SAVIOR!!! hehe.  I've been trying to get the OTA to work for some time
> now without success.

Yeah, well you might want to hold the savior bit until I actually get a wizard that
can create a project. :) If you have any code that shows how to implement an
IOTAProjectCreator50 in C++, I would sure like to see it.

It would be nice if Borland included a project wizard as one of the tools API
examples.

Harold Howe [TeamB]
http://www.bcbdev.com

Re:Opentools API hello world project wizard example


Harold

 Without digging the source out to a project.... some highlights.
The easiest way to do this without supplying source .
make a new project .. save and load the relevant files below until
you figure out what is wanted by the IDE.

First.. close anything open.. unless you want to "Add Existing"

build a suitable creator
class TProjectModules : public IOTAProjectCreator

get  _di_IOTAModuleServices AModuleServices

AModuleServices->CreateModule(
             new TProjectModules( Edit1->Text,
                                                    Edit3->Text,
                                                     Edit2->Text  ));

when the expert calls ...
TProjectModules ::GetFileName(void)
{  return "C:\\Projects\\Experts\\Project1.bpr";

Quote
}

TProjectModules ::GetOptionFileName(void)
{  return "C:\\Projects\\Experts\\Project1.bpr.xml";

Quote
}

TProjectModules ::NewOptionSource(const AnsiString ProjectName)
{  return new TModuleOptionSource();

Quote
}

above calls
class TModuleOptionSource: public IOTAFile
TModuleOptionSource::GetSource(void)
{
   /* load the test project .. return TStrings ::Text  ...
      or stick in your XML Parser
  */
    TStrings * s = new TStringList;
    s->LoadFromFile("C:\\Projects\\Experts\\Project1.bpr.xml");
  (...) etc ..

Quote
}

back to the creator

TProjectModules ::::NewProjectSource(
{ return new TProjectModuleSource ();

Quote
}

TProjectModuleSource ::GetSource(void)
{
    TStrings * s = new TStringList;
  s->LoadFromFile("C:\\Projects\\Experts\\Project1.cpp");

Quote
}

TProjectModules::NewDefaultModule(void)
expects to find 'Unit1.cpp' or whatever the Option Source  calls for.
and / or the above "Project1.cpp" dependencies

HTH
Michael Harris

Re:Opentools API hello world project wizard example


Quote
Michael wrote:

<snip>

Thanks for the advice Michael. Last night and this morning, I was able to get a
project creator working. However, there was something that I couldn't figure out.
After the project creator is finished, the project manager shows a res file in the
project group. I don't want a res file in the project group. How do I suppress the
creation of a res file?

I ended up using the alternative route that Ray Lischner talks about in his book
where you just create files on the hard drive and tell the IDE to open the project
from disk. This strategy does not involve the ProjectCreator interface. The MDI and
SDI wizards seem to work this way (I think).

Harold Howe [TeamB]
http://www.bcbdev.com

Re:Opentools API hello world project wizard example


In thast case.  easiest soluton I found is,
New Project.
remove the line (from project1.cpp) USERES.
remove the .res file.
Write the resulting files as Ray described.

--
Michael Harris

Re:Opentools API hello world project wizard example


Well, I should have taken my own advise. anyway. I found the correct method
of doing as requested... New Project , No Res . The resulting project
compiled and ran without error.

I would supply you the source if still interested.

--
Michael Harris

Re:Opentools API hello world project wizard example


Quote
> Well, I should have taken my own advise. anyway. I found the correct
method
> of doing as requested... New Project , No Res . The resulting project
> compiled and ran without error.

> I would supply you the source if still interested.

If you have figured out how to create a project with an IOTAProjectCreator
that does not have the RES file, please post the code.

Harold

Re:Opentools API hello world project wizard example


see attachments NG  'BCB5-6 ProjectCreator'

--
Michael Harris

Re:Opentools API hello world project wizard example


 Did the wizard work as advertised ?

--
m

Re:Opentools API hello world project wizard example


Quote
Michael wrote:

>  Did the wizard work as advertised ?

For now, I am going to stick with the strategy I have. I have downloaded your
project, and I will look at it when I revisiting the idea of using a project creator.

Harold Howe [TeamB]
http://www.bcbdev.com

Re:Opentools API hello world project wizard example


If nothing else,   It gave me an excuse to update all of my code generators
to 'IOTAxxx'
the modulecreator work about the same for  units, forms etc..
This works well for a small 'start-up' project, but I wouldn't want to use
it on a project containing 20-30 output files.

--
Michael Harris

"Harold Howe [TeamB]"  wrote in message

Quote
> For now, I am going to stick with the strategy I have. I have downloaded
your
> project, and I will look at it when I revisiting the idea of using a
project creator.

> Harold Howe [TeamB]
> http://www.bcbdev.com

Other Threads