Discussion:
Attempting to populate a TabPanel based upon a Query
Alex Hochberger
2007-09-26 20:44:01 UTC
Permalink
I am creating a subclass of TabPanel, to use with pgSQL4RB.

Here is my process:
Drag the TabPanel in, put the controls in the single tab penel.

The TabPanel has a Dictionary with the controls in that panel. On the
Open Event, I populate the dictionary.
I have implemented the binding so from the DB Query, I create panels
for each relevant entry. I want to place a copy of each control from
the Dictionary on each panel, this is where I am stuck.
Since I need to create a new Subclass from the pgSQL4RB controls to
support an extra field from the database, I suppose I can handle all
the supported controls with IsA statements, but I was hoping to just
copy them, with references in my Dictionary of Dictionaries that I can
walk through.

Here is my populate code NOTE myControls is a Dictionary of all the
Controls. I've successfully populated it already, and nuked the
original Tab, so now the Controls only exist in the Dictionary.

for i = 0 to me.PanelCount - 1
PanelControls = new Dictionary
for j = 0 to UBound(me.myControls)
oldControl = myControls(j)
newControl = New oldControl
newControl.PanelIndex = i
PanelControls.Value(j) = newControl
next j
TabControls.Value(i) = PanelControls
next i


I get a compile-time error:
There is no class with this name.
newControl = new oldControl
and oldControl is highlighted.

If this approach fails, I am certain I can walk through them, and use
IsA to create new Instances of my Subclass, and pull the relevant
information from them, but that SEEMS less elegant.

Alex
Aliacta Support
2007-09-27 10:17:27 UTC
Permalink
Hi Alex,

I think the problem is that you nuke the original tab with the
original controls first, i.e. they are gone so you can't copy them
anymore. The references to them you stored in your dictionary have
become useless. The controls do not actually exist in your dictionary.

You probably want to keep the originals of those controls inside
another control like a GroupBox that you'd keep invisible. You then
don't need the dictionary, only the GroupBox to copy from.

Or if you have RB Pro just make a Container Control that you then can
instantiate in code for each TabPanel. That's by far the easiest in
my book.

Another remark is RS says they want to deprecate visual control
binding, so you probably shouldn't use that feature anymore with
pgSQL4RB. (I know, it's one of their dumbest moves but what can you
do about it? Anybody fancies protesting in an organized way? I'd
obviously participate in that case.)

Cheers,

Marc
Post by Alex Hochberger
I am creating a subclass of TabPanel, to use with pgSQL4RB.
Drag the TabPanel in, put the controls in the single tab penel.
The TabPanel has a Dictionary with the controls in that panel. On the
Open Event, I populate the dictionary.
I have implemented the binding so from the DB Query, I create panels
for each relevant entry. I want to place a copy of each control from
the Dictionary on each panel, this is where I am stuck.
Since I need to create a new Subclass from the pgSQL4RB controls to
support an extra field from the database, I suppose I can handle all
the supported controls with IsA statements, but I was hoping to just
copy them, with references in my Dictionary of Dictionaries that I can
walk through.
Here is my populate code NOTE myControls is a Dictionary of all the
Controls. I've successfully populated it already, and nuked the
original Tab, so now the Controls only exist in the Dictionary.
for i = 0 to me.PanelCount - 1
PanelControls = new Dictionary
for j = 0 to UBound(me.myControls)
oldControl = myControls(j)
newControl = New oldControl
newControl.PanelIndex = i
PanelControls.Value(j) = newControl
next j
TabControls.Value(i) = PanelControls
next i
There is no class with this name.
newControl = new oldControl
and oldControl is highlighted.
If this approach fails, I am certain I can walk through them, and use
IsA to create new Instances of my Subclass, and pull the relevant
information from them, but that SEEMS less elegant.
Alex
_______________________________________________
Postgresql mailing list
http://aliacta.com/mailman/listinfo/postgresql_aliacta.com
david vrooman
2007-09-27 11:54:08 UTC
Permalink
Post by Aliacta Support
Another remark is RS says they want to deprecate visual control
binding, so you probably shouldn't use that feature anymore with
pgSQL4RB. (I know, it's one of their dumbest moves but what can you
do about it? Anybody fancies protesting in an organized way? I'd
obviously participate in that case.)
I don't have time to organize such a thing, but I'd definitely
participate if some one else did…

Dave

Loading...