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
 OE_WIN_CLOSE

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
starman2049 Posted - 01/29/2010 : 4:58:42 PM
I am creating a chart that in the background creates a hidden worksheet. how do I set it up so when I close the chart it deletes the worksheet? Is there a property of the chart, or a way to hook the OE_WIN_CLOSE?

Origin Ver. and Service Release (Select Help-->About Origin): 8.1
Operating System: XP
4   L A T E S T    R E P L I E S    (Newest First)
cpyang Posted - 04/07/2010 : 09:53:32 AM
I guess when it is executing, the window you are trying to close is still valid, but since it is in the middle of closing, explicit command to close it will trigger an error.

You can protect any script from generating an error by putting it inside { }, so try


"%A=this.text$; {win -cd %A}";


To be more precise, there is a system variable that tells you Origin is closing down, @CW. So the better code is


"if(@CW>0) {%A=this.text$;win -cd %A}";



CP

starman2049 Posted - 04/02/2010 : 5:59:33 PM
OK, so everything works just fine when I close the chart, it closes/deletes the worksheet/matrix behind the chart. The problem I am having is that if I have an open chart and I close *Origin* then there is something about the sequence of deleted that gives me this error:

"Error: Failed to execute script"

I tried changing it from:

GraphObject goHiddenText = gl.CreateGraphObject(GROT_TEXT);
goHiddenText.Text = ml.GetPage().GetName();
goHiddenText.X = -10000;
string script = "%A=this.text$; win -cd %A";
SetEventScript(goHiddenText, script, GRCT_WINCLOSE);


to:

string script = "%A=this.text$; if (exist(%A)>0) win -cd %A";


But that doesn't help. Any ideas?
starman2049 Posted - 02/01/2010 : 1:23:15 PM
Thanks - worked great! NB: in order to make "hidden" I set the .X property to -10000
cpyang Posted - 01/29/2010 : 10:51:16 PM
Add a hidden text object, save the wks name into its .Text, set it to execute script on window close (GRCT_WINCLOSE) and run script like

%A=this.text$;
win -cd %A;

To add a text object, best to look at add_text function inside

#include <..\originlab\grobj_utils.h>

or just use those utility functions by adding grobj_utils.c.

To set the object to execute LT script, use

set_LT_script

or look at that function in <..\originlab\grobj_utils.c>

CP



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