home *** CD-ROM | disk | FTP | other *** search
/ The Best of Select: Windows 95 Special 2 / WIN95_2.bin / utils / envelop / envelop.6 / Tools / Bootcamp / basic / tabstrip / tabstrip.eto < prev    next >
Encoding:
Text File  |  1996-07-08  |  11.1 KB  |  378 lines

  1. Type BMPOptButton From Bitmap
  2. End Type
  3.  
  4. Type BMPCmdButton From Bitmap
  5. End Type
  6.  
  7. Type TabStripSample From Application
  8.   Dim AccessControl As New ACL
  9. End Type
  10.  
  11. Type BMPChkBox From Bitmap
  12. End Type
  13.  
  14. Type TabStripForm From SampleMasterForm
  15.   Type TabStrip1 From TabStrip
  16.     Dim AutoTab1 As New TabStripTab
  17.     Dim AutoTab2 As New TabStripTab
  18.     Type AutoTab3 From TabStripTab
  19.  
  20.       ' METHODS for object: TabStripForm.TabStrip1.AutoTab3
  21.       Sub BeforeClick(cancel As Integer)
  22.         cancel = TabForm.OBLockDown.Value
  23.       End Sub
  24.  
  25.     End Type
  26.     Type Img1 From ImageList
  27.  
  28.       ' METHODS for object: TabStripForm.TabStrip1.Img1
  29.       Sub Clear
  30.         While Count > 0
  31.           RemoveImage(0)
  32.         Wend
  33.       End Sub
  34.  
  35.     End Type
  36.   End Type
  37.   Type SubForm1 From Form
  38.     Dim Button1 As New Button
  39.     Dim Button2 As New Button
  40.     Dim Button3 As New Button
  41.     Dim Button4 As New Button
  42.     Dim Button5 As New Button
  43.     Dim Button6 As New Button
  44.     Dim Button7 As New Button
  45.     Dim Button8 As New Button
  46.  
  47.     ' METHODS for object: TabStripForm.SubForm1
  48.     Sub Resize()
  49.       Dim x, y as single
  50.       Dim XStep, YStep as single
  51.     
  52.       XStep = ScaleWidth / 2
  53.       YStep = ScaleHeight / 4
  54.       Button1.Move(0 * XStep + 150, 0 * YStep + 150, XStep - 300, YStep - 300)
  55.       Button2.Move(0 * XStep + 150, 1 * YStep + 150, XStep - 300, YStep - 300)
  56.       Button3.Move(0 * XStep + 150, 2 * YStep + 150, XStep - 300, YStep - 300)
  57.       Button4.Move(0 * XStep + 150, 3 * YStep + 150, XStep - 300, YStep - 300)
  58.       Button5.Move(1 * XStep + 150, 0 * YStep + 150, XStep - 300, YStep - 300)
  59.       Button6.Move(1 * XStep + 150, 1 * YStep + 150, XStep - 300, YStep - 300)
  60.       Button7.Move(1 * XStep + 150, 2 * YStep + 150, XStep - 300, YStep - 300)
  61.       Button8.Move(1 * XStep + 150, 3 * YStep + 150, XStep - 300, YStep - 300)
  62.     End Sub
  63.  
  64.   End Type
  65.   Type SubForm2 From Form
  66.     Dim CHKRed As New CheckBox
  67.     Dim CHKBlue As New CheckBox
  68.     Dim CHKGreen As New CheckBox
  69.     Dim LBLCBox As New Label
  70.  
  71.     ' METHODS for object: TabStripForm.SubForm2
  72.     Sub CHKBlue_Click()
  73.       SetLabelColor
  74.     End Sub
  75.  
  76.     Sub CHKGreen_Click()
  77.       SetLabelColor
  78.     End Sub
  79.  
  80.     Sub CHKRed_Click()
  81.       SetLabelColor
  82.     End Sub
  83.  
  84.     Sub Resize()
  85.       Dim x, y as single
  86.       Dim XStep, YStep as single
  87.     
  88.       XStep = ScaleWidth / 3
  89.       YStep = ScaleHeight / 3
  90.       CHKRed.Move(0 * XStep + 150, 0 * YStep + 150, XStep - 300, YStep - 300)
  91.       CHKGreen.Move(0 * XStep + 150, 1 * YStep + 150, XStep - 300, YStep - 300)
  92.       CHKBlue.Move(0 * XStep + 150, 2 * YStep + 150, XStep - 300, YStep - 300)
  93.       LBLCBox.Move(1 * XStep + 150, 0 * YStep + 150, 2 * XStep - 300, 3 * YStep - 300)
  94.     End Sub
  95.  
  96.     Sub SetLabelColor()
  97.       LBLCBox.BackColor = RGB(255 * CHKRed.Value, 255 * CHKGreen.Value, 255 * CHKBlue.Value)
  98.     End Sub
  99.  
  100.   End Type
  101.   Type SubForm3 From Form
  102.     Dim OBLockDown As New OptionButton
  103.     Dim OBFreedom As New OptionButton
  104.  
  105.     ' METHODS for object: TabStripForm.SubForm3
  106.     Sub Resize()
  107.       Dim x,yx as Single
  108.       x = ScaleHeight / 2
  109.       yx = ScaleWidth / 2
  110.       OBLockDown.Move(yx / 4, 0, yx * 2, x)
  111.       OBFreedom.Move(yx / 4, x, yx * 2, x)
  112.     End Sub
  113.  
  114.   End Type
  115.   Dim CHKMultiRow As New CheckBox
  116.   Dim CHKStyle As New CheckBox
  117.   Dim CHKFixed As New CheckBox
  118.   Dim CHKIcons As New CheckBox
  119.  
  120.   ' METHODS for object: TabStripForm
  121.   Sub CHKFixed_Click()
  122.     TabStrip1.TabWidthStyle = IIf(CHKFixed.Value = "Checked", "Fixed", "Justified")
  123.     TabStrip1.Resize
  124.   End Sub
  125.  
  126.   Sub CHKIcons_Click()
  127.     TabStrip1.ImageListRef = IIf(CHKIcons.Value = "Checked", TabStripForm.TabStrip1.Img1, Nothing)
  128.     TabStrip1.Resize
  129.   End Sub
  130.  
  131.   Sub CHKMultiRow_Click()
  132.     Static Warned As Boolean
  133.     If Not Warned Then 
  134.       Dim MBX As New MessageBox
  135.       MBX.Message("Multi-Row Demo", "Multi-Row has no effect if the TabStrip is wide enough to handle all the tabs. To demonstrate Multi-Row the TabStrip's Width will halve")
  136.       Warned = True
  137.     End If
  138.     With TabStrip1
  139.       .MultiRow = IIf(CHKMultiRow.Value = "Checked", True, False)
  140.       .Width = IIf(.MultiRow, .Width / 2, .Width * 2)
  141.     End With
  142.   End Sub
  143.  
  144.   Sub CHKStyle_Click()
  145.     TabStrip1.Style = IIf(CHKStyle.Value = "Checked", "Tabs", "Buttons")
  146.     TabStrip1.Resize
  147.   End Sub
  148.  
  149.   Sub Load()
  150.     ReconstructImageList
  151.   End Sub
  152.  
  153.   Sub ReconstructImageList
  154.     With TabStripForm.TabStrip1.Img1
  155.       .Clear
  156.       .AddBitmapScaled(BMPOptButton)
  157.       .AddBitmapScaled(BMPCmdButton)
  158.       .AddBitmapScaled(BMPChkBox)
  159.     End With
  160.     TabStripForm.TabStrip1.ImageListRef = TabStripForm.TabStrip1.Img1
  161.   End Sub
  162.  
  163.   Sub ResetApplication_Click()
  164.     CHKMultiRow.Value = 0
  165.     CHKStyle.Value = 1
  166.     CHKFixed.Value = 0
  167.     CHKIcons.Value = 1
  168.     TabStrip1.TabFixedWidth = 2500
  169.     TabStrip1.TabFixedWidth = 3000
  170.   End Sub
  171.  
  172. End Type
  173.  
  174. Begin Code
  175. ' Reconstruction commands for object: BMPOptButton
  176. '
  177.   With BMPOptButton
  178.     .LoadType := "MemoryBased"
  179.     .FileName := "TabStrip.ero"
  180.     .ResId := 0
  181.   End With  'BMPOptButton
  182. ' Reconstruction commands for object: BMPCmdButton
  183. '
  184.   With BMPCmdButton
  185.     .LoadType := "MemoryBased"
  186.     .FileName := "TabStrip.ero"
  187.     .ResId := 404
  188.   End With  'BMPCmdButton
  189. ' Reconstruction commands for object: TabStripSample
  190. '
  191.   With TabStripSample
  192.     .ModulePath := "envelop.ebo;base.ebo;win32.ebo;dialogs.ebo;tools.ebo;TabStrip.eto"
  193.     .ProjectFileName := "C:\Current\TabStrip\TabStrip.epj"
  194.     .MainForm := TabStripForm
  195.     .Path := "C:\Current\TabStrip\"
  196.     .EXEName := "TabStrip"
  197.     With .AccessControl
  198.       .ObjectAccess := "R,W,C,M,P"
  199.     End With  'TabStripSample.AccessControl
  200.   End With  'TabStripSample
  201. ' Reconstruction commands for object: BMPChkBox
  202. '
  203.   With BMPChkBox
  204.     .LoadType := "MemoryBased"
  205.     .FileName := "TabStrip.ero"
  206.     .ResId := 808
  207.   End With  'BMPChkBox
  208. ' Reconstruction commands for object: TabStripForm
  209. '
  210.   With TabStripForm
  211.     .Caption := "Tab Strip"
  212.     .Move(3345, 960, 9525, 6345)
  213.     .BorderStyle := "Fixed Double"
  214.     .MaxButton := False
  215.     .MinButton := False
  216.     .SampleDir := "C:\Current\TabStrip\"
  217.     .SampleName := "TabStrip"
  218.     With .TabStrip1
  219.       .Caption := "TabStrip1"
  220.       .ZOrder := 8
  221.       .Move(150, 150, 9150, 4800)
  222.       .ImageListRef := TabStripForm.TabStrip1.Img1
  223.       .SelectedItem := TabStripForm.TabStrip1.AutoTab1
  224.       .TabFixedWidth := 3000
  225.       With .AutoTab1
  226.         .Caption := "Command Buttons"
  227.         .Icon := 1
  228.         .TabForm := TabStripForm.SubForm1
  229.       End With  'TabStripForm.TabStrip1.AutoTab1
  230.       With .AutoTab2
  231.         .Caption := "Check Boxes"
  232.         .Icon := 2
  233.         .TabForm := TabStripForm.SubForm2
  234.       End With  'TabStripForm.TabStrip1.AutoTab2
  235.       With .AutoTab3
  236.         .Caption := "Option Buttons"
  237.         .TabForm := TabStripForm.SubForm3
  238.       End With  'TabStripForm.TabStrip1.AutoTab3
  239.       With .Img1
  240.         .ImageWidth := 24
  241.         .ImageHeight := 24
  242.       End With  'TabStripForm.TabStrip1.Img1
  243.     End With  'TabStripForm.TabStrip1
  244.     With .SubForm1
  245.       .ZOrder := 1
  246.       .Move(210, 615, 9030, 4275)
  247.       .BevelInner := "Raised"
  248.       .BevelOuter := "Raised"
  249.       .BevelWidth := 1
  250.       .BorderStyle := "None"
  251.       .MaxButton := False
  252.       .ControlBox := False
  253.       .Parent := TabStripForm
  254.       .Visible := True
  255.       With .Button1
  256.         .Caption := "Button1"
  257.         .ZOrder := 8
  258.         .Move(150, 150, 4215, 768)
  259.       End With  'TabStripForm.SubForm1.Button1
  260.       With .Button2
  261.         .Caption := "Button2"
  262.         .ZOrder := 7
  263.         .Move(150, 1218, 4215, 768)
  264.       End With  'TabStripForm.SubForm1.Button2
  265.       With .Button3
  266.         .Caption := "Button3"
  267.         .ZOrder := 6
  268.         .Move(150, 2287, 4215, 768)
  269.       End With  'TabStripForm.SubForm1.Button3
  270.       With .Button4
  271.         .Caption := "Button4"
  272.         .ZOrder := 5
  273.         .Move(150, 3356, 4215, 768)
  274.       End With  'TabStripForm.SubForm1.Button4
  275.       With .Button5
  276.         .Caption := "Button5"
  277.         .ZOrder := 1
  278.         .Move(4665, 150, 4215, 768)
  279.       End With  'TabStripForm.SubForm1.Button5
  280.       With .Button6
  281.         .Caption := "Button6"
  282.         .ZOrder := 2
  283.         .Move(4665, 1218, 4215, 768)
  284.       End With  'TabStripForm.SubForm1.Button6
  285.       With .Button7
  286.         .Caption := "Button7"
  287.         .ZOrder := 3
  288.         .Move(4665, 2287, 4215, 768)
  289.       End With  'TabStripForm.SubForm1.Button7
  290.       With .Button8
  291.         .Caption := "Button8"
  292.         .ZOrder := 4
  293.         .Move(4665, 3356, 4215, 768)
  294.       End With  'TabStripForm.SubForm1.Button8
  295.     End With  'TabStripForm.SubForm1
  296.     With .SubForm2
  297.       .ZOrder := 3
  298.       .Move(210, 615, 9030, 4275)
  299.       .BevelInner := "Raised"
  300.       .BevelOuter := "Inset"
  301.       .BorderStyle := "None"
  302.       .MaxButton := False
  303.       .ControlBox := False
  304.       .Parent := TabStripForm
  305.       .Visible := True
  306.       With .CHKRed
  307.         .Caption := "Red"
  308.         .ForeColor := 255
  309.         .ZOrder := 4
  310.         .Move(150, 150, 2710, 1125)
  311.       End With  'TabStripForm.SubForm2.CHKRed
  312.       With .CHKBlue
  313.         .Caption := "Blue"
  314.         .ForeColor := 16711680
  315.         .ZOrder := 3
  316.         .Move(150, 3000, 2710, 1125)
  317.       End With  'TabStripForm.SubForm2.CHKBlue
  318.       With .CHKGreen
  319.         .Caption := "Green"
  320.         .ForeColor := 65280
  321.         .ZOrder := 2
  322.         .Move(150, 1575, 2710, 1125)
  323.       End With  'TabStripForm.SubForm2.CHKGreen
  324.       With .LBLCBox
  325.         .BackColor := 0
  326.         .ForeColor := 0
  327.         .ZOrder := 1
  328.         .Move(3160, 150, 5720, 3975)
  329.       End With  'TabStripForm.SubForm2.LBLCBox
  330.     End With  'TabStripForm.SubForm2
  331.     With .SubForm3
  332.       .ZOrder := 2
  333.       .Move(210, 615, 9030, 4275)
  334.       .BorderStyle := "None"
  335.       .MaxButton := False
  336.       .ControlBox := False
  337.       .Parent := TabStripForm
  338.       .Visible := True
  339.       With .OBLockDown
  340.         .Caption := "Don't let me leave this tab"
  341.         .ZOrder := 2
  342.         .Move(2257, 0, 4515, 2137)
  343.       End With  'TabStripForm.SubForm3.OBLockDown
  344.       With .OBFreedom
  345.         .Caption := "I'm tired of this tab, let me go."
  346.         .ZOrder := 1
  347.         .Move(2257, 2137, 4515, 2137)
  348.         .TabStop := True
  349.       End With  'TabStripForm.SubForm3.OBFreedom
  350.     End With  'TabStripForm.SubForm3
  351.     With .CHKMultiRow
  352.       .Caption := "Multi Row"
  353.       .ZOrder := 7
  354.       .Move(7020, 5100, 2265, 450)
  355.     End With  'TabStripForm.CHKMultiRow
  356.     With .CHKStyle
  357.       .Caption := "Style: Tabs"
  358.       .ZOrder := 6
  359.       .Move(4725, 5100, 2265, 450)
  360.       .Value := "Checked"
  361.     End With  'TabStripForm.CHKStyle
  362.     With .CHKFixed
  363.       .Caption := "Fixed Width"
  364.       .ZOrder := 5
  365.       .Move(2430, 5100, 2265, 450)
  366.     End With  'TabStripForm.CHKFixed
  367.     With .CHKIcons
  368.       .Caption := "Display Icons"
  369.       .ZOrder := 4
  370.       .Move(150, 5100, 2265, 450)
  371.       .Value := "Checked"
  372.     End With  'TabStripForm.CHKIcons
  373.     With .helpfile
  374.       .FileName := "C:\Current\TabStrip\TabStrip.hlp"
  375.     End With  'TabStripForm.helpfile
  376.   End With  'TabStripForm
  377. End Code
  378.