Class: AMS::SketchupObserver Abstract

Inherits:
Object
  • Object
show all
Defined in:
Documentation/ams/sketchup_observer.rb

Overview

This class is abstract.
Note:

SWO events are capable of monitoring window events. SWP, in addition to monitoring, are also capable making decisions to the window events. Returning 1 for an SWP event will prevent the event from reaching the SketchUp window procedure; any other return value won't block the event. If more than one observers install SWP events and one of them returns 1, the event will be blocked, regardless of whether other observers wanted the event to be processed by the SketchUp window procedure.

Note:

An observer can be a class, a module, or a class instance. Your observer will work as long as the callback methods are public.

Note:

Including all observer methods into your class is not necessary. You may include/elude those as you wish.

Note:

Windows only!

SketchUpObserver allows monitoring and making decisions to the input events and messages reaching the SketchUp window procedure.

Examples:

Processing keyboard events:

class MySketchupObserver

  def swp_on_key_down(vk_name, vk_value, vk_char)
    puts "on_key_down: #{vk_name}"
    # ...
    # Returning 1 will prevent current pressed key from interacting with SU
    # window procedure.
    # Here, we'll return 1 to W,S,A,D keys, so we could use them for our own
    # purpose, rather than having shortcuts changing the tool.
    return %(w s a d).include?(vk_name) ? 1 : 0
  end

  def swp_on_key_extended(vk_name, vk_value, vk_char)
    puts "on_key_extended: #{vk_name}"
    # ...
    # If you return 1 for the on_key_down event, it's also preferred to
    # return 1 for the on_key_extended event, so the key doesn't stand a
    # chance to interact with SketchUp window procedure.
    return %(w s a d).include?(vk_name) ? 1 : 0
  end

  def swp_on_key_up(vk_name, vk_value, vk_char)
    puts "on_key_up: #{vk_name}"
    # ...
    # If you return 1 for the on_key_down event, it's also preferred to
    # return 1 for the on_key_up event, so the key doesn't stand a chance to
    # interact with SketchUp window procedure.
    return %(w s a d).include?(vk_name) ? 1 : 0
  end

end # class MySketchupObserver

AMS::Sketchup.add_observer(MySketchupObserver.new)

See Also:

Since:

  • 2.0.0

Observer Events collapse

Mouse Input Events collapse

Keybaord Input Events collapse

SketchUp Window Events collapse

SketchUp Window Post Events collapse

Instance Method Details

#swo_activateObject

Called whenever this observer is added.

Since:

  • 2.0.0



57
58
# File 'Documentation/ams/sketchup_observer.rb', line 57

def swo_activate
end

#swo_deactivateObject

Called whenever this observer is removed.

Since:

  • 2.0.0



61
62
# File 'Documentation/ams/sketchup_observer.rb', line 61

def swo_deactivate
end

#swo_error(e) ⇒ Object

Note:

An error will not force the observer to deactivate. If you want the observer to deactivate on error, then this is the observer method implement.

Note:

If this event is not implemented, by default, the error will be outputted in console.

Note:

If there is an error in this event, the error message will be outputted in console.

Triggered whenever there is an error in any of the observer methods, with exception to this, particular observer method.

Examples:

Deactivating an observer when an error occurs.

class MyMouseWheelObserver

  def swp_on_mouse_wheel_rotate(x, y, dir)
    puts "Mouse wheel rotated #{dir == 1 ? 'up' : 'down'}!"
    # 'yo' is undefined. Make this error on purpose.
    yo
  end

  def swo_error(e)
    puts e.message
    # Deactivate our observer
    AMS::Sketchup.remove_observer(self)
  end

end # class MyMouseWheelObserver

AMS::Sketchup.add_observer(MyMouseWheelObserver.new)
# In this example, after adding an observer and rotating a mouse wheel,
# which would trigger the swp_on_mouse_wheel_rotate event, the undefined
# 'yo', which is in the swp_on_mouse_wheel_rotate event, will throw an
# exception, which would be caught by the swo_error event. The swo_error
# event will output the error message into console and unregister the
# current observer.

Parameters:

  • e (Exception)

Since:

  • 2.0.0



98
99
# File 'Documentation/ams/sketchup_observer.rb', line 98

def swo_error(e)
end

#swo_on_blurObject

Called when main window is deactivated.

Since:

  • 2.0.0



318
319
# File 'Documentation/ams/sketchup_observer.rb', line 318

def swo_on_blur
end

#swo_on_caption_changed(text) ⇒ Object

Called when main window title text is changed.

Parameters:

  • text (String)

    New text

Since:

  • 2.0.0



343
344
# File 'Documentation/ams/sketchup_observer.rb', line 343

def swo_on_caption_changed(text)
end

#swo_on_enter_menuObject

Called when application enters the menu loop.

Since:

  • 2.0.0



288
289
# File 'Documentation/ams/sketchup_observer.rb', line 288

def swo_on_enter_menu
end

#swo_on_enter_size_move(x, y, w, h) ⇒ Object

Called when main window enters the state of being sized and/or moved.

Parameters:

  • x (Fixnum)

    X coordinate of window origin, relative to the upper-left corner of the screen.

  • y (Fixnum)

    Y coordinate of window origin, relative to the upper-left corner of the screen.

  • w (Fixnum)

    Window width in pixels.

  • h (Fixnum)

    Window height in pixels.

Since:

  • 2.0.0



328
329
# File 'Documentation/ams/sketchup_observer.rb', line 328

def swo_on_enter_size_move(x,y, w,h)
end

#swo_on_exit_menuObject

Called when application exits the menu loop.

Since:

  • 2.0.0



292
293
# File 'Documentation/ams/sketchup_observer.rb', line 292

def swo_on_exit_menu
end

#swo_on_exit_size_move(x, y, w, h) ⇒ Object

Called when main window exits the state of being sized and/or moved.

Parameters:

  • x (Fixnum)

    X coordinate of window origin, relative to the upper-left corner of the screen.

  • y (Fixnum)

    Y coordinate of window origin, relative to the upper-left corner of the screen.

  • w (Fixnum)

    Window width in pixels.

  • h (Fixnum)

    Window height in pixels.

Since:

  • 2.0.0



338
339
# File 'Documentation/ams/sketchup_observer.rb', line 338

def swo_on_exit_size_move(x,y, w,h)
end

#swo_on_focusObject

Called when main window is activated.

Since:

  • 2.0.0



314
315
# File 'Documentation/ams/sketchup_observer.rb', line 314

def swo_on_focus
end

#swo_on_maximizeObject

Called when main window is maximized.

Since:

  • 2.0.0



302
303
# File 'Documentation/ams/sketchup_observer.rb', line 302

def swo_on_maximize
end

#swo_on_menu_bar_changed(state) ⇒ Object

Called when main window menu bar is set or removed.

Parameters:

  • state (Boolean)

    A true value indicates the menu bar is set; a false value indicates the menu bar is removed.

Since:

  • 2.0.0



349
350
# File 'Documentation/ams/sketchup_observer.rb', line 349

def swo_on_menu_bar_changed(state)
end

#swo_on_minimizeObject

Called when main window is minimized.

Since:

  • 2.0.0



306
307
# File 'Documentation/ams/sketchup_observer.rb', line 306

def swo_on_minimize
end

#swo_on_mouse_enter(x, y) ⇒ Object

Called when cursor enters the viewport client area.

Parameters:

  • x (Fixnum)

    X cursor position relative to the upper-left corner of the viewport client area.

  • y (Fixnum)

    Y cursor position relative to the upper-left corner of the viewport client area.

Since:

  • 2.0.0



224
225
# File 'Documentation/ams/sketchup_observer.rb', line 224

def swo_on_mouse_enter(x,y)
end

#swo_on_mouse_leave(x, y) ⇒ Object

Called when cursor leaves the viewport client area.

Parameters:

  • x (Fixnum)

    X cursor position relative to the upper-left corner of the viewport client area.

  • y (Fixnum)

    Y cursor position relative to the upper-left corner of the viewport client area.

Since:

  • 2.0.0



229
230
# File 'Documentation/ams/sketchup_observer.rb', line 229

def swo_on_mouse_leave(x,y)
end

#swo_on_mouse_move(x, y) ⇒ Object

Called when cursor is moved within the viewport client area.

Parameters:

  • x (Fixnum)

    X cursor position relative to the upper-left corner of the viewport client area.

  • y (Fixnum)

    Y cursor position relative to the upper-left corner of the viewport client area.

Since:

  • 2.0.0



234
235
# File 'Documentation/ams/sketchup_observer.rb', line 234

def swo_on_mouse_move(x,y)
end

#swo_on_page_selected(page1, page2, tab_index1, tab_index2) ⇒ Object

Note:

Two additional parameters, tab_index1 and tab_index2, were added in 3.5.0.

Called when a scenes page is selected.

Parameters:

  • page1 (Sketchup::Page)

    Originally selected page.

  • page2 (Sketchup::Page)

    New selected page.

  • tab_index1 (Fixnum)
  • tab_index2 (Fixnum)

Since:

  • 3.2.0



441
442
# File 'Documentation/ams/sketchup_observer.rb', line 441

def swo_on_page_selected(page1, page2, tab_index1, tab_index2)
end

#swo_on_post_blurObject

Called after main window is deactivated.

Since:

  • 3.0.0



509
510
# File 'Documentation/ams/sketchup_observer.rb', line 509

def swo_on_post_blur
end

#swo_on_post_caption_changed(text) ⇒ Object

Called after main window title text is changed.

Parameters:

  • text (String)

    New text

Since:

  • 3.0.0



538
539
# File 'Documentation/ams/sketchup_observer.rb', line 538

def swo_on_post_caption_changed(text)
end

#swo_on_post_enter_menuObject

Called after application enters the menu loop.

Since:

  • 3.0.0



472
473
# File 'Documentation/ams/sketchup_observer.rb', line 472

def swo_on_post_enter_menu
end

#swo_on_post_enter_size_move(x, y, w, h) ⇒ Object

Called after main window enters the state of being sized and/or moved.

Parameters:

  • x (Fixnum)

    X coordinate of window origin, relative to the upper-left corner of the screen.

  • y (Fixnum)

    Y coordinate of window origin, relative to the upper-left corner of the screen.

  • w (Fixnum)

    Window width in pixels.

  • h (Fixnum)

    Window height in pixels.

Since:

  • 3.0.0



520
521
# File 'Documentation/ams/sketchup_observer.rb', line 520

def swo_on_post_enter_size_move(x,y, w,h)
end

#swo_on_post_exit_menuObject

Called after application exits the menu loop.

Since:

  • 3.0.0



477
478
# File 'Documentation/ams/sketchup_observer.rb', line 477

def swo_on_post_exit_menu
end

#swo_on_post_exit_size_move(x, y, w, h) ⇒ Object

Called after main window exits the state of being sized and/or moved.

Parameters:

  • x (Fixnum)

    X coordinate of window origin, relative to the upper-left corner of the screen.

  • y (Fixnum)

    Y coordinate of window origin, relative to the upper-left corner of the screen.

  • w (Fixnum)

    Window width in pixels.

  • h (Fixnum)

    Window height in pixels.

Since:

  • 3.0.0



532
533
# File 'Documentation/ams/sketchup_observer.rb', line 532

def swo_on_post_exit_size_move(x,y, w,h)
end

#swo_on_post_focusObject

Called after main window is activated.

Since:

  • 3.0.0



504
505
# File 'Documentation/ams/sketchup_observer.rb', line 504

def swo_on_post_focus
end

#swo_on_post_maximizeObject

Called after main window is maximized.

Since:

  • 3.0.0



489
490
# File 'Documentation/ams/sketchup_observer.rb', line 489

def swo_on_post_maximize
end

#swo_on_post_menu_bar_changed(state) ⇒ Object

Called after main window menu bar is set or removed.

Parameters:

  • state (Boolean)

    A true value indicates the menu bar is set; a false value indicates the menu bar is removed.

Since:

  • 3.0.0



545
546
# File 'Documentation/ams/sketchup_observer.rb', line 545

def swo_on_post_menu_bar_changed(state)
end

#swo_on_post_minimizeObject

Called after main window is minimized.

Since:

  • 3.0.0



494
495
# File 'Documentation/ams/sketchup_observer.rb', line 494

def swo_on_post_minimize
end

#swo_on_post_restoreObject

Called after main window is set to normal placement.

Since:

  • 3.0.0



499
500
# File 'Documentation/ams/sketchup_observer.rb', line 499

def swo_on_post_restore
end

#swo_on_post_scenes_bar_emptiedObject

Called after scenes bar loses its last page.

Since:

  • 3.0.0



582
583
# File 'Documentation/ams/sketchup_observer.rb', line 582

def swo_on_post_scenes_bar_emptied
end

#swo_on_post_scenes_bar_filledObject

Called after scenes bar gets its first page.

Since:

  • 3.0.0



577
578
# File 'Documentation/ams/sketchup_observer.rb', line 577

def swo_on_post_scenes_bar_filled
end

#swo_on_post_scenes_bar_visibility_changed(state) ⇒ Object

Called after scenes bar is shown or hidden.

Parameters:

  • state (Boolean)

    A true value indicates scenes bar is set visible; a false value indicates scenes bar is set hidden.

Since:

  • 3.0.0



572
573
# File 'Documentation/ams/sketchup_observer.rb', line 572

def swo_on_post_scenes_bar_visibility_changed(state)
end

#swo_on_post_size_move(x, y, w, h) ⇒ Object

Called after main window is being sized and/or moved.

Parameters:

  • x (Fixnum)

    X coordinate of window origin, relative to the upper-left corner of the screen.

  • y (Fixnum)

    Y coordinate of window origin, relative to the upper-left corner of the screen.

  • w (Fixnum)

    Window width in pixels.

  • h (Fixnum)

    Window height in pixels.

Since:

  • 3.0.0



526
527
# File 'Documentation/ams/sketchup_observer.rb', line 526

def swo_on_post_size_move(x,y, w,h)
end

#swo_on_post_status_bar_visibility_changed(state) ⇒ Object

Called after status bar is shown or hidden.

Parameters:

  • state (Boolean)

    A true value indicates status bar is set visible; a false value indicates status bar is set hidden.

Since:

  • 3.0.0



589
590
# File 'Documentation/ams/sketchup_observer.rb', line 589

def swo_on_post_status_bar_visibility_changed(state)
end

#swo_on_post_switch_full_screen(state) ⇒ Object

Called after main window is switched to/from full screen mode.

Parameters:

  • state (Boolean)

    A true value indicates the window is set full screen; a false value indicated the window is unset from full screen mode.

Since:

  • 3.0.0



484
485
# File 'Documentation/ams/sketchup_observer.rb', line 484

def swo_on_post_switch_full_screen(state)
end

#swo_on_post_toolbar_container_emptied(bar) ⇒ Object

Called after toolbar container is emptied.

Parameters:

  • bar (Fixnum)

    A container which was emptied. It can be one of the following values:

    1. top bar

    2. bottom bar

    3. left bar

    4. right bar

Since:

  • 3.0.0



624
625
# File 'Documentation/ams/sketchup_observer.rb', line 624

def swo_on_post_toolbar_container_emptied(bar)
end

#swo_on_post_toolbar_container_filled(bar) ⇒ Object

Called after toolbar container is filled.

Parameters:

  • bar (Fixnum)

    A container which was filled. It can be one of the following values:

    1. top bar

    2. bottom bar

    3. left bar

    4. right bar

Since:

  • 3.0.0



613
614
# File 'Documentation/ams/sketchup_observer.rb', line 613

def swo_on_post_toolbar_container_filled(bar)
end

#swo_on_post_toolbar_container_visibility_changed(bar, state) ⇒ Object

Called after toolbar container is shown or hidden.

Parameters:

  • bar (Fixnum)

    A container which visibility state was changed. It can be one following values:

    1. top bar

    2. bottom bar

    3. left bar

    4. right bar

  • state (Boolean)

    A true value indicates toolbar container is set visible; a false value indicates toolbar container is set hidden.

Since:

  • 3.0.0



602
603
# File 'Documentation/ams/sketchup_observer.rb', line 602

def swo_on_post_toolbar_container_visibility_changed(bar, state)
end

#swo_on_post_viewport_border_changed(state) ⇒ Object

Called after view border, a thin edge surrounding the view, is set or removed.

Parameters:

  • state (Boolean)

    A true value indicates the edge is set; a false value indicates the edge is removed.

Since:

  • 3.0.0



565
566
# File 'Documentation/ams/sketchup_observer.rb', line 565

def swo_on_post_viewport_border_changed(state)
end

#swo_on_post_viewport_paintObject

Called after the view window is redrawn.

Since:

  • 3.0.0



550
551
# File 'Documentation/ams/sketchup_observer.rb', line 550

def swo_on_post_viewport_paint
end

#swo_on_post_viewport_size(w, h) ⇒ Object

Called after the view window is sized.

Parameters:

  • w (Fixnum)

    View width in pixels.

  • h (Fixnum)

    View height in pixels.

Since:

  • 3.0.0



557
558
# File 'Documentation/ams/sketchup_observer.rb', line 557

def swo_on_post_viewport_size(w,h)
end

#swo_on_quitObject

Called right before SketchUp window is destroyed.

Since:

  • 2.0.0



284
285
# File 'Documentation/ams/sketchup_observer.rb', line 284

def swo_on_quit
end

#swo_on_restoreObject

Called when main window is set to normal placement.

Since:

  • 2.0.0



310
311
# File 'Documentation/ams/sketchup_observer.rb', line 310

def swo_on_restore
end

#swo_on_scenes_bar_emptiedObject

Called when scenes bar loses its last page.

Since:

  • 2.0.0



380
381
# File 'Documentation/ams/sketchup_observer.rb', line 380

def swo_on_scenes_bar_emptied
end

#swo_on_scenes_bar_filledObject

Called when scenes bar gets its first page.

Since:

  • 2.0.0



376
377
# File 'Documentation/ams/sketchup_observer.rb', line 376

def swo_on_scenes_bar_filled
end

#swo_on_scenes_bar_visibility_changed(state) ⇒ Object

Called when scenes bar is shown or hidden.

Parameters:

  • state (Boolean)

    A true value indicates scenes bar is set visible; a false value indicates scenes bar is set hidden.

Since:

  • 2.0.0



372
373
# File 'Documentation/ams/sketchup_observer.rb', line 372

def swo_on_scenes_bar_visibility_changed(state)
end

#swo_on_size_move(x, y, w, h) ⇒ Object

Called when main window is being sized and/or moved.

Parameters:

  • x (Fixnum)

    X coordinate of window origin, relative to the upper-left corner of the screen.

  • y (Fixnum)

    Y coordinate of window origin, relative to the upper-left corner of the screen.

  • w (Fixnum)

    Window width in pixels.

  • h (Fixnum)

    Window height in pixels.

Since:

  • 2.0.0



333
334
# File 'Documentation/ams/sketchup_observer.rb', line 333

def swo_on_size_move(x,y, w,h)
end

#swo_on_status_bar_visibility_changed(state) ⇒ Object

Called when status bar is shown or hidden.

Parameters:

  • state (Boolean)

    A true value indicates status bar is set visible; a false value indicates status bar is set hidden.

Since:

  • 2.0.0



386
387
# File 'Documentation/ams/sketchup_observer.rb', line 386

def swo_on_status_bar_visibility_changed(state)
end

#swo_on_switch_full_screen(state) ⇒ Object

Called when main window is switched to/from full screen mode.

Parameters:

  • state (Boolean)

    A true value indicates the window is set full screen; a false value indicated the window is unset from full screen mode.

Since:

  • 2.0.0



298
299
# File 'Documentation/ams/sketchup_observer.rb', line 298

def swo_on_switch_full_screen(state)
end

#swo_on_toolbar_container_emptied(bar) ⇒ Object

Called when toolbar container is emptied.

Parameters:

  • bar (Fixnum)

    A container which was emptied. It can be one of the following values:

    1. top bar

    2. bottom bar

    3. left bar

    4. right bar

Since:

  • 2.0.0



418
419
# File 'Documentation/ams/sketchup_observer.rb', line 418

def swo_on_toolbar_container_emptied(bar)
end

#swo_on_toolbar_container_filled(bar) ⇒ Object

Called when toolbar container is filled.

Parameters:

  • bar (Fixnum)

    A container which was filled. It can be one of the following values:

    1. top bar

    2. bottom bar

    3. left bar

    4. right bar

Since:

  • 2.0.0



408
409
# File 'Documentation/ams/sketchup_observer.rb', line 408

def swo_on_toolbar_container_filled(bar)
end

#swo_on_toolbar_container_visibility_changed(bar, state) ⇒ Object

Called when toolbar container is shown or hidden.

Parameters:

  • bar (Fixnum)

    A container which visibility state was changed. It can be one following values:

    1. top bar

    2. bottom bar

    3. left bar

    4. right bar

  • state (Boolean)

    A true value indicates toolbar container is set visible; a false value indicates toolbar container is set hidden.

Since:

  • 2.0.0



398
399
# File 'Documentation/ams/sketchup_observer.rb', line 398

def swo_on_toolbar_container_visibility_changed(bar, state)
end

#swo_on_user_message(sender_handle, id, user_data) ⇒ Object

Called when a user-sent message is received.

Parameters:

  • sender_handle (Fixnum)

    A handle to a SketchUp main window that sent a message.

  • id (Fixnum)

    A user-defined unique message identifier sent along with a message.

  • user_data (nil, Boolean, Fixnum, Bignum, Float, String, Symbol, Hash)

    User-defined information or data sent along with a message.

See Also:

Since:

  • 3.1.0



430
431
# File 'Documentation/ams/sketchup_observer.rb', line 430

def swo_on_user_message(sender_handle, id, user_data)
end

#swo_on_viewport_border_changed(state) ⇒ Object

Called when view border, a thin edge surrounding the view, is set or removed.

Parameters:

  • state (Boolean)

    A true value indicates the edge is set; a false value indicates the edge is removed.

Since:

  • 2.0.0



366
367
# File 'Documentation/ams/sketchup_observer.rb', line 366

def swo_on_viewport_border_changed(state)
end

#swo_on_viewport_paintObject

Called when the view window is redrawn.

Since:

  • 2.0.0



353
354
# File 'Documentation/ams/sketchup_observer.rb', line 353

def swo_on_viewport_paint
end

#swo_on_viewport_size(w, h) ⇒ Object

Called when the view window is sized.

Parameters:

  • w (Fixnum)

    View width in pixels.

  • h (Fixnum)

    View height in pixels.

Since:

  • 2.0.0



359
360
# File 'Documentation/ams/sketchup_observer.rb', line 359

def swo_on_viewport_size(w,h)
end

#swp_on_command(id) ⇒ Fixnum

Note:

Since version 3.1.0, this event no longer triggers on 24214 command.

Called when SketchUp window procedure comes across the WM_COMMAND message. This event responds to Sketchup.send_action, as it too, generates WM_COMMAND messages. This event is usually called when a tool is activated.

Parameters:

  • id (Fixnum)

    Command identifier

Returns:

  • (Fixnum)

    A return value of 1 will prevent the command from reaching SketchUp window procedure; any other return value won't block the command.

Since:

  • 2.0.0



280
281
# File 'Documentation/ams/sketchup_observer.rb', line 280

def swp_on_command(id)
end

#swp_on_key_down(vk_name, vk_value, vk_char) ⇒ Fixnum

Called when key is pressed.

Parameters:

  • vk_name (String)

    Virtual key name

  • vk_value (Fixnum)

    Virtual key constant value

  • vk_char (String)

    Actual key character

Returns:

  • (Fixnum)

    A return value of 1 will prevent the key from interacting with SketchUp window procedure; any other return value will not block the key.

Since:

  • 2.0.0



247
248
# File 'Documentation/ams/sketchup_observer.rb', line 247

def swp_on_key_down(vk_name, vk_value, vk_char)
end

#swp_on_key_extended(vk_name, vk_value, vk_char) ⇒ Fixnum

Called when key is held down.

Parameters:

  • vk_name (String)

    Virtual key name

  • vk_value (Fixnum)

    Virtual key constant value

  • vk_char (String)

    Actual key character

Returns:

  • (Fixnum)

    A return value of 1 will prevent the key from interacting with SketchUp window procedure; any other return value will not block the key.

Since:

  • 2.0.0



257
258
# File 'Documentation/ams/sketchup_observer.rb', line 257

def swp_on_key_extended(vk_name, vk_value, vk_char)
end

#swp_on_key_up(vk_name, vk_value, vk_char) ⇒ Fixnum

Called when key is released.

Parameters:

  • vk_name (String)

    Virtual key name

  • vk_value (Fixnum)

    Virtual key constant value

  • vk_char (String)

    Actual key character

Returns:

  • (Fixnum)

    A return value of 1 will prevent the key from interacting with SketchUp window procedure; any other return value will not block the key.

Since:

  • 2.0.0



267
268
# File 'Documentation/ams/sketchup_observer.rb', line 267

def swp_on_key_up(vk_name, vk_value, vk_char)
end

#swp_on_lbutton_double_click(x, y) ⇒ Fixnum

Called when left mouse button is double clicked.

Parameters:

  • x (Fixnum)

    X cursor position relative to the upper-left corner of the viewport client area.

  • y (Fixnum)

    Y cursor position relative to the upper-left corner of the viewport client area.

Returns:

  • (Fixnum)

    A return value of 1 will prevent this event from interacting with SketchUp window procedure. Any other return value will allow this event to interact with SketchUp window procedure.

Since:

  • 2.0.0



124
125
# File 'Documentation/ams/sketchup_observer.rb', line 124

def swp_on_lbutton_double_click(x,y)
end

#swp_on_lbutton_down(x, y) ⇒ Fixnum

Called when left mouse button is clicked.

Parameters:

  • x (Fixnum)

    X cursor position relative to the upper-left corner of the viewport client area.

  • y (Fixnum)

    Y cursor position relative to the upper-left corner of the viewport client area.

Returns:

  • (Fixnum)

    A return value of 1 will prevent this event from interacting with SketchUp window procedure. Any other return value will allow this event to interact with SketchUp window procedure.

Since:

  • 2.0.0



112
113
# File 'Documentation/ams/sketchup_observer.rb', line 112

def swp_on_lbutton_down(x,y)
end

#swp_on_lbutton_up(x, y) ⇒ Fixnum

Called when left mouse button is released.

Parameters:

  • x (Fixnum)

    X cursor position relative to the upper-left corner of the viewport client area.

  • y (Fixnum)

    Y cursor position relative to the upper-left corner of the viewport client area.

Returns:

  • (Fixnum)

    A return value of 1 will prevent this event from interacting with SketchUp window procedure. Any other return value will allow this event to interact with SketchUp window procedure.

Since:

  • 2.0.0



118
119
# File 'Documentation/ams/sketchup_observer.rb', line 118

def swp_on_lbutton_up(x,y)
end

#swp_on_mbutton_double_click(x, y) ⇒ Fixnum

Called when middle mouse button is double clicked.

Parameters:

  • x (Fixnum)

    X cursor position relative to the upper-left corner of the viewport client area.

  • y (Fixnum)

    Y cursor position relative to the upper-left corner of the viewport client area.

Returns:

  • (Fixnum)

    A return value of 1 will prevent this event from interacting with SketchUp window procedure. Any other return value will allow this event to interact with SketchUp window procedure.

Since:

  • 2.0.0



142
143
# File 'Documentation/ams/sketchup_observer.rb', line 142

def swp_on_mbutton_double_click(x,y)
end

#swp_on_mbutton_down(x, y) ⇒ Fixnum

Called when middle mouse button is clicked.

Parameters:

  • x (Fixnum)

    X cursor position relative to the upper-left corner of the viewport client area.

  • y (Fixnum)

    Y cursor position relative to the upper-left corner of the viewport client area.

Returns:

  • (Fixnum)

    A return value of 1 will prevent this event from interacting with SketchUp window procedure. Any other return value will allow this event to interact with SketchUp window procedure.

Since:

  • 2.0.0



148
149
# File 'Documentation/ams/sketchup_observer.rb', line 148

def swp_on_mbutton_down(x,y)
end

#swp_on_mbutton_up(x, y) ⇒ Fixnum

Called when middle mouse button is released.

Parameters:

  • x (Fixnum)

    X cursor position relative to the upper-left corner of the viewport client area.

  • y (Fixnum)

    Y cursor position relative to the upper-left corner of the viewport client area.

Returns:

  • (Fixnum)

    A return value of 1 will prevent this event from interacting with SketchUp window procedure. Any other return value will allow this event to interact with SketchUp window procedure.

Since:

  • 2.0.0



154
155
# File 'Documentation/ams/sketchup_observer.rb', line 154

def swp_on_mbutton_up(x,y)
end

#swp_on_mouse_wheel_rotate(x, y, dir) ⇒ Fixnum

Called when mouse wheel is rotated.

Parameters:

  • x (Fixnum)

    X cursor position relative to the upper-left corner of the viewport client area.

  • y (Fixnum)

    Y cursor position relative to the upper-left corner of the viewport client area.

  • dir (Fixnum)

    A positive value (1) indicates that the wheel was rotated forward, away from the user; a negative value (-1) indicates that the wheel was rotated backward, toward the user.

Returns:

  • (Fixnum)

    A return value of 1 will prevent this event from interacting with SketchUp window procedure. Any other return value will allow this event to interact with SketchUp window procedure.

Since:

  • 2.0.0



208
209
# File 'Documentation/ams/sketchup_observer.rb', line 208

def swp_on_mouse_wheel_rotate(x,y, dir)
end

#swp_on_mouse_wheel_tilt(x, y, dir) ⇒ Fixnum

Called when mouse wheel is tilted.

Parameters:

  • x (Fixnum)

    X cursor position relative to the upper-left corner of the viewport client area.

  • y (Fixnum)

    Y cursor position relative to the upper-left corner of the viewport client area.

  • dir (Fixnum)

    A positive value (1) indicates that the wheel was tilted right; a negative value (-1) indicates that the wheel was tilted left.

Returns:

  • (Fixnum)

    A return value of 1 will prevent this event from interacting with SketchUp window procedure. Any other return value will allow this event to interact with SketchUp window procedure.

Since:

  • 2.0.0



219
220
# File 'Documentation/ams/sketchup_observer.rb', line 219

def swp_on_mouse_wheel_tilt(x,y, dir)
end

#swp_on_page_selected(page1, page2, tab_index1, tab_index2) ⇒ Fixnum

Note:

Unlike the swo_on_page_selected, this callback function allows preventing the activation of a page and is triggered only when the page is activated via selecting it from the scenes bar. Activating a page in any other way, through the API for instance, will not trigger this event.

Note:

This event is useful for creating custom scene transitions.

Called when a scenes page is selected.

Examples:

Activate scene tab without activating the associated page.

class MySWPObserver
  def swp_on_page_selected(page1, page2, tab_index1, tab_index2)
    AMS::Sketchup.activate_scenes_bar_tab(tab_index2)
    return 1
  end
end
AMS::Sketchup.add_observer(MySWPObserver.new)

Parameters:

  • page1 (Sketchup::Page)

    Originally selected page.

  • page2 (Sketchup::Page)

    New selected page.

  • tab_index1 (Fixnum)
  • tab_index2 (Fixnum)

Returns:

  • (Fixnum)

    A return value of 1 will prevent this event from interacting with SketchUp window procedure. Any other return value will allow this event to interact with SketchUp window procedure.

Since:

  • 3.5.0



464
465
# File 'Documentation/ams/sketchup_observer.rb', line 464

def swp_on_page_selected(page1, page2, tab_index1, tab_index2)
end

#swp_on_rbutton_down(x, y) ⇒ Fixnum

Called when right mouse button is clicked.

Parameters:

  • x (Fixnum)

    X cursor position relative to the upper-left corner of the viewport client area.

  • y (Fixnum)

    Y cursor position relative to the upper-left corner of the viewport client area.

Returns:

  • (Fixnum)

    A return value of 1 will prevent this event from interacting with SketchUp window procedure. Any other return value will allow this event to interact with SketchUp window procedure.

Since:

  • 2.0.0



130
131
# File 'Documentation/ams/sketchup_observer.rb', line 130

def swp_on_rbutton_down(x,y)
end

#swp_on_rbutton_up(x, y) ⇒ Fixnum

Called when right mouse button is released.

Parameters:

  • x (Fixnum)

    X cursor position relative to the upper-left corner of the viewport client area.

  • y (Fixnum)

    Y cursor position relative to the upper-left corner of the viewport client area.

Returns:

  • (Fixnum)

    A return value of 1 will prevent this event from interacting with SketchUp window procedure. Any other return value will allow this event to interact with SketchUp window procedure.

Since:

  • 2.0.0



136
137
# File 'Documentation/ams/sketchup_observer.rb', line 136

def swp_on_rbutton_up(x,y)
end

#swp_on_xbutton1_double_click(x, y) ⇒ Fixnum

Called when X mouse button 1 is double clicked.

Parameters:

  • x (Fixnum)

    X cursor position relative to the upper-left corner of the viewport client area.

  • y (Fixnum)

    Y cursor position relative to the upper-left corner of the viewport client area.

Returns:

  • (Fixnum)

    A return value of 1 will prevent this event from interacting with SketchUp window procedure. Any other return value will allow this event to interact with SketchUp window procedure.

Since:

  • 2.0.0



178
179
# File 'Documentation/ams/sketchup_observer.rb', line 178

def swp_on_xbutton1_double_click(x,y)
end

#swp_on_xbutton1_down(x, y) ⇒ Fixnum

Called when X mouse button 1 is clicked.

Parameters:

  • x (Fixnum)

    X cursor position relative to the upper-left corner of the viewport client area.

  • y (Fixnum)

    Y cursor position relative to the upper-left corner of the viewport client area.

Returns:

  • (Fixnum)

    A return value of 1 will prevent this event from interacting with SketchUp window procedure. Any other return value will allow this event to interact with SketchUp window procedure.

Since:

  • 2.0.0



166
167
# File 'Documentation/ams/sketchup_observer.rb', line 166

def swp_on_xbutton1_down(x,y)
end

#swp_on_xbutton1_up(x, y) ⇒ Fixnum

Called when X mouse button 1 is released.

Parameters:

  • x (Fixnum)

    X cursor position relative to the upper-left corner of the viewport client area.

  • y (Fixnum)

    Y cursor position relative to the upper-left corner of the viewport client area.

Returns:

  • (Fixnum)

    A return value of 1 will prevent this event from interacting with SketchUp window procedure. Any other return value will allow this event to interact with SketchUp window procedure.

Since:

  • 2.0.0



172
173
# File 'Documentation/ams/sketchup_observer.rb', line 172

def swp_on_xbutton1_up(x,y)
end

#swp_on_xbutton2_double_click(x, y) ⇒ Fixnum

Called when X mouse button 2 is double clicked.

Parameters:

  • x (Fixnum)

    X cursor position relative to the upper-left corner of the viewport client area.

  • y (Fixnum)

    Y cursor position relative to the upper-left corner of the viewport client area.

Returns:

  • (Fixnum)

    A return value of 1 will prevent this event from interacting with SketchUp window procedure. Any other return value will allow this event to interact with SketchUp window procedure.

Since:

  • 2.0.0



196
197
# File 'Documentation/ams/sketchup_observer.rb', line 196

def swp_on_xbutton2_double_click(x,y)
end

#swp_on_xbutton2_down(x, y) ⇒ Fixnum

Called when X mouse button 2 is clicked.

Parameters:

  • x (Fixnum)

    X cursor position relative to the upper-left corner of the viewport client area.

  • y (Fixnum)

    Y cursor position relative to the upper-left corner of the viewport client area.

Returns:

  • (Fixnum)

    A return value of 1 will prevent this event from interacting with SketchUp window procedure. Any other return value will allow this event to interact with SketchUp window procedure.

Since:

  • 2.0.0



184
185
# File 'Documentation/ams/sketchup_observer.rb', line 184

def swp_on_xbutton2_down(x,y)
end

#swp_on_xbutton2_up(x, y) ⇒ Fixnum

Called when X mouse button 2 is released.

Parameters:

  • x (Fixnum)

    X cursor position relative to the upper-left corner of the viewport client area.

  • y (Fixnum)

    Y cursor position relative to the upper-left corner of the viewport client area.

Returns:

  • (Fixnum)

    A return value of 1 will prevent this event from interacting with SketchUp window procedure. Any other return value will allow this event to interact with SketchUp window procedure.

Since:

  • 2.0.0



190
191
# File 'Documentation/ams/sketchup_observer.rb', line 190

def swp_on_xbutton2_up(x,y)
end