Re: [Vala] [Genie] Chain up TextBuffer



you can use super to access the parent class you are inheriting from
(similar to super in python)

Ergo i belive you need to call super.insert_text (blah) at end of your
overriden call if you want that call to chain up

jamie

On Sun, 2010-09-12 at 20:37 +0200, Nicolas wrote:
Hi,

I'm developping a program and i need to override a function in 
Gtk.TextBuffer.
This is the code:

[indent=4]

uses
     Gtk

class testbuffer : Gtk.TextBuffer

     mark : TextMark

     init
         mark = new TextMark(null, true)

     def private override insert_text (iter : TextIter, text : string, 
length : int)
         print "future function"

class test : Window

     txtview : TextView
     txtbuffer : TextBuffer

     init
         title = "Test"
         default_height = 270
         default_width = 440
         window_position = WindowPosition.CENTER
         this.destroy.connect(Gtk.main_quit)
         txtbuffer = new testbuffer ()
         txtview = new TextView.with_buffer(txtbuffer)
         this.add(txtview)
         this.show_all()

init
     Gtk.init (ref args)
     var window = new test ()
     window.show_all ()
     Gtk.main ()

My problem is that i can't write anything in the textview.
Someone can explain me (with code if possible, my english is poor) how 
to chain up ?

Thank in advance,
Nicolas.


_______________________________________________
vala-list mailing list
vala-list gnome org
http://mail.gnome.org/mailman/listinfo/vala-list





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]