Page 1 of 1
Entering text on a card
Posted: Thu Apr 11, 2013 11:08 pm
by vkelmenson
Hi everyone. I am new to the forum, although I have been using Livecode for around one year.
I cannot figure out how to draw text onto a card. I am doing some graphing and I wish to label the graph. This will include labeling the axes and some labels on the line graphs. Thanks in advance Victor
Re: Entering text on a card
Posted: Thu Apr 11, 2013 11:15 pm
by Simon
Hi Victor,
I must not be understanding the question because you just drag a text entry field onto you card and enter text.
Or was there something more to your question? Dynamically do you mean?
Simon
Re: Entering text on a card
Posted: Thu Apr 11, 2013 11:19 pm
by vkelmenson
Simon, Yes I mean dynamically. The axes will have different placements and labeling depending on the range of values to graph. Therefore I would not be able to drag a text entry as I design the card. Also the graphed lines will have different shapes and positioning depending on the data values. Therefore, I need a way to put text labels( which will often be numbers) by code. Victor
Re: Entering text on a card
Posted: Thu Apr 11, 2013 11:28 pm
by Simon
OK,
To start, all your text will be horizontal, there are ways to rotate them by taking a snapshot but thats for later. You have two empty fields (best use a label field) named fieldX and fieldY
You just need to:
put "this is my Y Label" into field "fieldY"
put "this is my X label" into field "fieldX"
Simon
Re: Entering text on a card
Posted: Thu Apr 11, 2013 11:46 pm
by dunbarx
Hi.
Simon is right about loading text.
Do you know how to create a field on the fly, set its loc, and also set its rect, perhaps according to the amount of text it holds? I think that is what you were asking as well, but please let us know.
Craig Newman
Re: Entering text on a card
Posted: Fri Apr 12, 2013 7:25 pm
by vkelmenson
Craig, You are correct. That is what I was asking. Victor
Re: Entering text on a card
Posted: Fri Apr 12, 2013 7:38 pm
by dunbarx
So you are creating (or showing) fields that need to be a certain size, at a certain loc, and containing certain text.
Code: Select all
on mouseUp
create fld "xAxis"
set the rect of the last field to "200,200,300,220" -- or whatever
put the short name of the last field into the last field
end mouseUp
Re: Entering text on a card
Posted: Fri Apr 12, 2013 8:08 pm
by dunbarx
Forgot one thing.
Read up on the "formattedWidth" as it relates to fields. You cannot set this property, only read it, so you would have to find its value, and then set the width (or the original rect) of your new field as required.
Craig Newman
Re: Entering text on a card
Posted: Fri Apr 12, 2013 11:27 pm
by vkelmenson
Thanks, I will give it a try. I think that this will work with what I plan. Victor