Class: CWM::RichText

Inherits:
AbstractWidget show all
Includes:
ValueBasedWidget
Defined in:
library/cwm/src/lib/cwm/common_widgets.rb

Overview

Rich text widget supporting some highlighting

Instance Attribute Summary

Attributes inherited from AbstractWidget

#handle_all_events, #widget_id

Instance Method Summary collapse

Methods included from ValueBasedWidget

#value

Methods inherited from AbstractWidget

#cleanup, #cwm_definition, #disable, #enable, #enabled?, #focus, #fun_ref, #handle, #help, #init, #label, #my_event?, #opt, #refresh_help, #store, #validate, widget_type=

Instance Method Details

#keep_scroll?Boolean

Note:

Useful only to keep the sense of continuity when redrawing basically with the same text

Determines if the vertical scroll must be kept after updating the content

Keeping the vertical scroll after changing the value is mostly intended to be used after a redraw because of a user action. However, using it after changing the content noticeably (e.g., displaying different product descriptions), will look like a randomly positioned vertical scroll.

Returns:

  • (Boolean)

    true if the vertical scroll must be kept; false otherwise


379
380
381
# File 'library/cwm/src/lib/cwm/common_widgets.rb', line 379

def keep_scroll?
  false
end

#value=(val) ⇒ Object

Updates the content

Depending on #keep_scroll?, the vertical scroll will be saved and restored.

Parameters:

  • val (String)

    the new content for the widget


388
389
390
391
392
# File 'library/cwm/src/lib/cwm/common_widgets.rb', line 388

def value=(val)
  current_vscroll = vscroll
  super
  self.vscroll = current_vscroll if keep_scroll?
end