Can't get Callback to Work [Not yet Solved]
- Posted by Icy_Viking 6 days ago
- 98 views
Hi all,
I'm having trouble trying to get this callback function to work. The window does not close when the button is clicked.
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()