List field problem

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
Happyrever
Posts: 55
Joined: Sat Sep 10, 2011 12:22 pm

List field problem

Post by Happyrever » Mon Sep 26, 2011 5:53 pm

Example,
I have a simple list field of 4 items where the user clicks a line to select an item.

I have used
Put empty into line 4 of field "Index"
to remove all content in that last line.
However, line 4 is still selectable and this is undesireable.
How can I prevent the deleted line from highlighting or being selectable?

Dixie
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 1336
Joined: Sun Jul 12, 2009 10:53 am

Re: List field problem

Post by Dixie » Mon Sep 26, 2011 6:13 pm

Happyrever...:-)

put this into the script of your listfield and it will delete the line that you click on...

Code: Select all

on mouseDown
   put word 2 of the clickline into theLineToDelete
   delete line theLineToDelete of me
end mouseDown
be well

Dixie

Happyrever
Posts: 55
Joined: Sat Sep 10, 2011 12:22 pm

Re: List field problem

Post by Happyrever » Mon Sep 26, 2011 6:24 pm

I dont understand the code. I tried it and it wipes out the whole list. I does however leave the list without any selectable lines.

Perhap not quite what I was expecting. what was the logic behind the code?

Dixie
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 1336
Joined: Sun Jul 12, 2009 10:53 am

Re: List field problem

Post by Dixie » Mon Sep 26, 2011 6:57 pm

Happyrever...

If everything is being deleted when you click on a line in the field, then all of the content that you have in that field must be one long line... I have attached a stack that uses the script I posted earlier... It works here...:-) If you click on a line then it is deleted... isn't that what you wanted to happen ?.. I would also suggest having a look at the 'clickline' entry in the dictionary..

hope it helps...

Dixie
Attachments
delLine.livecode.zip
(939 Bytes) Downloaded 245 times

Happyrever
Posts: 55
Joined: Sat Sep 10, 2011 12:22 pm

Re: List field problem

Post by Happyrever » Tue Sep 27, 2011 10:10 am

I do appreciate your time and trouble with your reply, however, you have assumed incorrectly that the user clicks the line in question to delete it.
The line in question i.e. the one with the problem, is always the last item in the list plus 1
Take your example. If you click one of the middle numbers, a blank line is created in that position and the remaining numbers do not move.
In my case, the line clicked causes the numbers below it to move up and no blank line is created. The original item at the end of the list has moved up and there is a blank line where it used to be. The blank line is still highlited and selectable and this is not acceptable.

Answer number of lines in field "Index"
shows the correct answer; the visible list items and not the blank but selectable line that causes the problem.

Do you have an answer to tidy up the offending blank line?

Happyrever
Posts: 55
Joined: Sat Sep 10, 2011 12:22 pm

Re: List field problem

Post by Happyrever » Tue Sep 27, 2011 10:51 am

Problem resolved!

Dixie
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 1336
Joined: Sun Jul 12, 2009 10:53 am

Re: List field problem

Post by Dixie » Tue Sep 27, 2011 10:56 am

I'm happy that you sorted it as your explanation has left me now totally confused... :D

be well

Dixie

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

Re: List field problem

Post by dunbarx » Tue Sep 27, 2011 2:29 pm

I think the simple miscommunication was that at first Happyrever put empty into the line, whereas dixie, correctly, advised him to delete that line. There is a difference, of course.

Things went downhill from there, and the clicking was likely at fault, but all ended happily.

Craig Newman

Post Reply