📄 tabsheet.tbl
字号:
<?xml version="1.0" encoding="utf-8"?>
<vg version="700" range="0,0,2000,2000" bordericons="0" borderstyle="1" scrollbars="0" backcolor="$8000000F">
<page name="page" bounds="0,0,793.700787,1122.141732" visible="false" margin="100,100,100,100" paperwidth="2100" paperheight="2969"/>
<sheet name="sheet1" bounds="0,0,576,21">
<element name="TabSet1" bounds="0,0,576,21" origin="108.652003,-132.014977" FirstCol="0" TabIndex="-1">
<rect name="rect1" bounds="0,0,576,21" origin="206,12" linetype="0" backcolor="$8000000F" frontcolor="$FFFFFF" pattern="1"/>
<element name="element1" bounds="18,0,44,18" origin="42,12" visible="false" Caption="''" Selected="false">
<line name="line1" origin="70,16" visible="false" linetype="0" backcolor="$8000000F" pattern="1">
<points>
44,0,6
44,17,2
43,18,2
19,18,2
18,17,2
18,0,2
</points>
</line>
<line name="line3" origin="70,16" visible="false" backcolor="$8000000F">
<points>
44,0,6
44,17,2
43,18,2
19,18,2
18,17,2
18,0,2
</points>
</line>
<line name="line2" origin="34.32334,8.408994" visible="false" linecolor="$80000010">
<points>
19,17,6
43,17,2
43,0,2
</points>
</line>
<text name="text1" bounds="27,2,35,14" origin="23.991266,12" autosize="true" border="$0" fontsize="12" fontcolor="$80000011" textalign="0" borderinterval="0"/>
<line name="line4" origin="43,8.5" linecolor="$80000010">
<points>
42,0,6
42,18,2
</points>
</line>
<programe>
property Caption read GetCaption write SetCaption
private function GetCaption()
return Text1.Text
end function
private function Initialize(Sender)
FSelected = false
end function
property Selected read FSelected write SetSelected editor Bool
private function SetCaption(AValue)
i=text1.Width
Text1.Text = AValue
j=text1.Width
line1.x[0]=line1.x[0]+(j-i)
line1.x[1]=line1.x[1]+(j-i)
line1.x[2]=line1.x[2]+(j-i)
line1.Refresh()
line2.x[1] = Line1.x[0] - 1
line2.x[2] = Line1.x[0] - 1
line2.Refresh()
line3.x[0] = Line1.x[0]
line3.x[1] = Line1.x[1]
line3.x[2] = Line1.x[2]
line3.Refresh()
line4.x[0] = Line3.x[0] - 2
line4.x[1] = Line3.x[1] - 2
line4.Refresh()
Refresh()
end function
private function SetSelected(AValue)
if AValue then
Line1.Visible = true
Line2.Visible = true
Line3.Visible = true
Line4.Visible = false
Text1.FontColor = $80000012
else
Line1.Visible = false
Line2.Visible = false
Line3.Visible = false
Line4.Visible = true
Text1.FontColor = $80000011
end if
FSelected = AValue
end function
</programe>
</element>
<element name="UpBtn" bounds="543,0,559,16" origin="536,9" visible="false">
<rect name="Rect2" bounds="543,0,559,16" origin="549,7" linecolor="$8000000F" backcolor="$8000000F" pattern="1"/>
<line name="Line5" origin="551,8" linecolor="$80000014">
<points>
543,16,6
543,0,2
559,0,2
</points>
</line>
<line name="Line6" origin="551,8" linecolor="$80000010">
<points>
543,16,6
559,16,2
559,0,2
</points>
</line>
<line name="Line9" origin="549.5,10" linecolor="$80000012" backcolor="$0" pattern="1">
<points>
549.5,8,6
552.5,5,2
552.5,11,3
</points>
</line>
<programe>
private function Initialize(Sender)
FTimer=0
FTimerInterval = 300
end function
published function OnClick(Sender)
FirstCol = FirstCol - 1
end function
private function OnDestroy(Sender)
if FTimer <> 0 then
DestroyTimer( FTimer )
FTimer = 0
end if
end function
private function OnLButtonDown(Sender,X,Y)
Line5.LineColor = $80000010
Line6.LineColor = $80000014
Line9.Left = Line9.Left + 1
Line9.Top = Line9.Top + 1
FTimerInterval = 300
FTimer=CreateTimer( Sender, "OnTimer", FTimerInterval )
end function
private function OnLButtonUp(Sender,X,Y)
Line5.LineColor = $80000014
Line6.LineColor = $80000010
Line9.Left = Line9.Left - 1
Line9.Top = Line9.Top - 1
OnDestroy( Sender )
end function
private function OnTimer(Sender)
OnClick( Sender )
if FTimerInterval = 300 then
OnDestroy( Sender )
FTimerInterval = 100
FTimer=CreateTimer( Sender, "OnTimer", FTimerInterval )
end if
end function
</programe>
</element>
<element name="DownBtn" bounds="560,0,576,16" origin="560,-214.25" visible="false">
<rect name="Rect2" bounds="560,0,576,16" origin="566,7" linecolor="$8000000F" backcolor="$8000000F" pattern="1"/>
<line name="Line5" origin="568,8" linecolor="$80000014">
<points>
560,16,6
560,0,2
576,0,2
</points>
</line>
<line name="Line6" origin="568,8" linecolor="$80000010">
<points>
560,16,6
576,16,2
576,0,2
</points>
</line>
<line name="Line9" origin="566.5,13" linecolor="$80000012" backcolor="$0" pattern="1">
<points>
569.5,8,6
566.5,5,2
566.5,11,3
</points>
</line>
<programe>
private function Initialize(Sender)
FTimer=0
FTimerInterval = 300
end function
published function OnClick(Sender)
FirstCol = FirstCol + 1
end function
private function OnDestroy(Sender)
if FTimer <> 0 then
DestroyTimer( FTimer )
FTimer = 0
end if
end function
private function OnLButtonDown(Sender,X,Y)
Line5.LineColor = $80000010
Line6.LineColor = $80000014
Line9.Left = Line9.Left + 1
Line9.Top = Line9.Top + 1
FTimerInterval = 300
FTimer = CreateTimer( Sender, "OnTimer", FTimerInterval )
end function
private function OnLButtonUp(Sender,X,Y)
Line5.LineColor = $80000014
Line6.LineColor = $80000010
Line9.Left = Line9.Left - 1
Line9.Top = Line9.Top - 1
OnDestroy( Sender )
end function
private function OnTimer(Sender)
OnClick( Sender )
if FTimerInterval = 300 then
OnDestroy( Sender )
FTimerInterval = 100
FTimer = CreateTimer( Sender, "OnTimer", FTimerInterval )
end if
end function
</programe>
</element>
<group name="Group1">
</group>
<layer/>
<layer name="Tabs"/>
<programe>
public function Add(AValue)
ar[ar.Count] = AValue
if FUpdate then
Reset()
end if
end function
public function BeginUpdate()
FUpdate = false
end function
public function Clear()
ar.Clear()
FTabIndex = -1
if FUpdate then
Reset()
end if
end function
public function Delete(AIndex)
ar.Delete( AIndex )
if FTabIndex >= ar.Count then
FTabIndex = -1
end if
if FUpdate then
Reset()
end if
end function
public function EndUpdate()
if not FUpdate then
FUpdate = true
Reset()
end if
end function
property FirstCol read FFirstCol write SetFirstCol
public function GetCount()
return ar.Count
end function
public function GetTabName(AIndex)
return ar[AIndex]
end function
public function IndexOf(s)
i = 0
while i < ar.Count
if s = ar[i] then
return i
end if
i = i + 1
wend
return -1
end function
private function Initialize(Sender)
FFirstCol = 0
FUpdate = true
FTabIndex = -1
ar=array(10)
end function
public function Insert(AIndex,AValue)
ar.Insert( AIndex, AValue )
if FUpdate then
Reset()
end if
end function
private function OnClick(Sender)
d = UnitAtCursor( 0 )
if d = Rect1 then
doc = Create( Handle, "additemmenu.tbl", true, false )
doc.ActiveSheet.BeginUpdate()
i = 0
while i < ar.Count
d = doc.ActiveSheet.AddItem( ar[i] )
d.Id = i + 1
i = i + 1
wend
doc.ActiveSheet.EndUpdate()
p = Point( 0, 0 )
GetCursorPos( p )
n = doc.Popup( p.x, p.y )
doc.Free()
if n > 0 then
TabIndex = n - 1
end if
end if
end function
private function OnLButtonDown(Sender,X,Y)
d = UnitAtCursor( Rect1 )
if d <> 0 then
FTabIndex = Group1.FindUnit( d ) + FFirstCol
Reset()
Sender.Tag = FTabIndex + 1
end if
end function
private function OnLButtonUp(Sender,X,Y)
if Sender.Tag > 0 then
old = Sender.Tag - 1
Cursor = 0
if old <> FTabIndex then
OnTabExchange( old, FTabIndex )
else
OnTabChanged( this )
end if
Sender.Tag = 0
end if
end function
private function OnMouseMove(Sender,X,Y)
if Sender.Tag > 0 then
Cursor = 30
i = 0
d = 0
while i < Group1.UnitCount
e = Group1.Units[i]
if ( e.Left < X ) and ( X < e.Left + e.Width ) then
d = e
break
end if
i = i + 1
wend
if d <> 0 then
n = Group1.FindUnit( d ) + FFirstCol
if ( n >= 0 ) and ( FTabIndex <> n ) then
s = ar[FTabIndex]
ar.Delete( FTabIndex )
ar.Insert( n, s )
FTabIndex = n
Reset()
end if
end if
end if
end function
published function OnRButtonDown(Sender,X,Y)
doc = Create( Handle, "popupmenu6.tbl", true, false )
p = Point( X, Y )
Sender.ViewToClient( p )
ClientToScreen( p )
doc.Popup( p.x, p.y )
doc.Free()
end function
private function OnResize(Sender)
Rect1.SetBounds( Left, Top, Width, Height )
Reset()
end function
published function OnTabChanged(Sender)
if Sender.TabIndex >= 0 then
IDE_GetDocument().ActiveSheetIndex = Sender.TabIndex
end if
end function
published function OnTabExchange(OldTabIndex,NewTabIndex)
IDE_TabSet1Exchange( IDE_GetDocument(), OldTabIndex, NewTabIndex )
end function
private function Reset()
while Group1.UnitCount > 0
DeleteUnit( Group1.Units[0] )
wend
i = FFirstCol
x = Left
d = Element1
if i < ar.Count then
d.Caption = ar[i]
end if
while ( i < ar.Count ) and ( x + d.Width <= Left + Width )
d = CopyUnit( element1 )
d.Visible = true
d.Caption = ar[i]
d.Left = x
d.Layer = 1
d.Selected = false
d.SendToBack( true )
Group1.Add( d )
x = x + d.Width - 4
i = i + 1
if i < ar.Count then
d = Element1
d.Caption = ar[i]
end if
wend
UpBtn.Left = Rect1.Left + Rect1.Width - DownBtn.Width - UpBtn.Width - 1
DownBtn.Left = Rect1.Left + Rect1.Width - DownBtn.Width
if ( FFirstCol > 0 ) or ( i < ar.Count ) then
UpBtn.Visible = true
DownBtn.Visible = true
i = Group1.UnitCount - 1
while i >= 0
d = Group1.Units[i]
if d.Left + d.Width > UpBtn.Left then
DeleteUnit( d )
else
break
end if
i = i - 1
wend
else
UpBtn.Visible = false
DownBtn.Visible = false
end if
if ( FTabIndex - FFirstCol >= 0 ) and ( FTabIndex - FFirstCol < Group1.UnitCount ) then
d = Group1.Units[FTabIndex-FFirstCol]
d.Selected = true
d.BringToFront( true )
end if
Refresh()
end function
public function ScrollTo(ATabIndex)
SetTabIndex( ATabIndex )
if ATabIndex < FFirstCol then
SetFirstCol( ATabIndex )
else if ATabIndex >= FFirstCol + Group1.UnitCount then
SetFirstCol( ATabIndex )
end if
end function
private function SetFirstCol(AValue)
if AValue >= 0 and AValue < ar.Count
FFirstCol = AValue
Reset()
end if
end function
private function SetTabIndex(AValue)
if AValue >= -1 and AValue < ar.Count
FTabIndex = AValue
Reset()
OnTabChanged( this )
end if
end function
public function SetTabName(AIndex,AValue)
ar[AIndex] = AValue
if FUpdate then
Reset()
end if
end function
property TabIndex read FTabIndex write SetTabIndex
</programe>
</element>
<programe>
private function OnResize(Sender)
TabSet1.SetBounds( 0, 0, ClientWidth - 1, ClientHeight - 1 )
end function
</programe>
</sheet>
</vg>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -