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
 LabTalk Forum
 Renaming selected column from button script

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
NicholasSupport Posted - 01/06/2025 : 8:23:11 PM
I am trying to make a button that renames the selected column.

The button executes this script:
double freq = 32.703;
wks.col.LNAME$="C1";
// Generate sine
csetvalue formula:="sin(2*pi*freq*col(A))" recalculate:=0;
// Set Sparklines
sparklines sel:=1;


Currently, when the button is triggered, column C is renamed no matter which column is selected. The sine wave data does, however, fill to the selected column.

How do I script the button to rename the column that it is filling with data?

Best,

Nicholas G.
nicholas@originlab.com
OriginLab Technical Support Team
1   L A T E S T    R E P L I E S    (Newest First)
minimax Posted - 01/07/2025 : 08:54:50 AM
wks.col does not refer to selected column.

You may try using wks.c1.


double freq = 32.703;
if (wks.c1==1)
	{type -a "cannot set col(A)";return;}
//wks.c1 refers to leftmost selected column
wks.col$(wks.c1).lname$="C1";
//provide selected col as input
csetvalue col:=$(wks.c1) formula:="sin(2*pi*freq*col(A))" recalculate:=0;
sparklines sel:=1;

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