def set_form form
      raise "Form is nil in set_form" if form.nil?
      @form = form
      @id = form.add_widget(self) if !form.nil? and form.respond_to? :add_widget
      # 2009-10-29 15:04 use form.window, unless buffer created
      # should not use form.window so explicitly everywhere.
      # added 2009-12-27 20:05 BUFFERED in case child object needs a form.
      # We don;t wish to overwrite the graphic object
      if @graphic.nil?
        #$log.debug " setting graphic to form window for #{self.class}, #{form} "
        @graphic = form.window unless form.nil? # use screen for writing, not buffer
      end
      # execute those actions delayed due to absence of form -- used internally 
      # mostly by buttons and labels to bind hotkey to form
      fire_handler(:FORM_ATTACHED, self) if event? :FORM_ATTACHED
    end
def set_form form
      raise "Form is nil in set_form" if form.nil?
      @form = form
      @id = form.add_widget(self) if !form.nil? and form.respond_to? :add_widget
      # 2009-10-29 15:04 use form.window, unless buffer created
      # should not use form.window so explicitly everywhere.
      # added 2009-12-27 20:05 BUFFERED in case child object needs a form.
      # We don;t wish to overwrite the graphic object
      if @graphic.nil?
        #$log.debug " setting graphic to form window for #{self.class}, #{form} "
        @graphic = form.window unless form.nil? # use screen for writing, not buffer
      end
      # execute those actions delayed due to absence of form -- used internally 
      # mostly by buttons and labels to bind hotkey to form
      fire_handler(:FORM_ATTACHED, self) if event? :FORM_ATTACHED
    end
in those cases where we create widget without a form, and later give it to
 some other program which sets the form. Dirty, we should perhaps create widgets
 without forms, and add explicitly.