The selectedtext between fields
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
The selectedtext between fields
Hi Everyone
I am having trouble understanding what is happening here.
I have one field (myChoice) where a line of text is selected by clicking. The line of text is selected using - put the selectedtext into field “WhichPicture” (List Behaviour of field “MyChoice” is; Click to toggle, Multi-line and Non-Contiguous selected).
The line of text are placed into another field (WhichPicture).
This works fine and multiple lines can be selected and de-selected in field “myChoice”.
When I click on a line of text in the field “WhichPicture" (which now has lines of text) to show a related image, this also works as expected - appropriate images can be shown. (Field “WhichPicture" has List Behaviour of ‘Click to toggle” only)
If I then go to the field (myChoice) and select an additional line of text, then an additional line of text appears in field (WhichPicture) - which is what is wanted.
However.
Once I have clicked on a line of text in field “WhichPicture", when I click on a line of text in field “myChoice” that is already selected, i.e., to deselect a line of text, then ALL of the field “WhichPicture” is cleared. This doesn’t occur if I select an additional line in field “myChoice”.
Any suggestions? Thanks in advance.
regards
Greg
I am having trouble understanding what is happening here.
I have one field (myChoice) where a line of text is selected by clicking. The line of text is selected using - put the selectedtext into field “WhichPicture” (List Behaviour of field “MyChoice” is; Click to toggle, Multi-line and Non-Contiguous selected).
The line of text are placed into another field (WhichPicture).
This works fine and multiple lines can be selected and de-selected in field “myChoice”.
When I click on a line of text in the field “WhichPicture" (which now has lines of text) to show a related image, this also works as expected - appropriate images can be shown. (Field “WhichPicture" has List Behaviour of ‘Click to toggle” only)
If I then go to the field (myChoice) and select an additional line of text, then an additional line of text appears in field (WhichPicture) - which is what is wanted.
However.
Once I have clicked on a line of text in field “WhichPicture", when I click on a line of text in field “myChoice” that is already selected, i.e., to deselect a line of text, then ALL of the field “WhichPicture” is cleared. This doesn’t occur if I select an additional line in field “myChoice”.
Any suggestions? Thanks in advance.
regards
Greg
-
- VIP Livecode Opensource Backer
- Posts: 9678
- Joined: Wed May 06, 2009 2:28 pm
- Location: New York, NY
Re: The selectedtext between fields
Hi,
What is the code you are using to move the text to the other field?
Craig Newman
What is the code you are using to move the text to the other field?
Craig Newman
Re: The selectedtext between fields
Thanks Craig
I’ve striped all the code in field “myChoice" down to just
on mouseup
put the selectedtext into field "WhichPicture"
end mouseup
With no script in field “WhichPicture”, when I click on a line in field “WhichPicture”, then return to field “myChoice” and click on a highlighted line, all of the text in field “WhichPicture” is cleared. If I then click on another line of text in field “myChoice” that is not highlighted, then all of the lines are returned to field “WhichPicture”.
It seems like the ‘selectedtext’ in the first field is ‘lost’ when the second field lines are clicked.
I’ve striped all the code in field “myChoice" down to just
on mouseup
put the selectedtext into field "WhichPicture"
end mouseup
With no script in field “WhichPicture”, when I click on a line in field “WhichPicture”, then return to field “myChoice” and click on a highlighted line, all of the text in field “WhichPicture” is cleared. If I then click on another line of text in field “myChoice” that is not highlighted, then all of the lines are returned to field “WhichPicture”.
It seems like the ‘selectedtext’ in the first field is ‘lost’ when the second field lines are clicked.
-
- VIP Livecode Opensource Backer
- Posts: 9678
- Joined: Wed May 06, 2009 2:28 pm
- Location: New York, NY
Re: The selectedtext between fields
Hi again.
Where is the handler located?
Craig
Where is the handler located?
Craig
Re: The selectedtext between fields
Hi
In the field “myChoice"
In the field “myChoice"
-
- VIP Livecode Opensource Backer
- Posts: 9678
- Joined: Wed May 06, 2009 2:28 pm
- Location: New York, NY
Re: The selectedtext between fields
Ah.
If you click on a line in a list field that is already selected, that line is deselected. And consequently the selectedText is empty, and that emptiness in loaded into your field "whichPicture". The selectedText is evaluated after the selection, and in kind, the deselection. This falls into the details of how LC really works, down only slightly deep, but deeper than the user normally needs to worry about. Good stuff...
So you have to fix this. Do you see how to?
Write back if you need a clue.
Craig
If you click on a line in a list field that is already selected, that line is deselected. And consequently the selectedText is empty, and that emptiness in loaded into your field "whichPicture". The selectedText is evaluated after the selection, and in kind, the deselection. This falls into the details of how LC really works, down only slightly deep, but deeper than the user normally needs to worry about. Good stuff...
So you have to fix this. Do you see how to?
Write back if you need a clue.
Craig
Re: The selectedtext between fields
Ha, thanks Craig. I'll contemplate the problem while you sleep
cheers
Greg
cheers
Greg
Re: The selectedtext between fields
Just a guess: after instead of into ?GregWills wrote:Hi
In the field “myChoice"
on mouseup
put the selectedtext after field "WhichPicture"
end mouseup
Re: The selectedtext between fields
Craig, thanks for your explanation and prompt for me to explore it again. I'm not sure what you had in mind, but this worked;
on mouseup
put the selection of me into field "myChoice"
end mouseup
That's all it took. So 'the selectedtext' was too specific and captured only the empty selection.
Great. Thanks again. Hope I didn't wake you!!!
on mouseup
put the selection of me into field "myChoice"
end mouseup
That's all it took. So 'the selectedtext' was too specific and captured only the empty selection.
Great. Thanks again. Hope I didn't wake you!!!
-
- VIP Livecode Opensource Backer
- Posts: 9678
- Joined: Wed May 06, 2009 2:28 pm
- Location: New York, NY
Re: The selectedtext between fields
Hi.
My thought was something along the lines of:
The value of the clickLine is independent of the selectedText. And you will get nothing if you click on a blank line. But whatever works, eh?
Craig
My thought was something along the lines of:
Code: Select all
on mouseup
if the selectedText <> "" then put the selectedtext into field "WhichPicture"
else put the value of the clickLine into fld "whichPicture"
end mouseup
Know that you do not need "of me", as the selection has a life of its own.on mouseup
put the selection of me into field "myChoice"
end mouseup
Craig
Re: The selectedtext between fields
Thanks Craig
Interestingly, I tried removing the 'of me'; i.e. put the selection into field "myChoice"
and it didn't work. So I have kept; put the selection of me into field "myChoice"
I think that is where I originally started using the selectedtext when "put the selection" didn't do as I wanted.
Great discussion points. Thanks.
Interestingly, I tried removing the 'of me'; i.e. put the selection into field "myChoice"
and it didn't work. So I have kept; put the selection of me into field "myChoice"
I think that is where I originally started using the selectedtext when "put the selection" didn't do as I wanted.
Great discussion points. Thanks.