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

📄 codeview.tbl

📁 cShap控制云台运动
💻 TBL
📖 第 1 页 / 共 2 页
字号:
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
</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 s = ar[i] 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
  n = n - VScrollBar1.Pos
  if FUpdate and n &gt;= 0 and n &lt; Group1.UnitCount then
    Group1.Units[n].Units[2].FontBold = hastext
  end if
end if
end function
property ItemIndex read FItemIndex write SetItemIndex
published function OnChange(Sender)
if IsLoaded() then
  IDE_ListBox1Click()
end if
end function
published function OnDblClick(Sender)
IDE_ListBox1DblClick()
end function
published function OnDelete()
IDE_ListBox1Delete()
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
  n = ItemIndex - Group1.UnitCount
else if Key = 34 then
  n = ItemIndex + Group1.UnitCount
else if Key = 35 then
  n = ar.Count - 1
else if Key = 36 then
  n = 0
else if Key = 37 or Key = 38 then
  n = ItemIndex - 1
else if Key = 39 or Key = 40 then
  n = ItemIndex + 1
else if Key = 46 then
  if ItemIndex &gt;= 0 then
    OnDelete()
  end if
  return
else if Key = 13 then
  if ItemIndex &gt;= 0 then
    OnDblClick( Sender )
  end if
  return
else
  return
end if
if n &gt;= ar.Count then
  n = ar.Count - 1
end if
if n &lt; 0 then
  n = 0
end if
if n &gt;= 0 and n &lt; ar.Count then
  ItemIndex = n
  Scroll()
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
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
published function OnRButtonDown(Sender,X,Y)
p=point(x,y)
GetCursorPos( p )
doc = Create( Handle, &quot;popupmenu3.tbl&quot;, true, false )
doc.ActiveSheet.MenuItem1.Enable = IDE_CanAddNewFunction()
doc.ActiveSheet.MenuItem2.Enable = IDE_CanAddNewProperty()
doc.ActiveSheet.MenuItem3.Enable = IDE_CanModify()
doc.ActiveSheet.MenuItem4.Enable = IDE_CanDelete()
doc.ActiveSheet.MenuItem5.Enable = ListBox1.ItemIndex &gt;= 0
AId = doc.Popup( p.x, p.y )
if AId = 1 then
  IDE_NewFunction()
else if AId = 2 then
  IDE_NewProperty()
else if AId = 3 then
  IDE_ModifyFunction()
else if AId = 4 then
  IDE_DeleteFunction()
else if AId = 5 then
  extern void = PostMessageW( int, int, int, int ) in User32.dll
  WM_KEYDOWN = 256
  VK_RETURN = $0D
  PostMessageW( Handle, WM_KEYDOWN, VK_RETURN, 0 )
else if AId = 6 then
  extern void = PostMessageW( int, int, int, int ) in User32.dll
  WM_KEYDOWN = 256
  VK_F11 = $7A
  PostMessageW( Handle, WM_KEYDOWN, VK_F11, 0 )
end if
doc.Free()
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
  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
public function Scroll()
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
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 = 0
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
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
OnChange( this )
end function
</programe>
</ListBox>
<KeyManager name="KeyManager1" lib="controls.tbl" bounds="128,176,152,200" origin="140,188" visible="false" hint="璇峰湪椤甸潰鐨凮nKeyDown浜嬩欢閲屽啓KeyManager1.OnKeyDown( Sender, Key )"/>
<programe>
private function OnKeyDown(Sender,Key)
if Key = 112 then
  IDE_HelpContext( 9 )
else
  KeyManager1.OnKeyDown( KeyManager1, Key )
end if
end function
private function OnRButtonDown(Sender,X,Y)
end function
private function OnResize(Sender)
ListBox1.SetBounds( 0, 0, ClientWidth, ClientHeight )
end function
</programe>
</sheet>
</vg>

⌨️ 快捷键说明

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