Re: Phix+EuGTK
- Posted by irv Dec 15, 2020
- 2396 views
Next question: how to create new instances?
constant LIB = open_dll("libgtk-3.so.0") constant P = C_PTR, I = C_INT integer init_rid = define_c_func(LIB,"gtk_init_check",{P,P},P) if init_rid < 1 or c_func(init_rid,{0,0})=0 then crash("Failed to initialize GTK library!") end if class Window public atom handle = c_func(define_c_func(LIB,"gtk_window_new",{I},P),{0}) procedure show() c_proc(define_c_proc(LIB,"gtk_widget_show",{P}),{handle}) end procedure end class procedure main() c_proc(define_c_proc(LIB,"gtk_main",{})) end procedure Window w1 = new() Window w2 = new() ? w1 ? w1.handle ? w2 ? w2.handle -- same as w1 w1.show() w2.show() -- already shown main()
{"struct","Window",2,1} 30917232 {"struct","Window",2,2} 30917232
Both windows have the same "handle". How can I change my code so each call to new() will call the "gtk_window_new" function again to get a new unique handle?