[Openroad-users] Tabpages

Bodo Bergmann Bodo.Bergmann at ingres.com
Thu Oct 25 19:47:25 EST 2007


Just an addition:
You don't have to switch the bias of the tabpages,
as they aren't available anyway (as the TabField has been removed),
so here is the corrected code.
 
initialize()=
declare
    i=INTEGER NOT NULL;
    lastvis=INTEGER NOT NULL DEFAULT 1;
    cust1 = customer DEFAULT NULL;
    tabflds_ori = ARRAY OF TabField DEFAULT NULL;
    tabflds = ARRAY OF TabField;
    tabpages = ARRAY OF TabPage DEFAULT NULL;
enddeclare
{
    tabpages = FIELD(field1).tabpagearray;
    tabflds_ori = FIELD(field1).TabBar.tabfieldarray;
    FOR i=1 TO tabflds_ori.LastRow DO
        tabflds[i] = tabflds_ori[i];
    ENDFOR;
    
    // Make pages 2 to 8 unavailable by removing their TabFields
    FOR i=8 DOWNTO 2 DO
        tabflds_ori.RemoveRow(rownumber=i);
    ENDFOR;
    FIELD(field1).UpdField();
}
 

ON CLICK add_btn =
{
    IF lastvis<8 THEN
        lastvis = lastvis+1;
        tabflds_ori.InsertRow(rownumber=lastvis,
rowobject=tabflds[lastvis]);
        FIELD(field1).UpdField();
        FIELD(field1).CurPageIndex = lastvis;
    ELSE
        MESSAGE 'Only 8 pages allowed';
    ENDIF;
}
 

ON CLICK check_btn =
{
    FIELD(field1).CurTabPage.GetFieldValue(value=BYREF(cust1));
    MESSAGE cust1.Name;
}

 
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 Bodo
Bergmann
Sent: Thursday, October 25, 2007 11:31 AM
To: International OpenROAD Users
Subject: Re: [Openroad-users] Tabpages


Frank,
 
as you know that there are only up to 8 tabpages,
why don't you just create a TabFolder (with Declared=TRUE) with 8
tabpages
(with each tabpage already having the fields created and datatype set to
your userclass)?
Then make the pages available at runtime by click on the button.
 
Example.:
 
initialize()=
declare
    i=INTEGER NOT NULL;
    lastvis=INTEGER NOT NULL DEFAULT 1;
    cust1 = customer DEFAULT NULL;
    tabflds_ori = ARRAY OF TabField DEFAULT NULL;
    tabflds = ARRAY OF TabField;
    tabpages = ARRAY OF TabPage DEFAULT NULL;
enddeclare
{
    tabpages = FIELD(field1).tabpagearray;
    tabflds_ori = FIELD(field1).TabBar.tabfieldarray;
    FOR i=1 TO tabflds_ori.LastRow DO
        tabflds[i] = tabflds_ori[i];
    ENDFOR;
    
    // Make pages 2 to 8 invisible
    FOR i=8 DOWNTO 2 DO
        tabpages[i].CurBias = FB_INVISIBLE;
        FIELD(field1).TabBar.tabfieldarray.RemoveRow(rownumber=i);
    ENDFOR;
    FIELD(field1).UpdField();
}
 

ON CLICK add_btn =
{
    IF lastvis<8 THEN
        lastvis = lastvis+1;
        tabpages[lastvis].CurBias = FB_CHANGEABLE;
        tabflds_ori.InsertRow(rownumber=lastvis,
rowobject=tabflds[lastvis]);
        FIELD(field1).UpdField();
        FIELD(field1).CurPageIndex = lastvis;
    ELSE
        MESSAGE 'Only 8 pages allowed';
    ENDIF;
}
 

ON CLICK check_btn =
{
    FIELD(field1).CurTabPage.GetFieldValue(value=BYREF(cust1));
    MESSAGE cust1.Name;
}

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: Thursday, October 25, 2007 9:28 AM
To: openroad-users at peerlessit.com
Subject: Re: [Openroad-users] Tabpages


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 <mailto:Bodo.Bergmann at ingres.com>  
	To: International OpenROAD Users
<mailto:openroad-users at peerlessit.com>  
	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/d47c63bf/attachment-0001.html 


More information about the Openroad-users mailing list