Module: VRScrollbarContainer

Included in:
VRContainersSet
Defined in:
lib/vr/vrcontrol.rb

Instance Method Summary collapse

Instance Method Details

#scrollbarcontainerinitObject



1173
1174
1175
1176
1177
1178
# File 'lib/vr/vrcontrol.rb', line 1173

def scrollbarcontainerinit
  addHandler WMsg::WM_HSCROLL,"vrscroll",MSGTYPE::ARGINTINT,nil
  addHandler WMsg::WM_VSCROLL,"vrscroll",MSGTYPE::ARGINTINT,nil
  acceptEvents [ WMsg::WM_HSCROLL,WMsg::WM_VSCROLL]
  @_vr_scrollbars={}
end

#searchscrollbar(hwnd) ⇒ Object



1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
# File 'lib/vr/vrcontrol.rb', line 1184

def searchscrollbar(hwnd)
  @_vr_scrollbars=Hash.new unless defined? @_vr_scrollbars
  srl = @_vr_scrollbars[hwnd]   # false : to be ignored window, 0: form
  if srl==nil then
    @controls.each_value do |v| 
      if v.is_a?(SWin::Window) and v.hWnd==hwnd then
        if v.is_a?(VRScrollbar) then
          @_vr_scrollbars[hwnd] = srl = v
        elsif defined?(VRTrackbar) and v.is_a?(VRTrackbar) then
          @_vr_scrollbars[hwnd] = srl = false
        elsif defined?(VRUpdown) and v.is_a?(VRUpdown) then
          @_vr_scrollbars[hwnd] = srl = false
        else 
          @_vr_scrollbars[hwnd] = srl = 0
        end
        break
      end
    end # @controls.each_value
  end

  case srl
  when 0
    self
  when false
    nil
  when nil
    nil
  else
    srl
  end
end

#self_vrscroll(wparam, hwnd) ⇒ Object



1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
# File 'lib/vr/vrcontrol.rb', line 1216

def self_vrscroll(wparam,hwnd)
  srl = searchscrollbar(hwnd)
  return unless srl

  code=LOWORD(wparam)
  if code==4 then
    pos=HIWORD(wparam)
  else
    pos  = srl.position
  end
  case code
  when 0 
    srl.sendMessage 224,pos-srl.smallstep,1
  when 1
    srl.sendMessage 224,pos+srl.smallstep,1
  when 2
    srl.sendMessage 224,pos-srl.longstep,1
  when 3
    srl.sendMessage 224,pos+srl.longstep,1
  when 4
    srl.sendMessage 224,pos,1
  end
  controlmsg_dispatching(srl,"changed")
end

#vrinitObject



1179
1180
1181
1182
# File 'lib/vr/vrcontrol.rb', line 1179

def vrinit
  super
  scrollbarcontainerinit
end