Can't get Callback to Work [Not yet Solved]

new topic     » topic index » view thread      » older message » newer message

Hi all,

I'm having trouble trying to get this callback function to work. The window does not close when the button is clicked.

https://www.enlightenment.org/develop/legacy/api/c/start#group__Evas__Smart__Object__Group.html#ga18a8b179f94d21b2b09e19db11741061

 
public atom evas 
 
ifdef WINDOWS then 
	evas = open_dll("libevas-1.dll") 
	elsifdef LINUX or FREEBSD then 
	evas = open_dll("libevas-1.so") 
end ifdef 
 
if evas = -1 then 
	puts(1,"Failed to open evas!\n") 
	abort(1) 
end if 
 
public constant xevas_object_smart_callback_add = define_c_proc(evas,"+evas_object_smart_callback_add",{C_POINTER,C_STRING,C_POINTER,C_POINTER}) 
 
public procedure evas_object_smart_callback_add(atom obj,sequence event,object func,atom data) 
	c_proc(xevas_object_smart_callback_add,{obj,event,func,data}) 
end procedure 
include std/ffi.e 
include evas.e 
include elemantary.e 
 
constant TRUE = 1, FALSE = 0 
 
function on_click() 
	elm_exit() 
	return TRUE 
end function 
 
elm_init(NULL,NULL) 
 
elm_policy_set(ELM_POLICY_QUIT,ELM_POLICY_EXIT) 
 
atom win = elm_win_util_standard_add("Main","Hello World") 
elm_win_autodel_set(win,TRUE) 
 
evas_object_resize(win,640,480) 
 
atom click_id = routine_id("on_click") 
if click_id = -1 then 
	puts(1,"routine_id is not valid!\n") 
end if 
atom click_cb = call_back(click_id) 
 
atom btn = elm_button_add(win) 
elm_object_part_text_set(btn,NULL,"EXIT") 
evas_object_smart_callback_add(btn,"click",click_cb,NULL) 
evas_object_move(btn,60,15) 
evas_object_resize(btn,120,30) 
evas_object_show(btn) 
 
evas_object_show(win) 
 
elm_run() 
new topic     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu