Author |
Topic |
|
jdf726
78 Posts |
Posted - 10/09/2012 : 07:00:17 AM
|
i am having a problem programatically inserting labels that contain references to worksheet data.
my code loads (from a configuration file) some text which contains references to data from a worksheet.
i used the createtextlabel function from this page http://www.originlab.com/forum/topic.asp?topic_id=8001
to create a label with this text.
the label contains stuff like %(info,"date",1), which (should) load in values from certain cells in the 'info' workbook. this works fine when i do it manually as long as the 'link to variables' checkbox is engaged in the programming control panel. the problem is, my newly created labels have this checkbox cleared.
how do i create a new label and ensure that its contents will be linked to variables?
origin 8.5.0 sr1, windows |
|
jdf726
78 Posts |
Posted - 10/09/2012 : 07:50:30 AM
|
here is the function call
i = createtextlabel('titletext', 10, 10, titletext, -1, 20);
as far as i understand the parameters are: the 'handle' of the label to be created (object name). the coordinates of the label, i am not sure what the units are though ;-) the contents of the label the typeface and font size.
one thing that is odd is that the handle text that i have specified above gets replaced with a 'thorn' character (which i recognise from when my wife was a historian), which is character alt+0254.
maybe its a bad idea to make the label name the same as the originc that holds the variable contents... |
|
|
Penn
China
644 Posts |
Posted - 10/09/2012 : 11:31:08 PM
|
Hi,
Fo enable the "link to variables" checkbox, you can use the format tree, such as:
Tree tr;
tr.Root.LinkToVars.nVal = 1;
if(go.UpdateThemeIDs(tr.Root) == 0)
{
go.ApplyFormat(tr, true, true);
}
For more details about format tree, you can use the GetFormat method to get the format tree, and then set a break point to see the tree contents.
For the unit issue, you can refer to this page.
Penn |
Edited by - Penn on 10/10/2012 05:07:25 AM |
|
|
jdf726
78 Posts |
Posted - 10/10/2012 : 05:01:29 AM
|
Thanks for the suggestion, I'll try that out.
In the short term, I resorted to executing the labtalk 'label' command via originc including the 'link to variables' flag '-sl'. I then used the -px positioning command in the label labtalk command to get the positioning roughly right.
The link that you included on the positioning units doesn't seem to load. I found the page that you suggested manually though, thanks.
http://ocwiki.originlab.com/index.php?title=OCGuide:Creating_and_Accessing_Graphical_Objects#Setting_Position_and_Size
Is the 'title' URL argument in the wiki index.php page case sensitive? (the 'working' url had different capitalisation).
Cheers
jdf726
|
|
|
Penn
China
644 Posts |
Posted - 10/10/2012 : 05:14:16 AM
|
Hi,
Yes, you can also use the LabTalk command.
About the links problem, it is case sensitive, that is my mistake, and sorry for that. Now I fix the links in my previous reply, you can check again.
Penn |
|
|
jdf726
78 Posts |
Posted - 10/10/2012 : 05:16:26 AM
|
Oh yeah, one last thing. Is the LinkToVars option documented somewhere? (along with the rest of the 'tree' structure)
I thought I searched both the web and the origin documentation for this subject and I didn't find anything. Maybe I didn't look in the right places.
|
|
|
Penn
China
644 Posts |
Posted - 10/10/2012 : 05:24:09 AM
|
Hi,
Because different object will have different format tree, there is no document for each object's format tree currently. As I mentioned before, you need to use the GetFormat method to get the format tree, and then set a break point to see the structure of the tree for the used object.
Penn |
|
|
declan.frost@yahoo.com
USA
1 Posts |
Posted - 10/16/2012 : 03:04:55 AM
|
Joomla!'s built in session handling capabilities make it easy to retain values of certain variables across page accesses. This makes development much simpler because the developer no longer has to worry about losing variable values if it is left out of a form. Storing variables with sessions also makes the application cleaner and tidier since it reduces the amount of form variables, and persistent variables no longer have to be passed in either the query string (making very long URLs) or in POST variables.
http://annapolisdentalcare.com/extractions_arnold_dental_extractions_annapolis_anne_arundel_county_md.php
|
|
|
|
Topic |
|
|
|