Hi Antonio,

It looks like the time has come and the old callback functions I was
counting on have be deprecated. Is there a way I can still make this
work?

John

<< C interface >>

besFUNCTION(PuiSetCallback)
  Ihandle *ih;
  const char *name;
  char *class_name;

  besARGUMENTS("pz")
    &ih, &name
  besARGEND

  class_name = IupGetClassName(ih);

  if (strcmp(class_name, "dialog") == 0) {
/*  IupSetCallback(ih, name, (Icallback)&WinEvent); */
    IupSetFunction(name, (Icallback)&WinEvent);
    IupSetAttribute(ih, name, name);
    }
  else if (strcmp(class_name, "button") == 0) {
/*  IupSetCallback(ih, name, (Icallback)&BtnEvent); */
    IupSetFunction(name, (Icallback)&BtnEvent);
    IupSetAttribute(ih, name, name);
    }
  else if (strcmp(class_name, "list") == 0) {
/*  IupSetCallback(ih, name, (Icallback)&ListEvent); */
    IupSetFunction(name, (Icallback)&ListEvent);
    IupSetAttribute(ih, name, name);
    }
  else {
/*  IupSetCallback(ih, name, (Icallback)&Event); */
    IupSetFunction(name, (Icallback)&Event);
    IupSetAttribute(ih, name, name);
    }

  besRETURN_STRING(class_name);
besEND

<< Script BASIC >>

SUB MainLoop
LOCAL this_event, aname 
ExitLoop = 0
REPEAT
  __LoopStepWait()
  this_event = __GetEvent()
  IF this_event <> undef THEN
    aname = ::GetActionName()
    IF this_event = event{this_event}{aname}[0] THEN
      ICALL(event{this_event}{aname}[1])
    END IF
  END IF
UNTIL ExitLoop
END SUB

FUNCTION SetCallback(ih, aname, faddr)
  event{ih}{aname}[0] = ih 
  event{ih}{aname}[1] = faddr
  SetCallback = __SetCallback(ih, aname)
END FUNCTION

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most 
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
Iup-users mailing list
Iup-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/iup-users

Reply via email to