⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 poplist.tbl

📁 cShap控制云台运动
💻 TBL
📖 第 1 页 / 共 3 页
字号:
if Element3.Visible then
  Element3.Top = Element2.Top + Element2.Height
else
  Element3.Top = Element2.Top
end if
Line1.SetBounds( Left, Element3.Top, Line1.Width, Element1.Top - Element3.Top )
Line2.SetBounds( Line1.Left, Line1.Top, Line1.Width, Line1.Height )
SetPos( FPos )
end function
private function OnTimer(Sender)
SetPos( FPos + Line1.Tag * FPage )
p = Point( 0, 0 )
GetCursorPos( p )
ScreenToClient( p )
ClientToView( p )
stop = false
if Line1.Tag > 0 then
  if p.y < Element3.Top + Element3.Height then
    stop = true
  end if
else
  if p.y > Element3.Top then
    stop = true
  end if
end if
if stop then
  OnDestroy( Sender )
  Line2.Visible = false
else if FTimerInterval = 300 then
  OnDestroy( Sender )
  FTimerInterval = 100
  FTimer = CreateTimer( Sender, "OnTimer", FTimerInterval )
end if
end function
property Page read FPage write SetPage
property Pos read FPos write SetPos
private function SetEnable(AValue)
Element1.Enable = AValue
Element2.Enable = AValue
Enabled = AValue
end function
private function SetMax(AValue)
n = int( AValue )
if ( n < 0 ) then
  n = 0
end if
FMax = n
SetPage( FPage )
SetPos( FPos )
end function
private function SetPage(AValue)
FPage = int( AValue )
if( FPage > FMax )then
	FPage = FMax
end if
if FPage < 1 then
  FPage = 1
end if
end function
private function SetPos(AValue)
n=int( AValue )
if n < 0 then
	n = 0
end if
if n > FMax then
	n = FMax
end if
Element3.Visible = (Line1.Height > Element3.Height)
m = Element3.Top
if FMax <> 0 then
  Element3.Top = Line1.Top + ( Line1.Height - Element3.Height ) * n / FMax
else
  Element3.Top = Line1.Top
end if
if Line1.Tag > m then
  Line2.SetBounds( Line1.Left, Element3.Top + Element3.Height, Line1.Width, Element1.Top - Element3.Top - Element3.Height )
else
  Line2.SetBounds( Line1.Left, Line1.Top, Line1.Width, Element3.Top - Line1.Top )
end if
if FPos <> n then
	FPos = n
  OnChange( this )
end if
end function
</programe>
</VScrollBar>
<group name="Group1">
Item1
Item2
Item3
Item4
Item5
Item6
Item7
Item8
Item9
Item10
Item11
</group>
<programe>
public function AddItem(AValue,AType,ABold,AGray)
i=ar.Count
ar[i]=AValue
br[i]=AType
cr[i]=ABold
dr[i]=AGray
if FUpdate then
  Reset()
end if
end function
public function BeginUpdate()
FUpdate = false
end function
public function Clear()
ar.Clear()
br.Clear()
cr.Clear()
dr.Clear()
if FUpdate then
  Reset()
end if
end function
public function DeleteItem(AIndex)
if AIndex&gt;=0 and AIndex&lt;ar.Count then
  ar.Delete( AIndex )
  br.Delete( AIndex )
  cr.Delete( AIndex )
  dr.Delete( AIndex )
  if FUpdate then
    Reset()
  end if
end if
end function
property Enable read GetEnable write SetEnable editor Bool
public function EndUpdate()
FUpdate = true
Reset()
end function
property Focused read GetFocused write SetFocused editor Bool
public function GetCount()
return ar.Count
end function
private function GetEnable()
return Enabled
end function
private function GetFocused()
return Rect1.Visible
end function
public function GetItem(AIndex)
return ar[AIndex]
end function
public function IndexOf(s)
i = 0
while i &lt; ar.Count
  if At( UCase( s ), UCase( ar[i] ) ) = 1 then
    return i
  end if
  i = i + 1
wend
return -1
end function
private function Initialize(Sender)
ar=array(10)
br=array(10)
cr=array(10)
dr=array(10)
FItemIndex=-1
FUpdate = true
end function
public function InvalidateLine(eventname,hastext)
n = IndexOf( eventname )
if n &lt;&gt; -1 then
  cr[n] = hastext
  if FUpdate then
    Group1.Units[n-VScrollBar1.Pos].Units[2].FontBold = hastext
  end if
end if
end function
property ItemIndex read FItemIndex write SetItemIndex
published function OnChange(Sender)
end function
private function OnClick(Sender)
d = UnitAtCursor( VScrollBar1 )
if d &lt;&gt; 0 then
  OnChange( Sender )
end if
end function
private function OnDrawItem(AIndex)
d=Group1.Units[AIndex-VScrollBar1.Pos]
d.Units[2].Text = ar[AIndex]
d.Units[2].FontBold = cr[AIndex]
s = ExtractFilePath( FileName ) + &quot;icon\&quot; + br[AIndex] + &quot;.bmp&quot;
d.Units[1].Picture = s
if dr[AIndex] then
  d.Units[2].FontColor = $80000011
else
  d.Units[2].FontColor = $80000008
end if
end function
public function OnKeyDown(Sender,Key)
if Key = 33 then
  ItemIndex = ItemIndex - Group1.UnitCount
else if Key = 34 then
  ItemIndex = ItemIndex + Group1.UnitCount
else if Key = 35 then
  ItemIndex = ar.Count - 1
else if Key = 36 then
  ItemIndex = 0
else if Key = 37 or Key = 39 or Key = 8 or Key = 46 then
  OnListBox1KeyDown( Key )
else if Key = 38 then
  ItemIndex = ItemIndex - 1
else if Key = 40 then
  ItemIndex = ItemIndex + 1
end if
end function
private function OnLButtonDown(Sender,X,Y)
d=UnitAtPoint( X, Y, 0 )
if d &lt;&gt; 0 then
  n = Group1.FindUnit( d )
  if n &gt; -1 then
    ItemIndex = n + VScrollBar1.Pos
    Sender.Tag = 1
    Focused = true
  end if
end if
end function
private function OnLButtonUp(Sender,X,Y)
Sender.Tag = 0
end function
published function OnListBox1KeyDown(Key)
IDE_ListBox1KeyDown( Owner, Key )
end function
private function OnMouseMove(Sender,X,Y)
if Sender.Tag = 1 then
	d=UnitAtPoint( X, Y, 0 )
	if d &lt;&gt; 0 then
	  if d.ClassId = 1 then
	    n = Group1.FindUnit( d )
	    ItemIndex = n + VScrollBar1.Pos
	  end if
	end if
end if
end function
private function OnMouseWheel(Sender,Forward)
if Forward then
  VScrollBar1.Pos = VScrollBar1.Pos - Group1.UnitCount
else
  VScrollBar1.Pos = VScrollBar1.Pos + Group1.UnitCount
end if
end function
private function OnResize(Sender)
if Height &lt; 20 then
	Height = 20
end if
n=int( ( Height - 1 ) / Item1.Height )
Height = n * Item1.Height + 1
while n &lt; Group1.UnitCount
	DeleteUnit( Group1.Units[Group1.UnitCount-1] )
wend
while n &gt; Group1.UnitCount
	d = Group1.Units[Group1.UnitCount - 1]
  d = CopyUnit( d )
  d.Top = d.Top + d.Height
  d.Visible = true
  Group1.Add( d )
wend
Element1.SetBounds( Left, Top, Width, Height )
VScrollBar1.SetBounds( Left + Width - VScrollBar1.Width, Top + 1, VScrollBar1.Width, Height - 2 )
VScrollBar1.BringToFront( true )
Reset()
end function
private function OnShow(Sender)
end function
private function Reset()
VScrollBar1.Max = ar.Count - Group1.UnitCount
VScrollBar1.Page = Group1.UnitCount
VScrollBar1.Visible = ( Group1.UnitCount &lt; ar.Count )
i=0
y=Top+1
while i &lt; Group1.UnitCount
	d=Group1.Units[i]
  d.Left = Left + 1
  d.Top = y
  if VScrollBar1.Visible then
    d.Width = Width - VScrollbar1.Width - 1
  else
    d.Width = Width - 1
  end if
  y = d.Top + d.Height
	i = i + 1
wend
VScrollBar1.OnChange( VScrollBar1 )
end function
private function SetEnable(AValue)
VScrollBar1.Enable = AValue
Enabled = AValue
end function
private function SetFocused(AValue)
i=FItemIndex-VScrollBar1.Pos
if AValue and ( i &gt;= 0 ) and ( i &lt; Group1.UnitCount ) then
	d = Group1.Units[FItemIndex-VScrollBar1.Pos]
  Rect1.SetBounds( d.Left, d.Top, d.Width - 1, d.Height - 1 )
  Rect1.Visible = true
  Rect1.BringToFront( true )
else
	d = Group1.Units[0]
  Rect1.SetBounds( d.Left, d.Top, d.Width - 1, d.Height - 1 )
  Rect1.Visible = false
end if
end function
public function SetItem(AIndex,AValue,AType)
if AIndex &gt;= 0 and AIndex &lt; ar.Count then
  ar[AIndex]=AValue
  br[AIndex]=AType
  if FUpdate then
    VScrollBar1.OnChange( VScrollBar1 )
  end if
end if
end function
private function SetItemIndex(AValue)
n=AValue
if n &lt; 0 then
  n = -1
end if
if n &gt;= ar.Count then
  n = ar.Count - 1
end if
f = Focused
i=0
while i &lt; Group1.UnitCount
  d = Group1.Units[i]
  d.Selected = false
  i=i+1
wend
FItemIndex = n
if FItemIndex &lt; VScrollBar1.Pos then
	VScrollBar1.Pos = FItemIndex
else if FItemIndex - VScrollBar1.Pos &gt;= Group1.UnitCount then
  VScrollBar1.Pos = FItemIndex - Group1.UnitCount + 1
end if
i=FItemIndex-VScrollBar1.Pos
if( i &gt;= 0 ) and ( i &lt; Group1.UnitCount ) then
  d = Group1.Units[FItemIndex-VScrollBar1.Pos]
  d.Selected = true
  if f then
    Rect1.SetBounds( d.Left, d.Top, d.Width - 1, d.Height - 1 )
    Rect1.Visible = true
    Rect1.BringToFront( true )
  end if
end if
end function
</programe>
</ListBox>
<programe>
private function OnKeyDown(Sender,Key)
if Key = 27 then
  Close( 0 )
else
  ListBox1.OnKeyDown( ListBox1, Key )
end if
end function
private function OnKeyPress(Sender,Char)
IDE_ListBox1KeyPress( Owner, Char )
end function
private function OnResize(Sender)
ListBox1.SetBounds( 0, 0, ClientWidth - 1, ClientHeight - 1 )
end function
private function OnShow(Sender)
Focused = true
ListBox1.Focused = true
end function
</programe>
</sheet>
</vg>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -