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
 activate graph window

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
sebbey Posted - 06/22/2012 : 06:55:18 AM
Origin Ver. : 8.6.0G
Operating System: Windows 7 Professional

Hi everyone,

I'm trying to merge two graphs. Both are embedded in a worksheet. Graph 1 is embedded in the Worksheet "Graphs1" and Graph2 is embedded in the Worksheet "Graphs2".

If I use the following script in the script window, my code works perfectly. However, if i run the script within codebuilder (with a customized button) it doesnt work. there's no error message and i don't know whats wrong.



page.active$=Graphs1;  //activate sheet graphs1
string gr1$=col(1)[2]$; //get name of embedded Graph
gr1.TrimLeft("embedding:");

page.active$=Graphs2; //activate sheet graphs2
string gr2$=col(1)[2]$; // get name of embedded Graph
gr2.TrimLeft("embedding:"); 

window -a %(gr1$); //open graph 1
window -a %(gr2$); // open graph 2

merge_graph option:=specified graphs:="%(gr1$)"+char(10)$+"%(gr2$)" arrange:=0 linkarrange:=0 portrait:=portrait keep:=1;  //merge graphs



can anyone help me with this??

Another quick question. How can I get the name of a table in a graph window. I know that you have to set a tablename when creating a table. My problem is, that I want to get rid of a table after I merged two graphs which both have a table in them. I have no Idea of how to get the table name.

I hope i explained my problem well enough:)

Thanks for your help,

sebbey
7   L A T E S T    R E P L I E S    (Newest First)
sebbey Posted - 06/28/2012 : 02:52:24 AM
Hi Sam,

thank you so much for your answer. Your solution works perfectly and does exactly what I wanted!!!!

Greets from Germany,
sebbey
Sam Fang Posted - 06/27/2012 : 11:47:13 PM
list -o only lists graphic objects in the current layer. So if your current graph contains tables and the current layer in the current graph doesn't contain a table, list -o will not list tables.

Assume that layer 1 in the current graph contains tables, and we don't know table names. You can use following script to move all tables in the layer to the right.

page.active=1;
doc -e G
{
   string str1=%B;
   if( str1.GetLength()>=5 )
   {
       string str2 = str1.Left(5)$;
       if( str2.Compare("Table")==0 )
       {
                GObject tab=%B;
                tab.x = layer.x.to - tab.dx/2;
       }
   }
}


Sam
OriginLab Technical Services
sebbey Posted - 06/27/2012 : 05:54:01 AM
Hi Sam,

thanks for your answer.

If I run the list -o command, I get this:


list -o;
1 0  Text1,	0x1f362720
2 0  Text,	0x1f362810
3 3  BMP,	0x1f362900
4 0  YL,	0x1f3629f0
5 0  XB,	0x1f362ae0


I wonder, why the included table isn't even listed. But if it was listed, I still wouldn't know how to use the doc -e G command. And the help-file doesn't really help me.
Could you maybe give me an example?

Lets say if a Table1 was listed. I would like to move this table to the right (how much doesn't matter). Could you maybe write me a little script, so that I get a feeling for the use of the doc -e command?

Thanks in advance,
sebbey
Sam Fang Posted - 06/26/2012 : 04:50:47 AM
Thanks for your reply.

You can use doc -e G to loop all graphic objects including tables in the current graph layer. And %B contains the object name in each iteration. Table is prefixed to a table's name by default.

Sam
OriginLab Technical Services
sebbey Posted - 06/26/2012 : 03:32:42 AM
Hi Kathy,

thanks for your answer. The first problem is already solved. I don't know what you mean, when you ask if my customizing button is in the same workbook as the embedded graph.
My script starts by clicking on the toolbar button. This script does access the workbook in which my graphs are embedded.

The list -o command, as well as the right-click on the table don't help me. or is it somehow possible to kind of extract a single string/name of the shown list, when i use the list -o command.

With my script I'm merging two graph windows. Both Graph windows include a table. After merging the graphs, the tablenames have changed.
In order to beeing able to work with the tables (for example delete them, change values, ...) I need to get the current tablename in a string variable. I'm writing the script for somebody else. So clicking on a table to get its name is no option for me, since everything should work out automatically by simply clicking the toolbar button.

Is there another way or maybe a workaround to my problem?

Greetz,
sebbey
Kathy_Wang Posted - 06/26/2012 : 02:42:59 AM
Hi,

I actually cannot reproduce your first problem, is your customizing button in the same workbook of your embedded graph?

For the second question, you could use either
list -o
to get the names of all objects(including tables)


or you could right click on the table, choose "Programming Control" to open the dialog, and the "Object Name" is the table name used in labtalk scripts.

Kathy
Originlab
sebbey Posted - 06/25/2012 : 07:30:51 AM
Hi everyone,

I found the error in my Code.
This is the code I use now:


page.active$=Graphs1; //activate sheet graphs1
string gr1$=[%(bkname$)]Graphs1!col(1)[2]$; //name of embedded Graph
gr1.TrimLeft("embedding:");

page.active$=Graphs2; //activate sheet graphs2
string gr2$=[%(bkname$)]Graphs2!col(1)[2]$;//name of embedded Graph
gr2.TrimLeft("embedding:");

window -a %(gr1$); //open/activate Graph window
window -a %(gr2$);



Since the workbook %(bkname$) is already active and the "Graphs"-Sheets are beeing activated within the given code, I don't really understand why it didn't work in the first place.


My second problem is still unsolved. I want to delete a table which is situated in a graph window. How can I do this using a LabTalk script. The Problem I have is, that I don't know the table name.


Thanks again,
Sebbey

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