[Openroad-users] Tabpages

Chris Wallace chrisw at miswa.com.au
Thu Oct 25 19:27:22 EST 2007


Frank,

 

Are the contents of all tab pages the same?

All the fields are the same, just referencing different data?

Have you thought of using dynamic frame creation?

 

This may be a little extra work to start with, but you'll eliminate all
of the gottcha's associated with trying to make static frames dynamic.

 

Depending on your requirements, you could duplicate the existing frame
(as a template) adding the new tab and extending the frame script to
suit, or you could recreate the frame and script if the logic varies
depending on the number or type of tabs.  Also, if you can structure you
application logic to optimise the use of procedures, you can avoid the
need to generate large amounts of in-line code. 

 

All of the ON <events> could be defined in an include script that uses
macros to substitute the appropriate tabpage page reference (ie.

INITIALIZE =

DECLARE

ENDDECLARE

BEGIN

END

 

#DEFINE tabpagename tab1

#INCLUDE tabscript

 

#DEFINE tabpagename tab2

#INCLUDE tabscript

etc.

 

tabscript

 

ON ACTIVATE $tabpagename =

{

  // do something

}

 

ON EXIT $tabpagename.field01 =

{

  // do something

#IF $tabpagename = 'tab1' THEN

    // do something different

#ENDIF

}

 

Hope this helps, let me know if you want to explore this further.

 

Regards

Chris Wallace
Management Information Systems (WA) Pty Ltd

Level 9, MIS House

Adelaide Terrace, PERTH  WA  6000
Ph: (08) 9221-9221  Fax: (08) 9221-9224
Email: chrisw at miswa.com.au <mailto:chrisw at miswa.com.au> 
Web: http://www.miswa.com.au

Disclaimer <http://www.miswa.com.audisclaimer/> :  Management
Information Systems (MIS) is a wholly-owned subsidiary of Ingres
Australia P/L
This e-mail is private and confidential. If you are not the intended
recipient, please advise us by return e-mail immediately, and delete the
e-mail and any attachments without using or disclosing the contents in
any way. The views expressed in this e-mail are those of the author, and
do not represent those of MIS unless this is clearly indicated.  You
should scan this e-mail and any attachments for viruses.  MIS accepts no
liability for any direct or indirect damage or loss resulting from the
use of any attachments to this e-mail.

________________________________

From: openroad-users-bounces at peerlessit.com
[mailto:openroad-users-bounces at peerlessit.com] On Behalf Of FRANK
BARRATT
Sent: Thursday, 25 October 2007 15:28
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/84d27165/attachment.html 


More information about the Openroad-users mailing list