Draw text?

LiveCode is the premier environment for creating multi-platform solutions for all major operating systems - Windows, Mac OS X, Linux, the Web, Server environments and Mobile platforms. Brand new to LiveCode? Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
ibe
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 61
Joined: Sun Oct 04, 2009 12:15 pm

Draw text?

Post by ibe » Mon Mar 15, 2010 5:51 pm

I have a card in my app that can have over 100 text labels all around the window. My question is do I really have to use Label objects? I would prefer just to dynamically draw the text in the appropriate locations like in Windows you can use the DrawText() function to specify an area of the screen where to draw the text.

Or should I have a large empty graphic as the background of the window. If so, how would I draw text into it. I find it hard to believe something like this isn't possible.

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

Re: Draw text?

Post by dunbarx » Mon Mar 15, 2010 6:19 pm

In HC you could use fields or bitmapped text. I used to do this, but found no benefit. Fields are so much more flexible and easier to manage.

What do you see as the advantages in such a thing? Better, what are the disadvantages?

Craig Newman

ibe
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 61
Joined: Sun Oct 04, 2009 12:15 pm

Re: Draw text?

Post by ibe » Mon Mar 15, 2010 7:05 pm

I'm implementing a calendar interface. When the user resizes the window I can easily calculate where all the texts should be placed (day numbers, event names, etc.). It might be that there are only a few event texts that need to be shown or there could be a hundred. If I have only 2 events showing should I hide the other 98 labels? Seems a bit awkward.

If you feel this is easily accomplished using fields could you give a suggestion on how to name them? Should I have an array of labels?

kotikoti
Posts: 72
Joined: Tue Apr 15, 2008 7:35 pm

Re: Draw text?

Post by kotikoti » Mon Mar 15, 2010 11:39 pm

Ide,
You could make use of the tooltip item to contain the "label" text and via script create the display labels for the individual object as required.
You can post a sample of your requirement and we could suggest on how best to achieve this too.
Build 160
Version 2.9.0
Platform: Windows

ibe
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 61
Joined: Sun Oct 04, 2009 12:15 pm

Re: Draw text?

Post by ibe » Tue Mar 16, 2010 9:23 am

The basic look I am going for is
Image
each day can have zero or several tags appearing in it.

kotikoti
Posts: 72
Joined: Tue Apr 15, 2008 7:35 pm

Re: Draw text?

Post by kotikoti » Thu Mar 18, 2010 7:00 pm

Ibe,
How I would approach this is, since I already have the calendar item drawn and I know the "dates" that have events associated, I would simply clone a text label, change its value to the content I desire and associate it with the date item (use move) to move it to an appropriate location before doing same for next item with a event.
will put together a small file with similar a implementation.
Kotikoti
Build 160
Version 2.9.0
Platform: Windows

Post Reply