def repaint  # button

      #@bgcolor ||= $def_bg_color
      #@color   ||= $def_fg_color
        $log.debug("BUTTON repaint : #{self}  r:#{@row} c:#{@col} , #{@color} , #{@bgcolor} , #{getvalue_for_paint}" )
        r,c = @row, @col #rowcol include offset for putting cursor
        # NOTE: please override both (if using a string), or else it won't work 
        #  These are both colorpairs not colors ??? 2014-05-31 - 11:58 
        _highlight_color = @highlight_color || $reversecolor
        _highlight_bgcolor = @highlight_bgcolor || 0
        _bgcolor = bgcolor()
        _color = color()
        if @state == :HIGHLIGHTED
          _bgcolor = @state==:HIGHLIGHTED ? _highlight_bgcolor : _bgcolor
          _color = @state==:HIGHLIGHTED ? _highlight_color : _color
        elsif selected? # only for certain buttons lie toggle and radio
          _bgcolor = @selected_bgcolor || _bgcolor
          _color   = @selected_color || _color
        end
        $log.debug "XXX: button #{text}   STATE is #{@state} color #{_color} , bg: #{_bgcolor} "
        if _bgcolor.is_a?( Integer) && _color.is_a?( Integer)
          # i think this means they are colorpairs not colors, but what if we use colors on the 256 scale ?
          #  i don;t like this at all. 
        else
          _color = get_color($datacolor, _color, _bgcolor)
        end
        value = getvalue_for_paint
        $log.debug("button repaint :#{self} r:#{r} c:#{c} col:#{_color} bg #{_bgcolor} v: #{value} ul #{@underline} mnem #{@mnemonic} datacolor #{$datacolor} ")
        len = @width || value.length
        @graphic = @form.window if @graphic.nil? ## cell editor listbox hack 
        @graphic.printstring r, c, "%-*s" % [len, value], _color, attr()
#       @form.window.mvchgat(y=r, x=c, max=len, Ncurses::A_NORMAL, bgcolor, nil)
        # in toggle buttons the underline can change as the text toggles
        if @underline || @mnemonic
          uline = @underline && (@underline + @text_offset) ||  value.index(@mnemonic) || 
            value.index(@mnemonic.swapcase)
          # if the char is not found don't print it
          if uline
            y=r #-@graphic.top
            x=c+uline #-@graphic.left
            #
            # NOTE: often values go below zero since root windows are defined 
            # with 0 w and h, and then i might use that value for calcaluting
            #
            $log.error "XXX button underline location error #{x} , #{y} " if x < 0 or c < 0
            raise " #{r} #{c}  #{uline} button underline location error x:#{x} , y:#{y}. left #{@graphic.left} top:#{@graphic.top} " if x < 0 or c < 0
            @graphic.mvchgat(y, x, max=1, Ncurses::A_BOLD|Ncurses::A_UNDERLINE, _color, nil)
          end
        end
    end
def repaint  # button

      #@bgcolor ||= $def_bg_color
      #@color   ||= $def_fg_color
        $log.debug("BUTTON repaint : #{self}  r:#{@row} c:#{@col} , #{@color} , #{@bgcolor} , #{getvalue_for_paint}" )
        r,c = @row, @col #rowcol include offset for putting cursor
        # NOTE: please override both (if using a string), or else it won't work 
        #  These are both colorpairs not colors ??? 2014-05-31 - 11:58 
        _highlight_color = @highlight_color || $reversecolor
        _highlight_bgcolor = @highlight_bgcolor || 0
        _bgcolor = bgcolor()
        _color = color()
        if @state == :HIGHLIGHTED
          _bgcolor = @state==:HIGHLIGHTED ? _highlight_bgcolor : _bgcolor
          _color = @state==:HIGHLIGHTED ? _highlight_color : _color
        elsif selected? # only for certain buttons lie toggle and radio
          _bgcolor = @selected_bgcolor || _bgcolor
          _color   = @selected_color || _color
        end
        $log.debug "XXX: button #{text}   STATE is #{@state} color #{_color} , bg: #{_bgcolor} "
        if _bgcolor.is_a?( Integer) && _color.is_a?( Integer)
          # i think this means they are colorpairs not colors, but what if we use colors on the 256 scale ?
          #  i don;t like this at all. 
        else
          _color = get_color($datacolor, _color, _bgcolor)
        end
        value = getvalue_for_paint
        $log.debug("button repaint :#{self} r:#{r} c:#{c} col:#{_color} bg #{_bgcolor} v: #{value} ul #{@underline} mnem #{@mnemonic} datacolor #{$datacolor} ")
        len = @width || value.length
        @graphic = @form.window if @graphic.nil? ## cell editor listbox hack 
        @graphic.printstring r, c, "%-*s" % [len, value], _color, attr()
#       @form.window.mvchgat(y=r, x=c, max=len, Ncurses::A_NORMAL, bgcolor, nil)
        # in toggle buttons the underline can change as the text toggles
        if @underline || @mnemonic
          uline = @underline && (@underline + @text_offset) ||  value.index(@mnemonic) || 
            value.index(@mnemonic.swapcase)
          # if the char is not found don't print it
          if uline
            y=r #-@graphic.top
            x=c+uline #-@graphic.left
            #
            # NOTE: often values go below zero since root windows are defined 
            # with 0 w and h, and then i might use that value for calcaluting
            #
            $log.error "XXX button underline location error #{x} , #{y} " if x < 0 or c < 0
            raise " #{r} #{c}  #{uline} button underline location error x:#{x} , y:#{y}. left #{@graphic.left} top:#{@graphic.top} " if x < 0 or c < 0
            @graphic.mvchgat(y, x, max=1, Ncurses::A_BOLD|Ncurses::A_UNDERLINE, _color, nil)
          end
        end
    end
FIXME 2014-05-31 since form checks for highlight color and sets repaint on on_enter, we shoul not set it.
   but what if it is set at form level ?
    also it is not correct to set colors now that form's defaults are taken