How do I Search Text on a page?

Get help using Construct 2

Post » Tue Apr 05, 2016 12:05 pm

@korbaach and @newt thank you both. That's super helpful! I'll explore this and see how far I can get with it. I feel like understanding how this example works might help give me ideas of how to address other features!
B
59
S
9
G
1
Posts: 942
Reputation: 6,553

Post » Tue Apr 05, 2016 3:01 pm

wow i got a chance to peek at the example.. you're using actual javascript.. that's awesome. i would have never been able to pull that off.. i may explore other ways to get a similar result, but this is still a fascinating and very helpful to realize how a solution could be found.. I have a developer partner that I might be able to lean on to help with JS coding to further improve the behavior in my case, but this example sheds a ton of light.. I was thinking i could do it purely through C2 expressions / actions.. but that's not the case.
B
59
S
9
G
1
Posts: 942
Reputation: 6,553

Post » Tue Apr 05, 2016 4:50 pm

Thank you @Lordshiva1948

@part12studios I doubt that this can be done only with C2 expressions / actions...
but I could be wrong..

updated capx: windowFindText.capx

Image

still no idea.. how to scroll to selected word..
B
67
S
24
G
7
Posts: 1,518
Reputation: 11,072

Post » Tue Apr 05, 2016 5:05 pm

yea that's great to know.. sometimes it's just good to know "hey you can't do that with C2 out of the box". man that's so badass..

ok so in terms of scrolling to a position.. are you able to set a scroll bar position? i'm totally asking this as a novice in this regard. I wonder if the means in which you're able to scroll too based on the bar position couldn't be hijacked.. even if the result was not pixel perfect it would probably be close enough.. like if there were 100 words in the text field.. if the word you find is word 50 you know roughly 50% down? a little math needed if the number was like.. 250 words.. or 41..

btw, how are you posting animated scripting events like that? that is also pretty awesome :)

Thanks!
Caleb
B
59
S
9
G
1
Posts: 942
Reputation: 6,553

Post » Wed Apr 06, 2016 4:07 pm

just for a moment I thought I have a solution.. :D
..but ..

first..getSelectionRange.capx

Image
then..setCaretPosition

Image
that will automatically scroll textBox to "cursor"

but I simply can not force to work together.. :?
Last edited by korbaach on Wed Apr 06, 2016 5:39 pm, edited 1 time in total.
B
67
S
24
G
7
Posts: 1,518
Reputation: 11,072

Post » Wed Apr 06, 2016 4:21 pm

@korbaach dude you are the man. If I can secure this gig I will PM you. That's is brilliant!
B
59
S
9
G
1
Posts: 942
Reputation: 6,553

Post » Wed Apr 06, 2016 8:36 pm

korbaach brilliant job keep helping that is your good deed for the day. Bless you
B
255
S
39
G
15
Posts: 1,982
Reputation: 41,005

Previous

Return to How do I....?

Who is online

Users browsing this forum: No registered users and 22 guests