Class: CWM::RichText
- Inherits:
-
AbstractWidget
- Object
- AbstractWidget
- CWM::RichText
- 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
-
#keep_scroll? ⇒ Boolean
Determines if the vertical scroll must be kept after updating the content.
-
#value=(val) ⇒ Object
Updates the content.
Methods included from ValueBasedWidget
Methods inherited from AbstractWidget
#cleanup, #cwm_definition, #disable, #displayed?, #enable, #enabled?, #focus, #fun_ref, #handle, #help, #init, #label, #my_event?, #opt, #refresh_help, #store, #validate, widget_type=
Instance Method Details
#keep_scroll? ⇒ Boolean
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.
420 421 422 |
# File 'library/cwm/src/lib/cwm/common_widgets.rb', line 420 def keep_scroll? false end |
#value=(val) ⇒ Object
Updates the content
Depending on #keep_scroll?, the vertical scroll will be saved and restored. Calling this method only make sense when the widget is displayed (see #displayed?).
430 431 432 433 434 |
# File 'library/cwm/src/lib/cwm/common_widgets.rb', line 430 def value=(val) current_vscroll = vscroll super self.vscroll = current_vscroll if keep_scroll? end |