Board index » cppbuilder » Allow user to design a form?

Allow user to design a form?

In article <3B0AA62A.E0B1B...@yahoo.com>, yoh...@yahoo.com says...
Quote
> However, I would like to include a "form designer" in my application, to
> display/hold data that would be read/written to a file.

Take a look at this freeware runtime designer package:
http://www.geocities.com/ResearchTriangle/Thinktank/5653/

Ken

 

Re:Allow user to design a form?


Hi all,

I have no idea where this should be posted.

However, I would like to include a "form designer" in my application, to
display/hold data that would be read/written to a file.

I would like to allow them to basically put labels, and tedit boxes, and
possibly images onto a form.  First I would like them to be able to
layout and save the acutal form, I would then load this blank form, they
could fill in the data, and I would save the information.

Any ideas on where to start.
Or even if it can be done.  I think anything CAN be done given enough
time and effort, but I would like it to be realistic.  I suppose it
could also be done via scripting....not that I have a clue where to
start that either.

Thanks,

Jay

Re:Allow user to design a form?


Thanks, I will.

No if I can just figure out how to do "modules" or plug-ins....heh.

I have to also come up with a scripting language, so I ahve alot of work ahead
of me :)

this shoud help.

Jay

"Kenneth Rochel de Camargo Jr." wrote:

Quote
> In article <3B0AA62A.E0B1B...@yahoo.com>, yoh...@yahoo.com says...
> > However, I would like to include a "form designer" in my application, to
> > display/hold data that would be read/written to a file.

> Take a look at this freeware runtime designer package:
> http://www.geocities.com/ResearchTriangle/Thinktank/5653/

> Ken

Re:Allow user to design a form?


In article <3B0AC6F2.A5456...@yahoo.com>, yoh...@yahoo.com says...
Quote
> Thanks, I will.

My pleasure.

Quote
> No if I can just figure out how to do "modules" or plug-ins....heh.

Actually I think I've seen something like that, take a look at Torry's
website - www.torry.net.

Quote
> I have to also come up with a scripting language, so I ahve alot of work ahead
> of me :)

That can be arranged too. :)
www.lua.org
If you'd like to take a look at my implementation, it's at
http://members.nbci.com/kencamargo/MoonlightSetup.exe

Ken

Re:Allow user to design a form?


I'll do that.

However the Components from before wont work.  Although they probably do what I
want, there is almost no docs, with the exception of some delphi source, which does
me little good, since I don't use delphi.

It is on the right track though

I may acutually make this done via a script, and create the form dynamically, maybe
with a "preview" button.  unless I find a component.

off to Torry's

Jay

"Kenneth Rochel de Camargo Jr." wrote:

Quote
> In article <3B0AC6F2.A5456...@yahoo.com>, yoh...@yahoo.com says...
> > Thanks, I will.

> My pleasure.

> > No if I can just figure out how to do "modules" or plug-ins....heh.

> Actually I think I've seen something like that, take a look at Torry's
> website - www.torry.net.

> > I have to also come up with a scripting language, so I ahve alot of work ahead
> > of me :)

> That can be arranged too. :)
> www.lua.org
> If you'd like to take a look at my implementation, it's at
> http://members.nbci.com/kencamargo/MoonlightSetup.exe

> Ken

Re:Allow user to design a form?


In article <3B0AE2B6.15429...@yahoo.com>, yoh...@yahoo.com says...
Quote
> I'll do that.

> However the Components from before wont work.  Although they probably do what I
> want, there is almost no docs, with the exception of some delphi source, which does
> me little good, since I don't use delphi.

Neither do I, but do give it a try. OP is not hard to understand,
actually.

Ken

Re:Allow user to design a form?


Yeah, I was going to do that, look at the code and see what I can
gleen.  I used Pascal in teh wayback days, so maybe something will shake free from the
rusty part of the brain.

I can't see how to edit events(In runtime) and to save teh layout, yet.

I'll work on it.  I am also going to investigate doing it in a scripting language, with a
view as you go kinda thing, or maybe even a mostly wysiwyg dynamic form.

Thanks,

jay
"Kenneth Rochel de Camargo Jr." wrote:

Quote
> In article <3B0AE2B6.15429...@yahoo.com>, yoh...@yahoo.com says...
> > I'll do that.

> > However the Components from before wont work.  Although they probably do what I
> > want, there is almost no docs, with the exception of some delphi source, which does
> > me little good, since I don't use delphi.

> Neither do I, but do give it a try. OP is not hard to understand,
> actually.

> Ken

Re:Allow user to design a form?


Jay,

I do not see what the problem is, or why you need a component to do this.
It seems to me to be quite straight forward.  You have your form, which you
use as the place where the user creates his own form dyanmically.  All of
the VCL components have to be created dynamically anyway, so you resort to
the usual methods for handling components dynamicaly instead of at design
time (in other words, you handle the magic yourself instead of relying on
BCB to do it for you).

What you need at design time is to create a mostly empty form, with whatever
menu you want and a toolbar with buttons for each of the components you have
decided to allow the user to add, with some selection of the classes from
the VCL and perhaps some of your own creation.  You then create event
handlers for the mouse events, along with the usual code for drawing
rectangles, to allow the user to size and position the components they wish
to add.  These handlers will "know" what  component to create from the
states of the buttons on the toolbar (you have to set them up so that there
is one, and only one, component button depressed at all times).  Finally,
you need to create dialog boxes for each of the supported components that
have properties you want your user to be able to set.

Assuming that you have designed and implemented your scripting support, all
you need do, for each component you have decided to support, is provide a
default handler which will run any script the user has indicated that he
wishes to attach to a given component (this may require creative use of
std::map to implement efficiently).

You can even create a second form class, on which you add the components as
designed by the user when he indicates he wants to use the form he has
designed.

Saving and restoring the relevant data is no different from saving and
restoring the data for any class.  You know what the classes are, and you
have absolute control over the data, so saving and restoring everything is
pretty much routine.

The only challenging part of this is getting the scripting right, and
especially implementing it in a way that the user can easily debug any
script they write, but then it may only appear that way to me because I have
not provided this feature to the users of my applications.  This is easy
enough, and there are so many components out there that are poorly written
and will cause problems, that I would rather spend a day or so implementing
it myself instead of fetching a possibly problematic component from someone
I don't know.  Indeed, I can probably implement something like this faster
than I could learn to use someone else's component designed for handling
this capability, especially if it is not well documented.

So what part of this did you have trouble with?

Cheers,

Ted

R.E. Byers
ted.by...@sympatico.ca

Other Threads