Author |
Topic  |
|
J Larsen
USA
Posts |
Posted - 11/23/2003 : 1:00:06 PM
|
Included in my version of Origin 7.0 is an Origin C sample code called "Automation". This sample code appears to add annotations to the graph template "automation.otp" without resorting to any LabTalk code. When I try to modify the code to add annotations to my own graph templates, I get "object not found" errors. Can anyone clue me in to how the "Automation.c" code generates annotations so that I can do it in my own code? Thanks. |
|
easwar
USA
1965 Posts |
Posted - 11/23/2003 : 2:12:58 PM
|
Hello,
The automation.otp template was saved with text labels already placed in the graph, and the OC code just refers to those text labels. The same is done with the worksheet template, automation.otw.
So you could first create your custom graph, then place text labels, give them unique names if you want to (Origin gives default names such as Text, Text1 etc) and then save the template. Then later in the OC code you can refer to these label objects, which are graphical objects, and change their properties, such as the text string to be displayed etc.
If you look at the code in that example, you will see statements such as: GraphObject grGTxtSampleID, grGTxtDateTime; grGTxtSampleID = grphLayer.GraphObjects("txtID"); grGTxtDateTime = grphLayer.GraphObjects("txtDateTime");
If you make the graph window active (which was created using the special template), and then select the menu item Edit|Button Edit mode, you will see the names txtId, txtDateTime etc. adjacent to the text labels.
Hope this helps. If you have more questions, please post again.
Easwar OriginLab.
|
 |
|
J Larsen
USA
Posts |
Posted - 11/23/2003 : 7:24:28 PM
|
Thanks, I'll try that in the morning when I'm back at my work computer. I tried to do something very similar with my graph template, but I didn't realize that I could name the text fields.
There is one other thing I wanted to ask but forgot. The text fields in the automation.otp graph template are not clickable and do not appear to be editable. How is this done?
Thanks again. |
 |
|
Mike Buess
USA
3037 Posts |
Posted - 11/23/2003 : 11:16:54 PM
|
Edit|Button Edit Mode will make them editable.
Mike Buess Origin WebRing Member |
 |
|
easwar
USA
1965 Posts |
Posted - 11/24/2003 : 09:57:20 AM
|
quote:
There is one other thing I wanted to ask but forgot. The text fields in the automation.otp graph template are not clickable and do not appear to be editable. How is this done?
Hi,
Right-click on a label and then picl Label Control from the context menu. This will open the Label Control dialog. In that dialog, there are check boxes that can be turned on to restrict vertical/horizontal movements and also to disable selection (which is what was done in the sample project). Once you disable selection, you need to used Edit->Button Edit mode menu item to be able to bring up the context menu - which is what you need to do with the labels in the sample template.
Easwar OriginLab.
|
 |
|
|
Topic  |
|
|
|