Go to item word
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
Go to item word
Hello everybody!
As i using the function "Find" as the function only circle the word.
But can i know how i can go to the location of the word?
Because i got a group with scrollbar and inside there alot of word with so anyone know what the code for me to go the location of the word.
As i using the function "Find" as the function only circle the word.
But can i know how i can go to the location of the word?
Because i got a group with scrollbar and inside there alot of word with so anyone know what the code for me to go the location of the word.
-
- VIP Livecode Opensource Backer
- Posts: 2718
- Joined: Sat Dec 22, 2007 5:35 pm
- Location: Genève
- Contact:
Re: Go to item word
Hi,
What is the form of your list of words in your group
One fld per word ? many words in one fld ?
This script works with a fld in a group
Now you get the selectedLoc
You have to do some math to set the vScroll of your group
Good luck for next step
Jean-Marc
What is the form of your list of words in your group
One fld per word ? many words in one fld ?
This script works with a fld in a group
Code: Select all
on doFindWord pWord
find pWord in fld 1
put the foundchunk into tFC
select tFC
put the selectedLoc into tSL
answer "foundchunk= " && tFC & cr & "selectedLoc =" &&tSL
end doFindWord
You have to do some math to set the vScroll of your group
Good luck for next step
Jean-Marc
https://alternatic.ch
-
- VIP Livecode Opensource Backer
- Posts: 9579
- Joined: Wed May 06, 2009 2:28 pm
- Location: New York, NY
Re: Go to item word
Jean-Marc has given a lot of help here, but is that what you meant by "location"?But can i know how i can go to the location of the word?
Craig Newman
Re: Go to item word
Hello, as i got a alot of data inside a group call "scrolling".
Therefore when i find the word, i want to instantly go the searched word location without using the scrollbar ~ ~
Therefore when i find the word, i want to instantly go the searched word location without using the scrollbar ~ ~
-
- VIP Livecode Opensource Backer
- Posts: 9579
- Joined: Wed May 06, 2009 2:28 pm
- Location: New York, NY
Re: Go to item word
Hmmm.
When LC finds a word in a list field, say, that field automatically scrolls to the line containing that word
Is that you want "the foundLine", the actual line containing the text?
Know that the "foundLine" can be used to set the scroll of the field. You just get the effective textHight of the field and multiply that by word 2 of the foundLine. You may need a little extra adjustment when you do that, though.
But is that what you meant? Or are there several fields in your group, and you want to get more information about where the found text is located? Or is it that you want the group itself to scroll to the field that contains the found text, assuming the group is built that way? Please try to explain.
Craig
When LC finds a word in a list field, say, that field automatically scrolls to the line containing that word
Is that you want "the foundLine", the actual line containing the text?
Know that the "foundLine" can be used to set the scroll of the field. You just get the effective textHight of the field and multiply that by word 2 of the foundLine. You may need a little extra adjustment when you do that, though.
But is that what you meant? Or are there several fields in your group, and you want to get more information about where the found text is located? Or is it that you want the group itself to scroll to the field that contains the found text, assuming the group is built that way? Please try to explain.
Craig
Re: Go to item word
Hello Craig, thanks for the responsive reply!
Yes this is what i mean! So you know what code i should put in button script??dunbarx wrote: ↑Fri May 11, 2018 4:16 am
Is that you want "the foundLine", the actual line containing the text?
Know that the "foundLine" can be used to set the scroll of the field. You just get the effective textHight of the field and multiply that by word 2 of the foundLine. You may need a little extra adjustment when you do that, though.
Craig
-
- VIP Livecode Opensource Backer
- Posts: 2718
- Joined: Sat Dec 22, 2007 5:35 pm
- Location: Genève
- Contact:
Re: Go to item word
Hi jwtea,
Yes, we know how set the vScroll from a string search.
Maybe, because the best way to do that depends on context.
I repeat my questions
What is the form of your list of words in your group
One fld per word ? many words in one fld ?
With some others
Why do you need a group and not a simple field ?
Your fields are list fld or not ?
Do you may post a simple stack which should make help easier ?
If your fld is a list fld, Craig gave you what you need
Best regards
Jean-Marc
Yes and maybe,Yes this is what i mean! So you know what code i should put in button script??
Yes, we know how set the vScroll from a string search.
Maybe, because the best way to do that depends on context.
I repeat my questions
What is the form of your list of words in your group
One fld per word ? many words in one fld ?
With some others
Why do you need a group and not a simple field ?
Your fields are list fld or not ?
Do you may post a simple stack which should make help easier ?
If your fld is a list fld, Craig gave you what you need
Best regards
Jean-Marc
https://alternatic.ch
Re: Go to item word
Hello Jean, thanks for your time and help!
I got around 1 group called "scrolling group" and inside the "scrolling group" i got 10 groups each of them is named "usersbox" , "usersbox 1" , "usersbox 2" and etc.... until "usersbox 9".
And each of the "usersbox" got 1 field is call "name" .
In the field is only 1 word.
I got around 1 group called "scrolling group" and inside the "scrolling group" i got 10 groups each of them is named "usersbox" , "usersbox 1" , "usersbox 2" and etc.... until "usersbox 9".
And each of the "usersbox" got 1 field is call "name" .
In the field is only 1 word.
-
- VIP Livecode Opensource Backer
- Posts: 2718
- Joined: Sat Dec 22, 2007 5:35 pm
- Location: Genève
- Contact:
Re: Go to item word
Hi jwtea,
You may use a loop to get the group containing string search inside its fld
Pseudocode:
get the name of group with search word in its fld "name" by loop
put the value of word 2 of it into tNumGroup
After this you have to do some math to get the new vSroll of your group "scrolling group".
Something like that:
This should works if your groups "userbox" have the same height
EDIT: and the height your scrolling group = the height of groups "userbox. Also depends of the height of your scrolling group
I remain curious about the necessity to use a group to do that.
userbox 1 until userbox 10 is should be betteri got 10 groups each of them is named "usersbox" , "usersbox 1" , "usersbox 2" and etc.... until "usersbox 9".
You may use a loop to get the group containing string search inside its fld
Pseudocode:
get the name of group with search word in its fld "name" by loop
put the value of word 2 of it into tNumGroup
After this you have to do some math to get the new vSroll of your group "scrolling group".
Something like that:
Code: Select all
function fDeNumToScroll pNum,pHeight -- num of found group, height of groups
put (pNum-1)* pHeight into tScroll
return tScroll
end fDeNumToScroll
EDIT: and the height your scrolling group = the height of groups "userbox. Also depends of the height of your scrolling group
I remain curious about the necessity to use a group to do that.
https://alternatic.ch