Entering text on a card

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Post Reply
vkelmenson
Posts: 7
Joined: Thu Apr 11, 2013 11:03 pm

Entering text on a card

Post by vkelmenson » Thu Apr 11, 2013 11:08 pm

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

Simon
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3901
Joined: Sat Mar 24, 2007 2:54 am

Re: Entering text on a card

Post by Simon » Thu Apr 11, 2013 11:15 pm

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
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!

vkelmenson
Posts: 7
Joined: Thu Apr 11, 2013 11:03 pm

Re: Entering text on a card

Post by vkelmenson » Thu Apr 11, 2013 11:19 pm

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

Simon
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3901
Joined: Sat Mar 24, 2007 2:54 am

Re: Entering text on a card

Post by Simon » Thu Apr 11, 2013 11:28 pm

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
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10331
Joined: Wed May 06, 2009 2:28 pm

Re: Entering text on a card

Post by dunbarx » Thu Apr 11, 2013 11:46 pm

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

vkelmenson
Posts: 7
Joined: Thu Apr 11, 2013 11:03 pm

Re: Entering text on a card

Post by vkelmenson » Fri Apr 12, 2013 7:25 pm

Craig, You are correct. That is what I was asking. Victor

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10331
Joined: Wed May 06, 2009 2:28 pm

Re: Entering text on a card

Post by dunbarx » Fri Apr 12, 2013 7:38 pm

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

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10331
Joined: Wed May 06, 2009 2:28 pm

Re: Entering text on a card

Post by dunbarx » Fri Apr 12, 2013 8:08 pm

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

vkelmenson
Posts: 7
Joined: Thu Apr 11, 2013 11:03 pm

Re: Entering text on a card

Post by vkelmenson » Fri Apr 12, 2013 11:27 pm

Thanks, I will give it a try. I think that this will work with what I plan. Victor

Post Reply