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
Username:
Password:
Save Password
Forgot your Password? | Admin Options

 All Forums
 Origin Forum for Programming
 Forum for Origin C
 A bug in "Add Layer" function?
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

Gutalin

5 Posts

Posted - 10/18/2010 :  07:11:21 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Origin Ver. and Service Release (Select Help-->About Origin): 8
Operating System: Win XP

Hello again,

I'm trying to add some worksheets to my active workpage by using
the "wks.AddLayer("name")-function.
But when I execute my script this error warning apears:
(...\OriginLab\Origin8\OriginC\OriginLab\SCRIPTWINDOW.H(470) :Laufzeitfehler in Origin C Funktion, Fehler bei Aufruf externer Funktion)
and Origin shuts down.

Could you help me please? I just want to add a layer...

Regards, Gutalin

Penn

China
644 Posts

Posted - 10/18/2010 :  11:27:50 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi Gutalin,

wks in your code means a worksheet, right? There is no AddLayer method for Worksheet class. This method is for Page class. You can refer to examples in this page for more information about how to use this method.

For your issue, you can use like:

Worksheet wks = Project.ActiveLayer();  // get active worksheet
if(!wks)
	return;
	
WorksheetPage wp = wks.GetPage();  // get the workbook of the worksheet
wp.AddLayer("name");  // add worksheet to the workbook


Penn
Go to Top of Page

Gutalin

5 Posts

Posted - 11/04/2010 :  08:00:45 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi Penn,

thank you very much for your response.
I tried to use your code, like before I have no problems compiling the script but I still get the same error-warning from executing it.
Is there any other possibilty to add a worksheet to a workbook without using "wp.AddLayer"?

Regards, Gutalin
Go to Top of Page

greg

USA
1378 Posts

Posted - 11/05/2010 :  12:30:47 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
This code works fine in Origin 8 or later as long as workbook is active:

void testAddLayer()
{
Worksheet wks = Project.ActiveLayer();
if(!wks) return;
WorksheetPage wp = wks.GetPage();
wp.AddLayer("name");
}

Post your code that does not work.
Go to Top of Page
  Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
The Origin Forum © 2020 Originlab Corporation Go To Top Of Page
Snitz Forums 2000