Sha256: 297bb983ef86a6065219a2e9c2a501df7bd16617c26f0165b9a7aa0c75ce8a02

Contents?: true

Size: 1.45 KB

Versions: 18

Compression:

Stored size: 1.45 KB

Contents

---
:wxEventFilter:
  :detail:
    :pre:
      :programlisting:
        - :pattern: !ruby/regexp /.*/
          :replace: |
            
            ```ruby
            # This class allows determining the last time the user has worked with
            # this application:
            class LastActivityTimeDetector < Wx::EventFilter
              def initialize
                Wx::EvtHandler.add_filter(self)
        
                @last = Time.now
              end
        
              def clear
                Wx::EvtHandler.remove_filter(self)
              end
        
              def filter_event(event)
                # Update the last user activity
                t = event.get_event_type
                case t
                when Wx::EVT_KEY_DOWN, 
                     Wx::EVT_MOTION, 
                     Wx::EVT_LEFT_DOWN,
                     Wx::EVT_RIGHT_DOWN,
                     Wx::EVT_MIDDLE_DOWN
                  @last = Time.now
                end
    
                # Continue processing the event normally as well.
                Event_Skip
              end
        
              # This function could be called periodically from some timer to
              # do something (e.g. hide sensitive data or log out from remote
              # server) if the user has been inactive for some time period.
              def is_inactive_for?(diff)
                (Time.now - diff) > @last
              end
            
            end
            ```

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
wxruby3-1.3.1 rakelib/lib/generate/doc/event_filter.yaml
wxruby3-1.3.0 rakelib/lib/generate/doc/event_filter.yaml
wxruby3-1.2.1 rakelib/lib/generate/doc/event_filter.yaml
wxruby3-1.2.0 rakelib/lib/generate/doc/event_filter.yaml
wxruby3-1.1.2 rakelib/lib/generate/doc/event_filter.yaml
wxruby3-1.1.1 rakelib/lib/generate/doc/event_filter.yaml
wxruby3-1.1.0 rakelib/lib/generate/doc/event_filter.yaml
wxruby3-1.0.1 rakelib/lib/generate/doc/event_filter.yaml
wxruby3-0.9.8 rakelib/lib/generate/doc/event_filter.yaml
wxruby3-0.9.7 rakelib/lib/generate/doc/event_filter.yaml
wxruby3-0.9.5 rakelib/lib/generate/doc/event_filter.yaml
wxruby3-0.9.4 rakelib/lib/generate/doc/event_filter.yaml
wxruby3-0.9.3 rakelib/lib/generate/doc/event_filter.yaml
wxruby3-0.9.2 rakelib/lib/generate/doc/event_filter.yaml
wxruby3-0.9.1 rakelib/lib/generate/doc/event_filter.yaml
wxruby3-0.9.0 rakelib/lib/generate/doc/event_filter.yaml
wxruby3-0.9.0.pre.rc.3 rakelib/lib/generate/doc/event_filter.yaml
wxruby3-0.9.0.pre.rc.2 rakelib/lib/generate/doc/event_filter.yaml