Page 1 of 1

Editor Gadget Word Wrap using GTK?

Posted: Fri Jan 11, 2008 9:28 pm
by Hydrate
I have been wanting to create a fully functional editorgadget for a while, I feel this is not possible without the wordwrap function.

I have been looking at the GTK api and have found what I think I need to pull it off, but have no idea how to do it in purebasic, here is what I am looking at:

http://library.gnome.org/devel/gtk/2.12 ... -word-wrap

From that, this code is what I attempted:

Code: Select all

gtkText.l=EditorGadget(#PB_Any,0,4,\lw,\lh-4);
  gtk_text_set_word_wrap_(gtkText,#True);
Ideas?

Posted: Fri Jan 11, 2008 9:54 pm
by frederic
this function is deprecated, use gtk_text_view_set_wrap_mode ()
but i don't know how to use it with pb
http://library.gnome.org/devel/gtk/2.12 ... -wrap-mode

Posted: Fri Jan 11, 2008 10:29 pm
by Hydrate
frederic wrote:this function is deprecated, use gtk_text_view_set_wrap_mode ()
but i don't know how to use it with pb
http://library.gnome.org/devel/gtk/2.12 ... -wrap-mode
Ah thank you, I got it working with this code:

Code: Select all

  gtkText=EditorGadget(#PB_Any,0,19,\lw,\lh-19);
  gtk_text_view_set_wrap_mode_(GadgetID(gtkText),#True);

Posted: Fri Jan 11, 2008 11:36 pm
by frederic
hmm there is an error, this is not #true (1) but a value from this constants :

Code: Select all

                    Enumeration 0
                              #GTK_WRAP_NONE
                              #GTK_WRAP_CHAR
                              #GTK_WRAP_WORD
                              #GTK_WRAP_WORD_CHAR
                    EndEnumeration
                    
                    gtk_text_view_set_wrap_mode_(GadgetID(#gadget_Main_Editor_TemplateMsg), #GTK_WRAP_WORD)