Class: VRTabControl

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

Direct Known Subclasses

VRTabbedPanel

Constant Summary collapse

WINCLASSINFO =

TCS_TAB

["SysTabControl32",0]

Constants included from VRParent

VRParent::DEFAULT_FONT, VRParent::VR_ADDCONTROL_FEWARGS

Instance Attribute Summary

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 VRNotifyControl

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

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=, #winstyle

Instance Method Details

#adjustRect(x, y, w, h, flag = false) ⇒ Object



1534
1535
1536
1537
1538
1539
# File 'lib/vr/vrcomctl.rb', line 1534

def adjustRect(x,y,w,h,flag=false)
  f = if flag then  1 else 0 end
  rect=@screen.application.arg2cstructStr("UUUU",x,y,w,h)
  sendMessage WMsg::TCM_ADJUSTRECT,f,rect
  return @screen.application.unpack(rect,"UUUU")
end

#clearTabsObject



1492
1493
1494
# File 'lib/vr/vrcomctl.rb', line 1492

def clearTabs
  sendMessage WMsg::TCM_DELETEALLITEMS,0,0
end

#countTabsObject



1504
1505
1506
# File 'lib/vr/vrcomctl.rb', line 1504

def countTabs
  sendMessage WMsg::TCM_GETITEMCOUNT,0,0
end

#deleteTab(i) ⇒ Object



1496
1497
1498
# File 'lib/vr/vrcomctl.rb', line 1496

def deleteTab(i)
  sendMessage WMsg::TCM_DELETEITEM,i,0
end

#getTabImageOf(idx) ⇒ Object



1554
1555
1556
1557
1558
1559
# File 'lib/vr/vrcomctl.rb', line 1554

def getTabImageOf(idx)
  tb=@screen.application.arg2cstructStr(WStruct::TC_ITEM,
          0x2,0,0," \0",1,0,0)
  rv=sendMessage WMsg::TCM_GETITEM,idx.to_i,tb
  r=@screen.application.unpack(tb,WStruct::TC_ITEM)[5]
end

#getTabLParamOf(idx) ⇒ Object



1560
1561
1562
1563
1564
1565
# File 'lib/vr/vrcomctl.rb', line 1560

def getTabLParamOf(idx)
  tb=@screen.application.arg2cstructStr(WStruct::TC_ITEM,
          0x8,0,0," \0",1,0,0)
  rv=sendMessage WMsg::TCM_GETITEM,idx.to_i,tb
  r=@screen.application.unpack(tb,WStruct::TC_ITEM)[6]
end

#getTabRect(i) ⇒ Object



1528
1529
1530
1531
1532
# File 'lib/vr/vrcomctl.rb', line 1528

def getTabRect(i)
  rect="\0"*16
  sendMessage WMsg::TCM_GETITEMRECT,i.to_i,rect
  return @screen.application.unpack(rect,"UUUU")
end

#getTabTextOf(idx) ⇒ Object

tab’s properties = text,image,lparam



1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
# File 'lib/vr/vrcomctl.rb', line 1543

def getTabTextOf(idx)
  tb=@screen.application.arg2cstructStr(WStruct::TC_ITEM,
          0x1,0,0,"\0"*128,128,0,0)
  rv=sendMessage WMsg::TCM_GETITEM,idx.to_i,tb
  if rv!=0 then
    r=@screen.application.unpack(tb,WStruct::TC_ITEM)[3]
    @screen.application.pointer2string(r)
  else
    nil
  end
end

#insertTab(idx, text, textmax = text.size, lparam = 0) ⇒ Object



1508
1509
1510
1511
1512
1513
# File 'lib/vr/vrcomctl.rb', line 1508

def insertTab(idx,text,textmax=text.size,lparam=0)
  tb=@screen.application.arg2cstructStr(WStruct::TC_ITEM,
          0x9,0,0,text,textmax,0,lparam)
        # Mask,rsrv1,rsrv2,Text,TextMax,iImage,lParam
  sendMessage WMsg::TCM_INSERTITEM,idx.to_i,tb
end

#selectedTabObject



1500
1501
1502
# File 'lib/vr/vrcomctl.rb', line 1500

def selectedTab
  sendMessage WMsg::TCM_GETCURSEL,0,0
end

#selectTab(i) ⇒ Object



1515
1516
1517
# File 'lib/vr/vrcomctl.rb', line 1515

def selectTab(i)
  sendMessage WMsg::TCM_SETCURSEL,i,0
end

#setImagelist(imagelist) ⇒ Object



1519
1520
1521
1522
# File 'lib/vr/vrcomctl.rb', line 1519

def setImagelist(imagelist)
  raise "not Imagelist" unless imagelist.is_a?(SWin::Imagelist)
  sendMessage WMsg::TCM_SETIMAGELIST,0,imagelist.himagelist
end

#setTabImageOf(idx, iImage) ⇒ Object



1573
1574
1575
1576
1577
1578
# File 'lib/vr/vrcomctl.rb', line 1573

def setTabImageOf(idx,iImage)
  tb=@screen.application.arg2cstructStr(WStruct::TC_ITEM,
          0x2,0,0," \0",1,iImage,0)
  sendMessage WMsg::TCM_SETITEM,idx.to_i,tb
  self.refresh
end

#setTabLParamOf(idx, lparam) ⇒ Object



1579
1580
1581
1582
1583
# File 'lib/vr/vrcomctl.rb', line 1579

def setTabLParamOf(idx,lparam)
  tb=@screen.application.arg2cstructStr(WStruct::TC_ITEM,
          0x8,0,0," \0",1,0,lparam)
  sendMessage WMsg::TCM_SETITEM,idx.to_i,tb
end

#setTabSize(width, height) ⇒ Object



1524
1525
1526
# File 'lib/vr/vrcomctl.rb', line 1524

def setTabSize(width,height)
  sendMessage WMsg::TCM_SETITEMSIZE,0,MAKELPARAM(width,height)
end

#setTabTextOf(idx, text) ⇒ Object



1567
1568
1569
1570
1571
1572
# File 'lib/vr/vrcomctl.rb', line 1567

def setTabTextOf(idx,text)
  tb=@screen.application.arg2cstructStr(WStruct::TC_ITEM,
          0x1,0,0,text,text.length,0,0)
  sendMessage WMsg::TCM_SETITEM,idx.to_i,tb
  self.refresh
end

#tabcontrolinitObject



1483
1484
1485
# File 'lib/vr/vrcomctl.rb', line 1483

def tabcontrolinit
  addNotifyHandler WMsg::TCN_SELCHANGE,"selchanged",MSGTYPE::ARGNONE,nil
end

#vrinitObject



1487
1488
1489
1490
# File 'lib/vr/vrcomctl.rb', line 1487

def vrinit
  super
  tabcontrolinit
end