1. RE: GTK Trouble
- Posted by Ron W <nova812 at hotmail.com> Aug 19, 2002
- 623 views
I've also tried this it doesnt seem to work either. But at least I don't get a seg fault. It looks as though I might be getting a pointer values, maybe. function encrypt_textarea_0() object str integer len integer start start =0 len = gtk_text_get_length(txt) str=gtk_editable_get_chars(txt,start,len) printf(1,"%s",str) return NULL end function constant encrypt_textarea=call_back(routine_id("encrypt_textarea_0")) Ron W wrote: > I'm having a little trouble with the gtk lib. I made this function... > > function encrypt_textarea_0() > object str > str=get_text(txt) > printf(1,"%s",str) > return NULL > end function > constant encrypt_textarea=call_back(routine_id("encrypt_textarea_0")) > > when I click on the button that calls this funtion I get.... > > Gtk-CRITICAL **: file gtkentry.c: line 535 (gtk_entry_get_text): > assertion `GTK_IS_ENTRY (entry)' failed. > Segmentation fault > > from looking at the error, it looks like get_text is for a GtkEntry > widget and not a GtkText object. so my question is ... > > how do you get the contents of a GtkText widget a store them in a > sequence? > > Ron_W > >
2. RE: GTK Trouble
- Posted by Ron W <nova812 at hotmail.com> Aug 19, 2002
- 537 views
I figured out one solution. as it turns out, it was an address. So my solution is. function encrypt_textarea_0() object address integer len integer start sequence s start =0 len = gtk_text_get_length(txt) address=gtk_editable_get_chars(txt,start,len) s=peek({address,len}) printf(1,"%s",{s}) return NULL end function constant encrypt_textarea=call_back(routine_id("encrypt_textarea_0")) I'm not sure it's how the lib was intended to be used, but it seems to work. Ron_W Ron W wrote: > I've also tried this it doesnt seem to > work either. But at least I don't get a > seg fault. It looks as though I might > be getting a pointer values, maybe. > > function encrypt_textarea_0() > object str > integer len > integer start > > start =0 > len = gtk_text_get_length(txt) > str=gtk_editable_get_chars(txt,start,len) > > printf(1,"%s",str) > return NULL > end function > constant encrypt_textarea=call_back(routine_id("encrypt_textarea_0")) > > Ron W wrote: > > I'm having a little trouble with the gtk lib. I made this function... > > > > function encrypt_textarea_0() > > object str > > str=get_text(txt) > > printf(1,"%s",str) > > return NULL > > end function > > constant encrypt_textarea=call_back(routine_id("encrypt_textarea_0")) > > > > when I click on the button that calls this funtion I get.... > > > > Gtk-CRITICAL **: file gtkentry.c: line 535 (gtk_entry_get_text): > > assertion `GTK_IS_ENTRY (entry)' failed. > > Segmentation fault > > > > from looking at the error, it looks like get_text is for a GtkEntry > > widget and not a GtkText object. so my question is ... > > > > how do you get the contents of a GtkText widget a store them in a > > sequence? > > > > Ron_W > > > >
3. RE: GTK Trouble
- Posted by irv at take.maxleft.com Aug 20, 2002
- 530 views
Ron W wrote: > I figured out one solution. as it turns out, it was an address. So my > solution is. > > > function encrypt_textarea_0() > object address > integer len > integer start > sequence s > > start =0 > len = gtk_text_get_length(txt) > address=gtk_editable_get_chars(txt,start,len) > s=peek({address,len}) > > > printf(1,"%s",{s}) > return NULL > end function > constant encrypt_textarea=call_back(routine_id("encrypt_textarea_0")) > > I'm not sure it's how the lib was intended to be used, but it seems to > work. That should work. There's also a global function: c_to_eu_string(p) which takes a pointer to a null-terminated string, which GTK returns, and produces a Euphoria sequence. So you could replace the above with: printf(1,"%s",{c_to_eu_string(get_text(txt))}) I have updated the get_text() function to automatically do the conversion, and will post the new version to my website later today. Thanks, Irv
4. RE: GTK Trouble
- Posted by Ron W <nova812 at hotmail.com> Aug 20, 2002
- 524 views
I read your reply this morning, thanks for your quick response. you suggested that.... printf(1,"%s",{c_to_eu_string(get_text(txt))}) ... might work for me. I was pretty sure that it wouldn't because the widget in question here is a GtkText widget and not a GtkEntry widget. In reading the Gtk docs, there is not gtk_text_get_text() method. (..err function). However this.... > printf(1,"%s",{c_to_eu_string(gtk_editable_get_chars(txt,start,len))}) ... does work. As is consistant with the Gtk docs. I'm really happy to see that your lib follows the Gtk docs so well. That consistency really helps straighten the learning curve. Ron_W