Make sure commands go through the MAIN section and get the object identifier of the viewer in the frame.
INIT:
  control always;
  call send(_frame_,'_getWidget',
            'viewer',viewid);
  return;