|
| Subject |
Author |
Status |
Date |
Re: How would i get weblinks to become clickable o n a editfield?
|
Taslima Hassan |
|
5/5/2008 2:31:23 AM |
If the only thing in the editfield is the web address then it's quite easy.
In the editfield's MouseDown Event Code: Return TrueThat's just so the MouseUp event will fire.
In the editfield's MouseUp event Code: ShowURL me.Textpan> Post Comments |
|
Re: Thats the problem
|
Taslima Hassan |
|
5/5/2008 2:37:20 AM |
Thats the problem its actualy a screen that recives text from internet chat rooms so in the mouse down i currently have text which is as follows
Code: if IsCMMClick then contextualMenu4.open return true end if
so i dont know what to do Post Comments |
|
Re: How would i get weblinks to become clickable o n a editfield?
|
Pontian Pilate |
|
5/5/2008 2:40:51 AM |
You could use the mouse down / mouse up events and GetCharPosAtXY. Alternatively you could use the SelChanged event and SelStart property. Basically, you have to figure out what word you 39;re in (loop backwards from your position and look for whitespace) and then you can use inst r to look forward for a word ending. Once you know what word you're in, it should be fairl y easy. Post Comments |
|
Re: Confused!
|
Taslima Hassan |
|
5/5/2008 2:44:27 AM |
I am confused now am i meant to put
Code: ShowURL me.Text Return True
In the same event be cause what ever i try does not work. Post Comments |
|
Re: i too am confused!
|
Sabir. H. Mohammad |
|
5/5/2008 2:47:42 AM |
I'm confused too. Remember, we can only go on what you've told us about your problem. SirG3 and I have given answers based on entirely different editfields and, although his assumptions probaby more likely in the real world, we're still no nearer knowing which is correct in your case.
For now, let me make some statements about your problem. I can't believe they're all right, so you let me know which ones are wrong, and why.
1. You have an editfield that contains nothing but a single web address like this http://www.realsoftware.com 2. When you right-click (or control-click on a mac) the editfield, a menu pops up 3. This is because you have some code including "contextualMenu4.open" in the MouseDown event of the editfield 4. When someone clicks anywhere in the editfield, you want the browser to open and navigate to the address that is in the editfield
It would also be helpful to know what version of RB you are using and on what platform, though I don't think this is particuarly relevant to your problem.
Post Comments |
|
Re: Sorry...
|
Taslima Hassan |
|
5/5/2008 2:51:04 AM |
Sorry i think iv kind of explained it wrong. Let me try a bit better the editfield is a chat screen so its a big editfield that allmost covers the screen what i want exactly is when some one displays a url in the chat room itself i want the url to be clickable on my program the program is a client for ares p2p so when the client is in a chat room and some one displays a url weblink it comes out as normal text like this as i want it to be clickable on my clinet. now as for the editfield i have contextualMenu4.open command in the mousedown event version is for this program im using 5.5.5 and im on windows xp i hope iv explained it so u can understand it better.
Post Comments |
|
Re: Then you can ignore my simplistic early sugges tion
|
Sabir. H. Mohammad |
|
5/5/2008 2:53:33 AM |
Then you can ignore my simplistic early suggestion. You've got a bit of work to do.
I suggest you write a function to return the current word, following SirG3's suggestion of walking back and forward from the editfield.CharPosAtXY until you find a space, tab, endofline, angle-bracket etc. The function should return the word as a string
Once you have that function, you can call it each time you detect a mousedown and decide whether it begins with "http://", "https://" "mailto:" or anything else you conside to be a URL.
If so, then you can use "ShowURL returnedString" to open the browser.
You'll probably find the current word function will come in handy for other things later.
Post Comments |
|
Re: Again im lost
|
Taslima Hassan |
|
5/5/2008 3:02:44 AM |
Again im lost lol sorry about this but im not sure what you are tryin to say because understand ing what sirg3 has said is what i cant do Post Comments |
|
Re: How would i get weblinks to become clickable o n a editfield?
|
Pontian Pilate |
|
5/5/2008 3:04:35 AM |
Another idea (probably easier than looking for whitespace) would be to look for links in the t ext when you append it to your editfield, then store the positions of the link. I'll try t o code an example up for you. Post Comments |
|
Re: Thank you!!
|
Taslima Hassan |
|
5/5/2008 3:09:26 AM |
Ok! Pontius! Thank you!! If you want to send an example to my e mail :thasleema@rediffmail.com Post Comments |
|
Re: View this site
|
Pontian Pilate |
|
5/5/2008 3:11:28 AM |
|
Re: I got it!
|
Taslima Hassan |
|
5/5/2008 3:13:50 AM |
Ok Pontian, I've got that now and its exactly what im looking for but one problem when i try all that coding in my project im using RB 5.5.5 and it says on the addtext method
Code: dim l as new Link
Local Variable conflicts with another local or parameter of the same name so Post Comments |
|
Re: You should have said that you were using 5.5 e arlier
|
Pontian Pilate |
|
5/5/2008 3:15:42 AM |
You really should have said you were using 5.5 earlier. Here's a link to the project changed to work on 5.5: http://pontian.homeip.net/code/linkfield5.5.zip Post Comments |
|
Re: Sorry friend!
|
Taslima Hassan |
|
5/5/2008 3:17:51 AM |
Sorry friend! i did say just scroll up a bit Post Comments |
|
Re: So it was my bad
|
Pontian Pilate |
|
5/5/2008 3:19:35 AM |
Ah, so it was my bad, heh. Didn't notice it in that reply. Post Comments |
|
Re: Now im getting errors on
|
Taslima Hassan |
|
5/5/2008 3:21:08 AM |
Now im getting errors on the example which is in the coding for linksfield source code in events - mousedown
Code: dim pos as integer = charPosAtXY( x, y )
// look through the links to see if we've clicked on one for each link as Link in links if link.start <= pos and link.stop >= pos then // yay, we've found one currLink = link
colorizeLink( link, &cFF0000 ) return True end if next
for each link as Link in links
says this is a syntax error
sorr y about the trouble. Post Comments |
|
Re: Missed that spot
|
Pontian Pilate |
|
5/5/2008 3:22:26 AM |
Woops! Missed that spot when I was removing the 2k5 features.
Code: dim pos as integer = charPosAtXY( x, y )
// look through the links to see if we've clicked on one for i = 0 to ubound( links ) dim link as Link = links( i )
if link.start <= pos and link.stop >= pos then // yay, we've found one currLink = link
colorizeLink( link, &cFF0000 ) return True end if next
Post Comments |
|
Re: Sorry about this
|
Taslima Hassan |
|
5/5/2008 3:23:53 AM |
Sorry about this but now its
Code: // look through the links to see if we've clicked on one for i = 0 to ubound( links ) dim link as Link = links( i )
for i = 0 to ubound( links )
This method or propertie does not exsist its highlighted the i. Post Comments |
|
Re: I must be out of it.
|
Pontian Pilate |
|
5/5/2008 3:25:10 AM |
Wow, I must be out of it.
Code: dim pos as integer = charPosAtXY( x, y )
// look through the links to see if we've clicked on one dim i as integer for i = 0 to ubound( links ) dim link as Link = links( i )
if link.start <= pos and link.stop >= pos then // yay, we've found one currLink = link
colorizeLink( link, &cFF0000 ) return True end if next
Post Comments |
|
Re: Sorry mate we are no closer
|
Taslima Hassan |
|
5/5/2008 3:26:49 AM |
Sorry mate we are no closer
Code: dim link as Link = links( i )
syntax error on there now Post Comments |
|
Re: Just a dumb question
|
Pontian Pilate |
|
5/5/2008 3:28:07 AM |
Hm, just a dumb question, but is the Link class in the project? I really see no reason that li ne should error... Post Comments |
|
Re: I am actualy putting the coding
|
Taslima Hassan |
|
5/5/2008 3:30:27 AM |
I am actualy putting the coding in to the example yea the link class is in the project Post Comments |
|
Re: I know it works
|
Pontian Pilate |
|
5/5/2008 3:31:57 AM |
|
Re: Thanx a lot for the help
|
Taslima Hassan |
|
5/5/2008 3:34:14 AM |
Ah! Pontian, Thanx a lot for the help and sorry about all that Post Comments |
|