Class: VRTabbedPanel

Inherits:
VRTabControl show all
Includes:
VRParent
Defined in:
lib/vr/vrcomctl.rb

Constant Summary

Constants included from VRParent

VRParent::DEFAULT_FONT, VRParent::VR_ADDCONTROL_FEWARGS

Constants inherited from VRTabControl

VRTabControl::WINCLASSINFO

Constants inherited from VRControl

VRControl::WINCLASSINFO

Instance Attribute Summary collapse

Attributes included from VRParent

#screen

Attributes inherited from VRNotifyControl

#_vr_notifyarg

Attributes inherited from VRControl

#handlers, #name, #parent

Attributes inherited from VRWinComponent

#parent, #screen

Instance Method Summary collapse

Methods included from VRParent

#addArrayedControl, #addControl, #clearControls, #construct, #countControls, #create, #createControl, #deleteControl, #newControlID, #parentinit, #registerControl, #registerControlAsArrayed, #self_created, #send_parent

Methods inherited from VRTabControl

#adjustRect, #clearTabs, #countTabs, #deleteTab, #getTabImageOf, #getTabLParamOf, #getTabRect, #getTabTextOf, #insertTab, #selectedTab, #setImagelist, #setTabImageOf, #setTabLParamOf, #setTabSize, #setTabTextOf, #tabcontrolinit, #vrinit

Methods inherited from VRNotifyControl

#_vr_ntfyhandlers, #addFilterArg, #addNotifyHandler, #deleteFilterArg, #deleteNotifyHandler, #notifycontrolinit, #vrinit

Methods inherited from VRControl

Controltype, #add_parentcall, #call_parenthandler, #create, #setFont

Methods inherited from VRWinComponent

#_init, #create, #exwinstyle, #hide, #maximizebox, #maximizebox=, #minimizebox, #minimizebox=, #setscreen, #sizebox, #sizebox=, #tabstop, #tabstop=, #vrinit, #winstyle

Instance Attribute Details

#panelsObject (readonly)

VRTabbedPanel

This is a class utilizing VRTabControl. On this control, each tab has a VRPanel and be shown/hidden automatically according to the selected tab.

Methods

— setupPanels(title-1,title-2,title-3,.…)

Creates tabs each titled ((|title-n|)).

— send_parent2(idx,controlname,eventname)

Sets to send to its parent an event of control named ((|controlname|)) 
on the panel at ((|idx|)).

Attribute(s)

— panels

An array that contains panels for each tab.
panels[i] means a panel concerned with the tab at ((|i|)).

Event Handlers

Same as ((<VRTabControl>)). VRTabbedPanel#selchanged is already defined, so you need to call super when you override this method.



1609
1610
1611
# File 'lib/vr/vrcomctl.rb', line 1609

def panels
  @panels
end

Instance Method Details

#selchangedObject



1637
1638
1639
1640
1641
1642
1643
1644
# File 'lib/vr/vrcomctl.rb', line 1637

def selchanged
  raise "assigned no panels" if @panels.size<1
  @panels[@_vr_prevpanel].show(0)
  t=selectedTab
  @panels[t].show
  @_vr_prevpanel=t
  @panels[t].refresh
end

#selectTab(i) ⇒ Object



1632
1633
1634
1635
# File 'lib/vr/vrcomctl.rb', line 1632

def selectTab(i)
  super
  selchanged
end

#send_parent2(i, name, method) ⇒ Object



1627
1628
1629
1630
# File 'lib/vr/vrcomctl.rb', line 1627

def send_parent2(i,name,method)
  @panels[i].send_parent(name,method)
  send_parent "panel#{i}","#{name}_#{method}"
end

#setupPanels(*titles) ⇒ Object



1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
# File 'lib/vr/vrcomctl.rb', line 1612

def setupPanels(*titles)
  @panels=Array.new(titles.size)
  0.upto(titles.size-1) do |i|
    insertTab i,titles[i]
    x,y,w,h = adjustRect(0,0,self.w,self.h,false)
    @panels[i] = addControl(VRPanel,"panel#{i}","panel#{i}",x,y,w-x,h-y)
    @panels[i].extend VRContainersSet
    @panels[i].containers_init
    @panels[i].show 0
  end

  @_vr_prevpanel=0
  selectTab 0
end