Board index » cppbuilder » Re: Cycle through objects on a form / Dynamic Form objects ...

Re: Cycle through objects on a form / Dynamic Form objects ...


2004-02-29 07:02:43 AM
cppbuilder85
"Nick Rambarransingh" < XXXX@XXXXX.COM >wrote in message
Quote
Is there a way to cycle through all the objects on a form, and read the
tag numbers.
On the one hand, a form is a TComponent descendant, and TComponent has
ComponentCount and Components[] properties for accessing the owned children.
On the other hand, controls that are displayed visually inside the form may
not necessarily be owned by the form. A form is also a TWinControl
descendant, and TWinControl has ControlCount and Controls[] properties for
accessing the children that visually appear in the form.
Quote
For example, I would like to check a users access rights with all the
objects on a form. If the user does not have access to a particular
object, a Tedit for example, then I will disbale it. How do I do all of
this ?
Is the TEdit placed on the form directly, or is it a child of another
control, such as a TPanel?
Quote
Second, what if I have a forem with a few Tedits and a grid, but I
would like to give my user the ability to add more objects to the form
that I originally shipped. Doesn't this mean the user has to get
CBuilder?
No. Simply place the desired controls into runtime packages. Then the
application can load the packages dynamically at runtime via the
LoadPackage() function. A package is a special VCL-aware DLL, so you can
have the package export functions that the application calls when needed, by
using GetProcAddress() to get pointers to the exported functions. The
package can then create new control instances and place them on the form and
the form can access and manipulate them like any other control.
In other words, essentially creating a plugin system, where new plugins
contain new controls, and the application loads installed plugins when
needed.
Quote
it would have to persist, I am thinking database for that - right ?
A database is not needed.
Gambit
 
 

Re:Re: Cycle through objects on a form / Dynamic Form objects ...

Good Day all,
This is a two part question. The first part is about the child objects on a
form. Is there a way to cycle through all the objects on a form, and read the
tag numbers. For example, I would like to check a users access rights with all
the objects on a form. If the user does not have access to a particular object,
a Tedit for example, then I will disbale it. How do I do all of this ?
Second, what if I have a forem with a few Tedits and a grid, but I would like
to give my user the ability to add more objects to the form that I originally
shipped. Doesn't this mean the user has to get CBuilder? How could I provide
the user with the ability to add a TEdit, or a grid, or something else to the
alread existing form - and yes, it would have to persist, I am thinking database
for that - right ?
Thanks in advance,
Nick
 

Re:Re: Cycle through objects on a form / Dynamic Form objects ...

Salut Remy,
Its good to hear from you again. Thank you for the info - it is very
encouraging.
Quote
Is the TEdit placed on the form directly, or is it a child of another
control, such as a TPanel?

Ummmmm - I am debating this actually. I was thinking about the following. I
would like to give my client the ability to add their own customizations to the
software - hence part two of my post. So if the user drops a panel on a form, I
would then need to find a way to identify it, and, then I would need to be able
to enable it based on criteria, such as access rights, time of the day, yada
yada yada. I will do some experimentation on that.
With respect to part two - it just so happened I was reading about plug-ins in
the CBuilder 5 Developers Guide. Interesting concept. So how do I maintain
persistance. If the Administrator goes in to the system and creates a new field
on a form? Now I need to figure out how to bind this field to a database over
MIDAS, oooppppss, I meant DataSnap.
Thanks, Nick
PS - Have you played around with IntraWeb yet - this thing is unfrekin
believable. I think I have found my next calling !
 

{smallsort}