Selecting data on mouse down

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
kosmo
Posts: 15
Joined: Mon Feb 17, 2014 6:05 pm

Selecting data on mouse down

Post by kosmo » Mon Feb 17, 2014 6:16 pm

I am working on a application and am trying to determine the best method of doing this:

Trying to create a word search game. I loaded a field table with data (1 character per column). On mouse down, I want to allow the user to be able to select the word. Currently I am creating a graphic each time the user selects data. Is this the best way to do this? Also, what would be the best way to return what the user selects?

Looking for any guidance.

Thanks,
Kosmo

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

Re: Selecting data on mouse down

Post by dunbarx » Mon Feb 17, 2014 7:24 pm

Hi.

Have no idea what you are trying to do. That said, it will be simple to accomplish, a hill of fun, and you will get all the help you need here.

One character per column? And a selection of one char chooses a word? Or does the user click on a series of characters? You have a table field or a data grid?

Write back with a little more info, maybe a screen shot.

Craig Newman

kosmo
Posts: 15
Joined: Mon Feb 17, 2014 6:05 pm

Re: Selecting data on mouse down

Post by kosmo » Mon Feb 17, 2014 7:39 pm

Craig,

Thanks for taking the time to respond. Much appreciated!

It is a basic game of finding the word in scrambled letters.

Here are my questions:

I am trying to determine if it is best to load in a field table? Or is there a better way to do this?

Also...when I select a value should I create a graphic for each selection? For example, in the attachment, I would create 2 graphics - one for TREE and one for HOUSE.

How would I extract the characters that I select into a variable?

Example....I need to capture TREE and HOUSE in a variable. Basically whatever the user selects, I need to capture the data.
Image 1.png
Image 1.png (9.3 KiB) Viewed 2708 times
Thanks,
Kosmo

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

Re: Selecting data on mouse down

Post by dunbarx » Tue Feb 18, 2014 12:21 am

Oh, a word finder. Cool.

There are a bunch of small obstacles you have to deal with here, but it will be a great project. As one way to get started, make another field along with your table field. Put this in the table field script:

Code: Select all

on mouseMove
   if the optionkey is down then get  the mouseText 
   if it = the last line of fld 2 then exit to top
   put  it into line the number of lines of fld 2 + 1 of fld 2
end mouseMove
This works, but needs much refinement, and may not be the best method. For example, it will fail to load duplicate letters that really live next to each other. In fact, it is rather crude. But it may get you going...

You can try a bunch of other things, but you may find that the lines of the table field become selected or other oddities. Do keep at it, and report back.

Craig

Post Reply