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

📄 menu.tbl

📁 cShap控制云台运动
💻 TBL
字号:
<?xml version="1.0" encoding="utf-8"?>
<vg version="702" activesheetIndex="1" range="0,0,1024,712" backcolor="$8000000F">
<page name="Page" bounds="0,0,793.700787,1122.141732" visible="false"/>
<sheet name="MenuItem">
<rect name="Rect1" bounds="0,0,153,22" origin="77,15.5" linetype="0" backcolor="$80000004" pattern="1"/>
<text name="Text1" bounds="21,3,91,19" origin="25,2.75" backcolor="$8000000A" autosize="true" border="$0" fontname="瀹嬩綋" fontsize="12" fontcolor="$80000007" wordwrap="false" textalign="4" text="MenuItem(M)"/>
<line name="Line1" origin="152.25,4" visible="false" backcolor="$0" pattern="1">
<points>
144,8,6
144,14,2
147,11,3
</points>
</line>
<line name="Line2" origin="1,1" selectmode="0" linetype="0" backcolor="$C0C0C0" picture="Checkbox.bmp">
<points>
1,1,6
1,21,2
21,21,2
21,1,3
</points>
</line>
<programe>
property Caption read GetCaption write SetCaption
property Checked read FChecked write SetChecked editor Bool
property Enable read GetEnable write SetEnable editor Bool
property Focused read GetFocused write SetFocused editor Bool
private function GetCaption()
return Text1.Text
end function
private function GetEnable()
return Line2.Alpha = 100
end function
private function GetFocused()
return Rect1.BackColor = $8000000D
end function
private function GetItems()
if Doc &lt;&gt; 0 then
  return Doc.ActiveSheet
else
  return 0
end if
end function
public function HideSubMenu()
if Doc &lt;&gt; 0 then
  Doc.Hide()
  i = 0
  while i &lt; Doc.ActiveSheet.UnitCount
    d = Doc.ActiveSheet.Units[i]
    if UCase( d.Type ) = &quot;MENUITEM&quot; then
      d.HideSubMenu()
    end if
    i = i + 1
  wend
end if
end function
private function Initialize(Sender)
Doc=0
FChecked = false
FPicture = &quot;&quot;
FSubMenu=&quot;&quot;
end function
property Items read GetItems
private function OnClick(Sender)
if Line2.Alpha = 100 then
  i = 0
  while i &lt; ActiveSheet.UnitCount
    d = ActiveSheet.Units[i]
    if UCase( d.Type ) = &quot;MENUITEM&quot; then
      d.HideSubMenu()
    end if
    i = i + 1
  wend
  ActiveSheet.HandleCommand( Sender.Id )
end if
end function
private function OnDestroy(Sender)
if Doc &lt;&gt; 0 then
  Doc.Free()
end if
end function
public function OnKeyDown(Sender,Key)
if ( Key = 13 ) and ( Line2.Alpha = 100 ) then
  Parent.HandleCommand( Id )
else if Key = 27 then
  Close( 0 )
else if Key = 37 then
  if ActiveSheet.HasProperty( &quot;MainMenu&quot; ) then
    HideSubMenu()
    Close( 1 )
  end if
else if Key = 38 then
  i=0
  prior = 0
  last = 0
  t = 0
  while i &lt; Parent.UnitCount
    d = Parent.Units[i]
    if d.Visible and d.Type = Type then
      if d = this then
        prior = t
      else
        t = d
      end if
      last = d
    end if
    i = i + 1
  wend
  if prior &lt;&gt; 0 then
    prior.Focused = true
  else
    last.Focused = true
  end if
else if Key = 39 then
  if Doc &lt;&gt; 0 then
    OnMouseEnter( Sender )
  else if ActiveSheet.HasProperty( &quot;MainMenu&quot; ) then
    Close( 2 )
  end if
else if Key = 40 then
  i=0
  first = 0
  next = 0
  t = 0
  while i &lt; Parent.UnitCount
    d = Parent.Units[i]
    if d.Visible and d.Type = Type then
      if d = this then
        t = d
      else if t &lt;&gt; 0 then
        next = d
        t = 0
      end if
      if first = 0 then
        first = d
      end if
    end if
    i = i + 1
  wend
  if next &lt;&gt; 0 then
    next.Focused = true
  else
    first.Focused = true
  end if
else if Line2.Alpha = 100 then
  s = &apos;(&apos; + chr( Key ) + &apos;)&apos;
  if At( s, Caption ) &gt; 0 then
    OnClick( Sender )
  end if
end if
end function
private function OnLoad(Sender)
if Len( SubMenu ) &gt; 0 then
  Sheet = SheetByName( SubMenu )
  if Sheet &lt;&gt; 0 then
    Line1.Visible = true
    Doc = Create( Handle, &quot;&quot;, true, false )
    Doc.CopySheet( Sheet )
    Doc.DeleteSheet( Doc.Sheet1 )
    Doc.BorderStyle = 1
    Doc.ScrollBars = 0
    Doc.SelectAll()
    Doc.SetRange( Doc.ActiveSheet.Selection.Left, Doc.ActiveSheet.Selection.Top, Doc.ActiveSheet.Selection.Right + 1, Doc.ActiveSheet.Selection.Bottom + 1 )
    Doc.ActiveSheet.Selection.Clear()
    Doc.ActiveSheet.SetPropertyValue( &quot;MainMenu&quot;, Parent )
    OnLoadSubMenu( Sender, Doc.ActiveSheet )
  else
    Line1.Visible = false
  end if
else
  Line1.Visible = false
end if
end function
published function OnLoadSubMenu(Sender,ASheet)
end function
private function OnMouseEnter(Sender)
Focused = true
if Doc &lt;&gt; 0 and Line2.Alpha = 100 then
  extern int=GetSystemMetrics( int ) in User32.dll
  SM_CXSCREEN = 0
  SM_CYSCREEN = 1
  ScreenWidth = GetSystemMetrics( SM_CXSCREEN )
  ScreenHeight = GetSystemMetrics( SM_CYSCREEN )
  p = Point( Right, Top )
  ViewToClient( p )
  ClientToScreen( p )
  if p.x + Doc.RightRange - Doc.LeftRange &gt; ScreenWidth then
    p.x = p.x - Width - Doc.RightRange + Doc.LeftRange + 4
  else
    p.x = p.x - 4
  end if
  if p.y + Doc.BottomRange - Doc.TopRange &gt; ScreenHeight then
    p.y = p.y - Doc.BottomRange + Doc.TopRange + Height
  end if
  firstfocused = 0
  i = 0
  while i &lt; Doc.ActiveSheet.UnitCount
    d = Doc.ActiveSheet.Units[i]
    if d.Type = Type then
      if d.Focused then
        firstfocused = 0
        break
      else if firstfocused = 0 then
        firstfocused = d
      end if
    end if
    i = i + 1
  wend
  if firstfocused &lt;&gt; 0 then
    firstfocused.Focused = true
  end if
  Doc.Popup( p.x, p.y )
end if
end function
private function OnMouseExit(Sender)
Focused = false
end function
private function OnResize(Sender)
Height = Rect1.Height
Rect1.SetBounds( Left, Top, Width, Rect1.Height )
Line1.Left = Rect1.Left + Rect1.Width - Line1.Width - 4
Text1.Width = Line1.Left - Text1.Left
end function
property Picture read FPicture write SetPicture editor Picture
private function SetCaption(AValue)
Text1.Text = AValue
if Text1.Left + Text1.Width &gt; Line1.Left then
  n = Text1.Left + Text1.Width - Line1.Left
  Line1.Left = Line1.Left + n
  Rect1.Width = Rect1.Width + n
  Refresh()
end if
end function
private function SetChecked(AValue)
FChecked = AValue
if FChecked then
  Line2.Picture = SystemParams.DefaultPath + &quot;checkbox.bmp&quot;
else
  Line2.Picture = 0
  if VarType( FPicture ) = 1 then
    Line2.Picture = 0
  else
    Line2.Picture = SystemParams.DefaultPath + FPicture
  end if
end if
end function
private function SetEnable(AValue)
if AValue then
  if Focused then
    Text1.FontColor = $8000000E
  else
    Text1.FontColor = $80000007
  end if
  Line2.Alpha = 100
else
  Text1.FontColor = $80000011
  Line2.Alpha = 20
end if
end function
private function SetFocused(AValue)
if AValue then
  Rect1.BackColor = $8000000D
  if Line2.Alpha = 100 then
    Text1.FontColor = $8000000E
  else
    Text1.FontColor = $80000011
  end if
  i = 0
  while i &lt; Parent.UnitCount
    d = Parent.Units[i]
    if LCase( d.Type ) = &quot;menuitem&quot; then
      if d &lt;&gt; this then
        d.Focused = false
        d.HideSubMenu()
      end if
    end if
    i = i + 1
  wend
else
  Rect1.BackColor = $80000004
  if Line2.Alpha = 100 then
    Text1.FontColor = $80000007
  else
    Text1.FontColor = $80000011
  end if
end if
UpdateWindow()
end function
private function SetPicture(AValue)
FPicture = AValue
SetChecked( FChecked )
end function
private function SetSubMenu(AValue)
FSubMenu = AValue
if Doc &lt;&gt; 0 then
  Doc.Free()
  Doc = 0
end if
if IsLoaded() then
  OnLoad( this )
end if
end function
property submenu read FSubMenu write SetSubMenu
</programe>
</sheet>
<sheet name="MainMenuItem" bounds="90,74,232,94" origin="161,84" submenu="&apos;&apos;">
<rect name="rect1" bounds="72,107,126,127" origin="148,123" backcolor="$8000000D" pattern="1"/>
<text name="Text1" bounds="76,109,122,125" origin="76,99.25" backcolor="$8000000F" autosize="true" border="$0" fontname="瀹嬩綋" fontsize="12" fontcolor="$80000012" textalign="4" text="鏂囦欢(F)"/>
<programe>
property Caption read GetCaption write SetCaption
property Enable read GetEnable write SetEnable editor Bool
property Focused read GetFocused write SetFocused editor Bool
private function GetCaption()
return Text1.Text
end function
private function GetEnable()
return Enabled
end function
private function GetFocused()
return Text1.BackColor = $8000000D
end function
private function GetItems()
if Doc &lt;&gt; 0 then
  return Doc.ActiveSheet
else
  return 0
end if
end function
public function HideSubMenu()
if Doc &lt;&gt; 0 then
  Doc.Hide()
  i = 0
  while i &lt; Doc.ActiveSheet.UnitCount
    d = Doc.ActiveSheet.Units[i]
    if UCase( d.Type ) = &quot;MENUITEM&quot; then
      d.HideSubMenu()
    end if
    i = i + 1
  wend
end if
end function
private function Initialize(Sender)
Doc=0
end function
property Items read GetItems
private function OnDestroy(Sender)
if Doc &lt;&gt; 0 then
  Doc.Free()
end if
end function
public function OnKeyDown(Sender,Key)
if Key = 37 then
  i=0
  prior = 0
  last = 0
  t = 0
  while i &lt; Parent.UnitCount
    d = Parent.Units[i]
    if d.Type = Type then
      if d.Enable then
        if d = this then
          prior = t
        else
          t = d
        end if
        last = d
      end if
    end if
    i = i + 1
  wend
  if prior &lt;&gt; 0 then
    prior.Focused = true
  else
    last.Focused = true
  end if
else if Key = 39 then
  i=0
  first = 0
  next = 0
  t = 0
  while i &lt; Parent.UnitCount
    d = Parent.Units[i]
    if d.Type = Type then
      if d.Enable then
        if d = this then
          t = d
        else if t &lt;&gt; 0 then
          next = d
          t = 0
        end if
        if first = 0 then
          first = d
        end if
      end if
    end if
    i = i + 1
  wend
  if next &lt;&gt; 0 then
    next.Focused = true
  else
    first.Focused = true
  end if
else if Key = 40 then
  if Doc &lt;&gt; 0 then
    PopDoc()
  end if
else
  s = &apos;(&apos; + chr( Key ) + &apos;)&apos;
  if At( s, Caption ) &gt; 0 then
    PopDoc()
  end if
end if
end function
private function OnLButtonDown(Sender,X,Y)
Focused = true
PopDoc()
end function
private function OnLoad(Sender)
if Len( SubMenu ) &gt; 0 then
  Doc = Create( Handle, SubMenu, true, false )
  Doc.ActiveSheet.SetPropertyValue( &quot;MainMenu&quot;, Parent )
  OnLoadSubMenu( Sender, Doc.ActiveSheet )
end if
end function
published function OnLoadSubMenu(Sender,ASheet)
end function
private function OnMouseEnter(Sender)
i = 0
while i &lt; Parent.UnitCount
  d = Parent.Units[i]
  if d &lt;&gt; this and d.Type = &quot;MainMenuItem&quot; then
    if d.Shown() then
      Focused = true
      PopDoc()
      return
    end if
  end if
  i = i + 1
wend
Focused = true
end function
private function OnMouseExit(Sender)
Focused = false
end function
private function OnResize(Sender)
Rect1.SetBounds( Left, Top, Width, Height )
Text1.SetBounds( Left + 4, Top + 2, Width - 8, Height - 4 )
end function
public function PopDoc()
if ( Doc &lt;&gt; 0 ) then
  p = Point( Left, Bottom + 1 )
  ViewToClient( p )
  ClientToScreen( p )
  firstfocused = 0
  i = 0
  while i &lt; Doc.ActiveSheet.UnitCount
    d = Doc.ActiveSheet.Units[i]
    if LCase( d.Type ) = &quot;menuitem&quot; then
      if d.Focused then
        firstfocused = 0
        break
      else if firstfocused = 0 then
        firstfocused = d
      end if
    end if
    i = i + 1
  wend
  if firstfocused &lt;&gt; 0 then
    firstfocused.Focused = true
  end if
  n = Doc.Popup( p.x, p.y )
  if n = 1 then
    OnKeyDown( this, 37 )
  else if n = 2 then
    OnKeyDown( this, 39 )
  else
    Focused = false
    if ActiveSheet.HasProperty( &quot;CurSheet&quot; ) then
      if ActiveSheet.CurSheet &lt;&gt; 0 then
        ActiveSheet.CurSheet.Owner.Focused = true
      end if
    end if
  end if
  if n = 1 or n = 2 then
    i = 0
    while i &lt; ActiveSheet.UnitCount
      d = ActiveSheet.Units[i]
      if d.Type = &quot;MainMenuItem&quot; then
        if d.Focused then
          d.PopDoc()
          break
        end if
      end if
      i = i + 1
    wend
  end if
end if
end function
private function SetCaption(AValue)
Text1.Text = AValue
end function
private function SetEnable(AValue)
Enabled = AValue
if AValue then
  Text1.FontColor = $80000012
else
  Text1.FontColor = $80000011
end if
end function
private function SetFocused(AValue)
if AValue then
  rect1.Visible = true
  Text1.BackColor = $8000000D
  Text1.FontColor = $8000000E
  i = 0
  while i &lt; Parent.UnitCount
    d = Parent.Units[i]
    if d.Type = &quot;MainMenuItem&quot; then
      if d &lt;&gt; this then
        d.Focused = false
        d.HideSubMenu()
      end if
    end if
    i = i + 1
  wend
else
  rect1.Visible = false
  Text1.BackColor = $8000000F
  if Enabled then
    Text1.FontColor = $80000012
  else
    Text1.FontColor = $80000011
  end if
end if
UpdateWindow()
end function
public function Shown()
if Doc &lt;&gt; 0 then
  return Doc.IsShown()
end if
return false
end function
</programe>
</sheet>
<sheet name="MenuPanel" bounds="20,26,192,241" origin="109,75">
<rect name="Rect1" bounds="20,26,192,241" origin="108,74" backcolor="$80000004" pattern="1"/>
<line name="Line1" origin="109,75" linecolor="$80000014">
<points>
21,240,6
21,27,2
191,27,2
</points>
</line>
<line name="Line2" origin="109,75" linecolor="$80000010">
<points>
21,240,6
191,240,2
191,27,2
</points>
</line>
<programe>
private function OnResize(Sender)
if Width &lt; 3 then
  Width = 3
end if
if Height &lt; 3 then
  height = 3
end if
Rect1.SetBounds( Left, Top, Width, Height )
Line1.SetBounds( Left + 1, Top + 1, Width - 2, Height - 2 )
Line2.SetBounds( Left + 1, Top + 1, Width - 2, Height - 2 )
end function
</programe>
</sheet>
<sheet name="Separator" bounds="0,0,152,1">
<line name="Line3" origin="78.909091,0.545455" linecolor="$80000010" backcolor="$8000000A">
<points>
0,0,6
152,0,2
</points>
</line>
<line name="Line4" origin="78.909091,1.545455" linecolor="$80000014" backcolor="$8000000A">
<points>
0,1,6
152,1,2
</points>
</line>
</sheet>
</vg>

⌨️ 快捷键说明

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