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
 Help: Selecting active layer

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
hschausb Posted - 08/18/2020 : 06:26:33 AM
Hello there, (general Kenobi)

I need your help with a trivial problem.
I am trying to select the active layer of a specific worksheet in a project with multiple worksheets.

My code is as followed:
WorksheetPage inpMALDI = Project.WorksheetPages("Book1");			
WorksheetPage inpReak = Project.WorksheetPages("Book2");			
WorksheetPage calMZ = Project.WorksheetPages("Book3");		

Worksheet rawData = inpMALDI.Layers(0);					
Worksheet input = inpReak.Layers(0);						
Worksheet calculation = calMZ.Layers(0);	


I want to use the current active layer of the rawData worksheet to be used in my program.
I looked up several examples and looked up the building of a worksheet.

All examples in origin C use the
Project.ActiveLayer()
command, which does not work for me. I need the active layer of “Book1” and not a random woksheet.

The building process of “Worksheet” and “Layer” does not state a way to implement the active layer without using the command mentioned above. I cannot use string names due to dynamic name changes of the layers and this command
Worksheet( Layer & layer)
is the way I am using it now (I think). I cannot see a way to implement the active layer onto the Worksheet.


Does anybody know a way to do it?
I am sure I`m reading something wrong at the command description or I`m not thinking of the obvious, because I cannot imagine that it is impossible to implement the active layer of a specific worksheet.
Please tell me where I am reading it wrong as well, so I can learn from my mistakes.

Thank you very much.
3   L A T E S T    R E P L I E S    (Newest First)
Chris D Posted - 08/18/2020 : 09:12:50 AM
Hi,

By "To get the active layer of a page, you could check the methods of the page", I think Castiel just means to read the docs.

The -1 in the call to

Worksheet wksActive = wp.Layers(-1);


Is just a flag to indicate the active Worksheet.

Thanks,
Chris Drozdowski
Originlab Technical Support
hschausb Posted - 08/18/2020 : 07:28:01 AM
Thank you. This worked fine.

But would you mind elaborating what the count (-1) stands for?
And why would I check the methods of a page. I do not get that. Mainly because I do not know what a method of a page is. I thought a page only consists of objects (OriginObjects).
Castiel Posted - 08/18/2020 : 06:39:42 AM
quote:
Originally posted by hschausb

Hello there, (general Kenobi)

I need your help with a trivial problem.
I am trying to select the active layer of a specific worksheet in a project with multiple worksheets.

My code is as followed:
WorksheetPage inpMALDI = Project.WorksheetPages("Book1");			
WorksheetPage inpReak = Project.WorksheetPages("Book2");			
WorksheetPage calMZ = Project.WorksheetPages("Book3");		

Worksheet rawData = inpMALDI.Layers(0);					
Worksheet input = inpReak.Layers(0);						
Worksheet calculation = calMZ.Layers(0);	


I want to use the current active layer of the rawData worksheet to be used in my program.
I looked up several examples and looked up the building of a worksheet.

All examples in origin C use the
Project.ActiveLayer()
command, which does not work for me. I need the active layer of “Book1” and not a random woksheet.

The building process of “Worksheet” and “Layer” does not state a way to implement the active layer without using the command mentioned above. I cannot use string names due to dynamic name changes of the layers and this command
Worksheet( Layer & layer)
is the way I am using it now (I think). I cannot see a way to implement the active layer onto the Worksheet.


Does anybody know a way to do it?
I am sure I`m reading something wrong at the command description or I`m not thinking of the obvious, because I cannot imagine that it is impossible to implement the active layer of a specific worksheet.
Please tell me where I am reading it wrong as well, so I can learn from my mistakes.

Thank you very much.




To get the active layer of a page, you could check the methods of the page.

To get the active Worksheet of a WorksheetPage, have a try of this:


// wp is a WorksheetPage
Worksheet wksActive = wp.Layers(-1);



------------------------------------------
       Be The Change
             You Want To See
                   In The World
------------------------------------------

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