select the clickLine issue

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

select the clickLine issue

Post by Happyrever » Sat Nov 12, 2011 1:51 pm

I have a list field where each line links to a data set.
New lines are added with "Click here to add page" forming the end of the list.

There are 2 normal text fields designed to save their respcetive contents automatically when the focus changes.
as below
on closefield
set the itemdelimiter to tab
put the RTFText of field "Comment" into URL ("file:" & WorkFolder & item 7 of line tSelLine of field "Index" on card 2)
end closefield

I have found that if the user does not tab away from the normal field or click in the other normal field before clicking the "Click here to add page" in the list field, the process fails.

The code that fails is:- (marked by **************** and is not part of the code)

on mouseDown
enableReorder (long id of me)
select the clickLine ***************************This is the line that fails (Line 4)*********
put the hilitedline of field "Index" on card 2 into tSelLine
set the itemdelimiter to tab
put WorkFolder & item 5 of line tSelLine of field "Index" on card 2 into VarDeleteLine5 --Prepare for line to be deleted
put WorkFolder & item 7 of line tSelLine of field "Index" on card 2 into VarDeleteLine7 --Prepare for line to be deleted
put WorkFolder & item 8 of line tSelLine of field "Index" on card 2 into VarDeleteLine8 --Prepare for line to be deleted
end mouseDown

and the reason is "field "Index": execution error at line 4 (Chunk: no target found), char 13"

I need to find a way of ending the focus in the normal fields if the user goes from input to "Click here to add page" in the list field.

Any ideas please!

Klaus
Posts: 14194
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: select the clickLine issue

Post by Klaus » Sat Nov 12, 2011 2:35 pm

Hi Happyrever,

can't you just add a "focus on nothing" or "focus on fld XYZ" line to your mousedown handler?

Code: Select all

on mouseDown
  #focus on nothing
  ## or better:
  focus on me ## on fld XYZ

  enableReorder (long id of me)
  select the clickLine
  ...
That should trigger "closefield" of a not yet closed field.

Hint:
I would NEVER rely on hilitedlines of fields on other cards than the current one!
Instead I would set a custom property or global variable which is much more reliable!


Best

Klaus

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

Re: select the clickLine issue

Post by Happyrever » Sat Nov 12, 2011 3:01 pm

Dear Klaus,
Yes, this works and avoids the error message as does a few other variations, however, there is another handler in the chain that does not work unless the closefield process completes.
What should happen is that after the user has entered the text in the normal fileds and "closed the field in some way) the "Click here to add page" should create a blank line in the place of the "Click here to add page" and the "Click here to add page" should drop to the next line and the two normal text fields should empty and have user instructions added to them.
This does not happen at all.
A further click on "Click here to add page" does set the thing working as planned, but is hardly helpful to the user.

Part of the problem is I have made use of a very clever bit of code produced by Tactile Media that is beyond my understanding (in detail). This code of mine is linked to a series of handlers produced by TM that have unpredictable effects that persist, even if the livecode environment is closed and restarted. It requires a complete reboot to eradicate the fault. Software that failed to run, no matter what I did, ran perfectly after reboot. It even upset the livecode editor!

I am so locked into the elegant way the TM code works in this application, I must find a way of solving the problem.

What must happen is the same as clicking into another text field and NOT adding anything at all and then clicking "Click here to add page". If I (or the user) does that, it works perfectly.

Any more thoughts?

Klaus
Posts: 14194
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: select the clickLine issue

Post by Klaus » Sat Nov 12, 2011 3:38 pm

Hi Happyrever,

sorry, no idea, and I have to admit I don't get the picture at all 8)


Best

Klaus

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

Re: select the clickLine issue

Post by Happyrever » Sat Nov 12, 2011 5:12 pm

The solution was so simple in the end, I put the necessary code in an earlier part of the handler. In essence, the TM code (function) was upsetting my code.

Post Reply