The Origin Forum
File Exchange
Try Origin for Free
The Origin Forum
Home | Profile | Register | Active Topics | Members | Search | FAQ | Send File to Tech support
 All Forums
 Origin Forum for Programming
 Forum for Origin C
 Array of worksheets

Note: You must be registered in order to post a reply.
To register, click here. Registration is FREE!

Screensize:
UserName:
Password:
Anti-Spam Code:
Format Mode:
Format: BoldItalicizedUnderlineStrikethrough Align LeftCenteredAlign Right Horizontal Rule Insert HyperlinkUpload FileInsert Image Insert CodeInsert QuoteInsert List
   
Message:

* HTML is OFF
* Forum Code is ON
Smilies
Smile [:)] Big Smile [:D] Cool [8D] Blush [:I]
Tongue [:P] Evil [):] Wink [;)] Clown [:o)]
Black Eye [B)] Eight Ball [8] Frown [:(] Shy [8)]
Shocked [:0] Angry [:(!] Dead [xx(] Sleepy [|)]
Kisses [:X] Approve [^] Disapprove [V] Question [?]

 
Check here to subscribe to this topic.
   

T O P I C    R E V I E W
icefox Posted - 08/27/2012 : 04:33:14 AM
Origin Ver. 8.6.0G and Service Release Sr3
Operating System: WinXP

Hello,

my problem might be trivial to you - but I canīt get it work, there is always a failure when SensNr > 0.

Canīt I create an array of worksheets like
Worksheet wksa[6];

and later in code create one by one like
for (int SensNr = 0 ; SensNr <= 5 ; SensNr++ )
{
   wksa[SensNr].Create("Origin.otw", CREATE_VISIBLE);
}


Could anyone give me a hint what iīm doing wrong?

Thanks,

icefox

______
Icefox
3   L A T E S T    R E P L I E S    (Newest First)
icefox Posted - 08/27/2012 : 09:45:50 AM
Hello,

thanks for your answers.

But isnīt this a little bit complicated?

I thought i could get my worksheets in a simple array like i can work with Dataset-Arrays (which works fine)

Dataset DS_Mode[6];		      
for (int SensNr = 0 ; SensNr <= 5 ; SensNr++ )
{
 DS_Mode[SensNr].Attach(strPageName + "_S" + (SensNr+1) + "Mode"); DS_Mode[SensNr].SetSize(nRows);     
}


(Please note: Iīm only a occasional user...)

But thanks for your answers,

icefox

______
Icefox
Penn Posted - 08/27/2012 : 05:57:56 AM
Hi,

When using the Array class, please remember to include the header file.

#include <Array.h>


Penn
rlewis Posted - 08/27/2012 : 05:04:56 AM
You coulduse Origin's Array class ..
Try something like


void UsingWorksheetPageArray(int NumPages)
 {
 	Array<PageBase&> wPages;
 	if(PopulatePageArray(wPages,NumPages)==NumPages)
 	{
 		for(int i=0;i<NumPages;i++)
 		{
 			WorksheetPage wPg=wPages.GetAt(i);
 			if(wPg.IsValid()==true)
 			{
 				out_str(wPg.GetName());
 			}
 		}
 		out_str("Success");
 	}
 	else
 	{
 		out_str("Failure");
 	}
 }



int PopulatePageArray(Array<PageBase&> &wPages, uint NumPages)
{
	wPages.SetSize(0);
	for(int i=0;i<NumPages;i++)
	{
		WorksheetPage wPg;
		wPg.Create("Origin.otw",CREATE_HIDDEN);
		if(wPg.IsValid()==true)
		{
			WorksheetPage *pwPg;
			pwPg=new WorksheetPage(wPg);
			wPages.Add(*pwPg);
		}
	}
	return (wPages.GetSize());
}

The Origin Forum © 2020 Originlab Corporation Go To Top Of Page
Snitz Forums 2000