 |
GTK+ Forums Discussion forum for GTK+ and Programming. Ask questions, troubleshoot problems, view and post example code, or express your opinions.
|
|
|
| Author |
Message |
|
|
cnu_sree GTK+ Geek
Joined: 06 Oct 2006 Posts: 57
|
Posted: Mon Nov 20, 2006 7:03 am Post subject: showing urls in text view |
|
|
actually my program is related to im
in that if we enter text on one text view and press enter then the data will be added on another text view.
if enter a url address in text view.
then it wills show like a text link in the textview
how we can get the click event for that
how it is possible
thank u in advance
sree |
|
| Back to top |
|
 |
openldev Never Seen the Sunlight
Joined: 21 Sep 2005 Posts: 387 Location: Fairfax, Virginia
|
|
| Back to top |
|
 |
cnu_sree GTK+ Geek
Joined: 06 Oct 2006 Posts: 57
|
Posted: Tue Nov 21, 2006 5:18 am Post subject: thank u |
|
|
thank u very much
it is very useful to me
but a small problem is
when i move the cursor on to hypertext.the cursor will not changing to the hand symbol
that's y iam unable click there.
i found that iiam not using the below function properly
g_object_set_data (G_OBJECT (tag), "page", GINT_TO_POINTER (page));.
this is the line from the code ur given.
how can i handle thid line in my code.
my code is
void
on_button1_clicked (GtkButton *button,
gpointer user_data)
{
gtk_text_buffer_get_end_iter( buffer1, &end );
gtk_text_buffer_place_cursor (buffer1, &end);
GtkTextTag *tag;
tag = gtk_text_buffer_create_tag (buffer1, NULL,
"foreground", "blue",
"underline", PANGO_UNDERLINE_SINGLE,
NULL);
g_object_set_data (G_OBJECT (tag), "page", GINT_TO_POINTER (page));
gtk_text_buffer_insert_with_tags (buffer1,&end, "www.google.com", -1, tag, NULL);
} |
|
| Back to top |
|
 |
openldev Never Seen the Sunlight
Joined: 21 Sep 2005 Posts: 387 Location: Fairfax, Virginia
|
Posted: Tue Nov 21, 2006 3:51 pm Post subject: |
|
|
You need to check out the do_hypertext() function for changing the cursor. You have to create a new cursor with gdk_cursor_new(). Also, you're skipping a lot of steps it seems. I would recommend going through the whole demo and make sure you understand what is going on before you start coding yourself.
All the line you asked about is doing is converting an integer into a pointer so it can be stored on the object's data table. You see, every object can store pairs of strings and pointers. However, since an integer is not easily converted into a pointer, GLib provides a function for this. You can convert it back with GPOINTER_TO_INT(). |
|
| Back to top |
|
 |
raj4u Familiar Face
Joined: 11 Oct 2006 Posts: 10
|
Posted: Wed Nov 22, 2006 8:41 am Post subject: |
|
|
thank u its's working fine
but i ahve a small problem.
in my textview if i enter
sreewww.google.com http://google.com
how can i verify both www and http at a time |
|
| Back to top |
|
 |
openldev Never Seen the Sunlight
Joined: 21 Sep 2005 Posts: 387 Location: Fairfax, Virginia
|
Posted: Wed Nov 22, 2006 9:55 pm Post subject: |
|
|
| you're probably just going to want to search through the buffer for both patterns. Things like http://, https://, file://, etc should force a url and www should be an afterthought. |
|
| Back to top |
|
 |
|
Powered by phpBB © 2001, 2005 phpBB Group CodeBB 1.0 Beta 2
|