[Openroad-users] Tabpages
FRANK BARRATT
f.barratt at btinternet.com
Thu Oct 25 17:28:19 EST 2007
Bodo/All,
That works fine for loading pages into the tabfolder at runtime, but I am looking to use a button so that the user can add their own tabpages (up to 8), using the code below under the button I get a trace error saying that field1 has already been declared, if I undeclare it I lose the data in the first tab and if I don't declare it I get a NULL error on the cust1 userclass.
Thanks again
Frank.
----- Original Message -----
From: Bodo Bergmann
To: International OpenROAD Users
Sent: Tuesday, October 23, 2007 5:45 PM
Subject: Re: [Openroad-users] Tabpages
Frank,
when adding Tabpages dynamically using "AddTabPage" and the page is mapped to a userclass object
then you have to use the DeclareData() method on the TabFolder (not the Tabpage) to assign the value.
The TabFolder should have the "Declared" attribute set to FALSE before.
In the example below the subform "cust" (mapped to "customer" userclas)
is used as a "template" to create a new tabpage:
initialize()=
declare
i=INTEGER NOT NULL;
cust1 = customer DEFAULT NULL;
sf = Subform DEFAULT NULL;
enddeclare
{
i=FIELD(field1).tabpagearray.lastrow + 1;
sf = FIELD(cust).Duplicate();
sf.Name = 'page'+varchar(i);
sf.AllBias = FB_CHANGEABLE;
FIELD(field1).AddTabPage(subform = sf, tabtext = 'Page '+varchar(i), pagenum = i);
FIELD(field1).DeclareData();
}
ON CLICK check_btn =
{
FIELD(field1).CurTabPage.GetFieldValue(value=BYREF(cust1));
// Now check attributes using cust1 reference, e.g. "cust1.Name"
}
Hope this helps,
Bodo.
Bodo Bergmann
Senior Software Engineer
OpenROAD Worldwide Development
Ingres Corp.
---------------------------------
From: openroad-users-bounces at peerlessit.com [mailto:openroad-users-bounces at peerlessit.com] On Behalf Of FRANK BARRATT
Sent: Tuesday, October 23, 2007 3:45 PM
To: International OpenROAD Users
Subject: Re: [Openroad-users] Tabpages
Bodo,
I cannot find a way to map a tabpage to a userclass only the tabfolder or subform.
So when i call curtab = FIELD(my_tab).CurTabPage method,
I try to access the attribute values of curtab but it only has the childfields attribute as it does not know about my userclass object.
For my default page 1 can access the field values with mytab.page1.mysub.myfield.
For subsequent pages i need mytab.page1.curtab.myfield.
Now amount of casting and using the mysub userclass has resulted in obtaining the myfield values, thats why i have used the curtab.childfileds array.
Is there a way to create a tabpage from a userclass, or am i having a stupid day.
Regards
Frank.
Bodo Bergmann <Bodo.Bergmann at ingres.com> wrote:
Hi Frank,
as your TabPage is mapped to a userclass object anyway,
why don't you just validate the according attribute values of this object
(or the objects, if each tabpage is mapped to a different userclass object) ?
Bodo.
Bodo Bergmann
Senior Software Engineer
OpenROAD Worldwide Development
Ingres Corp.
---------------------------------
From: openroad-users-bounces at peerlessit.com [mailto:openroad-users-bounces at peerlessit.com] On Behalf Of FRANK BARRATT
Sent: Tuesday, October 23, 2007 2:19 PM
To: openroad-users at peerlessit.com
Subject: [Openroad-users] Tabpages
Hi,
I am dynamically creating tab pages on a tabfolder using this
FIELD(my_tab).AddTabPage(subform = FIELD(mysub),tabtext = 'Page ' + varchar(FIELD(my_tab).tabpagearray.lastrow + 1),pagenum = FIELD(mytab).tabpagearray.lastrow + 1);
mysub is a hidden subform based on a userclass containing lots of fields and is the same for each tabpage.
At the moment i get the current field values for validation by the
curtab = FIELD(my_tab).CurTabPage method.
I then loop through the curtab.childfields to get my field values.
My question is there an easier way of accessing the field values from my dynamic tabs without looping through the childfields array as this is getting a bit messy.
Thanks in advance.
Frank.
________________________________________________________________
OpenROAD-Users mailing list
You can maintain your subscription here:
http://www.peerlessit.com/mailman/listinfo/openroad-users
To unsubscribe click on this link
mailto:openroad-users-unsubscribe at peerlessit.com&subject=unsubscribe
To subscribe click on this link
mailto:openroad-users-subscribe at peerlessit.com&subject=subscribe
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.peerlessit.com/pipermail/openroad-users/attachments/20071025/34a18181/attachment.html
More information about the Openroad-users
mailing list