home *** CD-ROM | disk | FTP | other *** search
/ PC World Komputer 1997 February / PCWK0297.iso / envelop / envelop.6 / Tools / Bootcamp / concepts / hyperctl / hyperctl.eto < prev    next >
Text File  |  1996-07-08  |  9KB  |  282 lines

  1. Type EditCombo From HyperControl
  2.   Dim EditBox As New ComboBox
  3.   Dim BtnDelete As New Button
  4.   Dim BtnOK As New Button
  5.   Property Value Get getValue Set setValue As String
  6.  
  7.   ' METHODS for object: EditCombo
  8.   Function AddItem(ByVal item As String) As Integer
  9.     ' Exposing ComboBox's AddItem method through the hypercontrol
  10.     AddItem = EditBox.AddItem(item)
  11.   End Function
  12.  
  13.   Sub BtnDelete_Click()
  14.     If EditBox.Text = Value Then 
  15.       EditBox.Text = ""
  16.     Else 
  17.       EditBox.Text = Value
  18.     End If
  19.     BtnOK.Enabled = False
  20.   End Sub
  21.  
  22.   Sub BtnOK_Click()
  23.     ' Save this property
  24.     Value = EditBox.Text
  25.     SendEvent Click
  26.   End Sub
  27.  
  28.   Sub Clear()
  29.     ' Expose the ComboBox's Clear method through the hypercontrol
  30.     EditBox.Clear
  31.   End Sub
  32.  
  33.   Sub EditBox_GotFocus()
  34.     BtnOK.Enabled = True
  35.   End Sub
  36.  
  37.   Sub EditBox_KeyUp(keyCode As Integer, ByVal shift As Integer)
  38.     ' If the return key is struck, enter the value
  39.     If keyCode = VK_RETURN && BtnOK.Enabled Then BtnOK_Click
  40.   End Sub
  41.  
  42.   Function getValue() As String
  43.     ' Store the string in the hypercontrol's Caption property
  44.     getValue = Caption
  45.   End Function
  46.  
  47.   Sub Resize()
  48.     BtnDelete.Move(0, 0, BtnDelete.Width, BtnDelete.Height)
  49.     BtnOK.Move(BtnDelete.Width, 0, BtnDelete.Width, BtnDelete.Height)
  50.     EditBox.Move((BtnDelete.Width * 2), 0, ScaleWidth - (2 * BtnDelete.Width), BtnDelete.Height)
  51.     Height = BtnDelete.Height + (Height - ScaleHeight)
  52.   End Sub
  53.  
  54.   Sub SelectEntry
  55.     ' Need to select the contents of the EditBox
  56.     EditBox.SelStart = 0
  57.     EditBox.SelLength = Len(EditBox.Text)
  58.     EditBox.SetFocus
  59.   End Sub
  60.  
  61.   Sub SetFocus()
  62.     EditBox.SetFocus
  63.   End Sub
  64.  
  65.   Sub Setup()
  66.     ' Clear out the value entry and disable the buttons
  67.     Value = ""
  68.   End Sub
  69.  
  70.   Sub setValue(entry As String)
  71.     ' Store the string in the hypercontrol's Caption property
  72.     Caption = entry
  73.     EditBox.Text = entry
  74.     BtnOK.Enabled = True
  75.   End Sub
  76.  
  77. End Type
  78.  
  79. Type EditComboForm From SampleMasterForm
  80.   Dim EditCombo1 As New EditCombo
  81.   Dim LstPropertyEntry As New ListBox
  82.   Dim Frame1 As New Frame
  83.   Dim InstallButton1 As New InstallButton
  84.   Dim LstPropertyNames As New ListBox
  85.   Dim LstFont As New Font
  86.  
  87.   ' METHODS for object: EditComboForm
  88.   Sub EditCombo1_Click()
  89.     Dim index As Integer
  90.     ' Need to update the selected LstPropertyEntry
  91.     index = LstPropertyEntry.ListIndex
  92.     LstPropertyEntry.RemoveItem(index)
  93.     LstPropertyEntry.InsertItem(EditCombo1.Value, index)
  94.     LstPropertyEntry.ListIndex = index
  95.   End Sub
  96.  
  97.   Sub LstPropertyEntry_Click()
  98.     ' Need to select the adjacent property
  99.     LstPropertyNames.ListIndex = LstPropertyEntry.ListIndex
  100.     UpdateEditCombo
  101.   End Sub
  102.  
  103.   Sub LstPropertyEntry_DblClick()
  104.     ' Need to select the adjacent property
  105.     LstPropertyNames.ListIndex = LstPropertyEntry.ListIndex
  106.     UpdateEditCombo
  107.     EditCombo1.SelectEntry
  108.   End Sub
  109.  
  110.   Sub LstPropertyNames_Click()
  111.     ' Need to select the adjacent property
  112.     LstPropertyEntry.ListIndex = LstPropertyNames.ListIndex
  113.     UpdateEditCombo
  114.   End Sub
  115.  
  116.   Sub ResetApplication_Click()
  117.     ' Need to populate the ListBox
  118.     LstPropertyNames.Clear
  119.     LstPropertyEntry.Clear
  120.   
  121.     LstPropertyNames.AddItem "BackColor" : LstPropertyEntry.AddItem "1"
  122.     LstPropertyNames.AddItem "BevelInner" : LstPropertyEntry.AddItem "0 - None"
  123.     LstPropertyNames.AddItem "BevelOuter" : LstPropertyEntry.AddItem "0 - None"
  124.     LstPropertyNames.AddItem "BevelWidth" : LstPropertyEntry.AddItem "2"
  125.     LstPropertyNames.AddItem "BorderStyle" : LstPropertyEntry.AddItem "2 - Sizable"
  126.     LstPropertyNames.AddItem "BorderWidth" : LstPropertyEntry.AddItem "0"
  127.     LstPropertyNames.AddItem "Caption" : LstPropertyEntry.AddItem ""
  128.     LstPropertyNames.AddItem "ClientHWnd" : LstPropertyEntry.AddItem "2294388"
  129.     LstPropertyNames.AddItem "ControlBox" : LstPropertyEntry.AddItem "True"
  130.   
  131.     EditCombo1.Clear
  132.     EditCombo1.SetFocus
  133.   End Sub
  134.  
  135.   Sub UpdateEditCombo
  136.     ' Need to clear the EditCombo Listbox
  137.     EditCombo1.Clear
  138.   
  139.     ' Need to sent the current information to the EditCombo for editing
  140.     ' Depending on which entry is to be edited, we may populate the
  141.     ' combolist with entries
  142.     Select Case LstPropertyEntry.ListIndex
  143.       Case 0
  144.         EditCombo1.Value = LstPropertyEntry.List(0)
  145.       Case 1
  146.         EditCombo1.Value = LstPropertyEntry.List(1)
  147.         EditCombo1.AddItem "0 - None"
  148.         EditCombo1.AddItem "1 - Line"
  149.         EditCombo1.AddItem "2 - Inset"
  150.         EditCombo1.AddItem "3 - Raised"
  151.       Case 2
  152.         EditCombo1.Value = LstPropertyEntry.List(2)
  153.         EditCombo1.AddItem "0 - None"
  154.         EditCombo1.AddItem "1 - Line"
  155.         EditCombo1.AddItem "2 - Inset"
  156.         EditCombo1.AddItem "3 - Raised"
  157.       Case 3
  158.         EditCombo1.Value = LstPropertyEntry.List(3)
  159.       Case 4
  160.         EditCombo1.Value = LstPropertyEntry.List(4)
  161.         EditCombo1.AddItem "0 - None"
  162.         EditCombo1.AddItem "1 - Fixed Single"
  163.         EditCombo1.AddItem "2 - Sizable"
  164.         EditCombo1.AddItem "3 - Fixed Double"
  165.       Case 5
  166.         EditCombo1.Value = LstPropertyEntry.List(5)
  167.       Case 6
  168.         EditCombo1.Value = LstPropertyEntry.List(6)
  169.       Case 7
  170.         EditCombo1.Value = LstPropertyEntry.List(7)
  171.       Case 8
  172.         EditCombo1.Value = LstPropertyEntry.List(8)
  173.         EditCombo1.AddItem "True"
  174.         EditCombo1.AddItem "False"
  175.     End Select
  176.   
  177.   End Sub
  178.  
  179. End Type
  180.  
  181. Begin Code
  182. ' Reconstruction commands for object: EditCombo
  183. '
  184.   With EditCombo
  185.     .Move(4200, 1470, 4755, 780)
  186.     .Value := ""
  187.     With .EditBox
  188.       .ZOrder := 3
  189.       .Move(750, 0, 3885, 360)
  190.       .Ctrl3d := False
  191.       .Sorted := False
  192.     End With  'EditCombo.EditBox
  193.     With .BtnDelete
  194.       .Caption := "X"
  195.       .ZOrder := 2
  196.       .Move(0, 0, 375, 375)
  197.     End With  'EditCombo.BtnDelete
  198.     With .BtnOK
  199.       .Caption := "ok"
  200.       .ZOrder := 1
  201.       .Move(375, 0, 375, 375)
  202.     End With  'EditCombo.BtnOK
  203.   End With  'EditCombo
  204. ' Reconstruction commands for object: EditComboForm
  205. '
  206.   With EditComboForm
  207.     .Caption := "HyperControl Sample"
  208.     .DragMode := "MiddleMouse"
  209.     .Move(3525, 2385, 5655, 4260)
  210.     .SampleDir := "C:\envelop\bootcamp\concepts\hyperctl\"
  211.     .SampleName := "hyperctl"
  212.     With .EditCombo1
  213.       .Caption := "2294388"
  214.       .ZOrder := 4
  215.       .Move(300, 450, 3750, 375)
  216.       .BorderStyle := "None"
  217.       .MaxButton := False
  218.       .ControlBox := False
  219.       .Parent := EditComboForm
  220.       .Value := "2294388"
  221.       With .EditBox
  222.         .Move(750, 0, 3000, 360)
  223.       End With  'EditComboForm.EditCombo1.EditBox
  224.       With .BtnDelete
  225.         .Move(0, 0, 375, 375)
  226.       End With  'EditComboForm.EditCombo1.BtnDelete
  227.       With .BtnOK
  228.         .Move(375, 0, 375, 375)
  229.       End With  'EditComboForm.EditCombo1.BtnOK
  230.     End With  'EditComboForm.EditCombo1
  231.     With .LstPropertyEntry
  232.       .BackColor := 12632256
  233.       .Font := EditComboForm.LstFont
  234.       .ZOrder := 3
  235.       .Move(2385, 1050, 1245, 1920)
  236.       .Ctrl3d := False
  237.       .Sorted := False
  238.     End With  'EditComboForm.LstPropertyEntry
  239.     With .Frame1
  240.       .ZOrder := 5
  241.       .Move(150, 150, 4350, 3150)
  242.     End With  'EditComboForm.Frame1
  243.     With .InstallButton1
  244.       .Caption := "InstallButton1"
  245.       .ZOrder := 2
  246.       .Move(4800, 300, 450, 450)
  247.       .Outlined := True
  248.       .Picture := EditComboForm.InstallButton1.installBitmap
  249.       .installObject := EditCombo
  250.       With .BmpOpen
  251.       End With  'EditComboForm.InstallButton1.BmpOpen
  252.       With .installBitmap
  253.         .FileName := "hyperctl.ero"
  254.         .ResId := 0
  255.       End With  'EditComboForm.InstallButton1.installBitmap
  256.       With .DefaultBitmap
  257.         .FileName := "hyperctl.ero"
  258.         .ResId := 1780
  259.       End With  'EditComboForm.InstallButton1.DefaultBitmap
  260.     End With  'EditComboForm.InstallButton1
  261.     With .LstPropertyNames
  262.       .Caption := "LstPropertyNames"
  263.       .BackColor := 12632256
  264.       .Font := EditComboForm.LstFont
  265.       .ZOrder := 1
  266.       .Move(1050, 1050, 1350, 1920)
  267.       .Ctrl3d := False
  268.       .Sorted := False
  269.     End With  'EditComboForm.LstPropertyNames
  270.     With .LstFont
  271.       .FaceName := "Arial"
  272.       .Size := 8.000000
  273.       .Bold := False
  274.       .Italic := False
  275.       .Strikethru := False
  276.     End With  'EditComboForm.LstFont
  277.     With .helpfile
  278.       .FileName := "C:\envelop\bootcamp\concepts\hyperctl\hyperctl.hlp"
  279.     End With  'EditComboForm.helpfile
  280.   End With  'EditComboForm
  281. End Code
  282.