SftTree/DLL 7.5 - Tree Control
SftBox/OCX 5.0 - Combo Box Control
SftButton/OCX 3.0 - Button Control
SftMask/OCX 7.0 - Masked Edit Control
SftTabs/OCX 6.5 - Tab Control (VB6 only)
SftTree/OCX 7.5 - Tree Control
SftTree/DLL 7.5 - Tree Control
SftBox/OCX 5.0 - Combo Box Control
SftButton/OCX 3.0 - Button Control
SftMask/OCX 7.0 - Masked Edit Control
SftTabs/OCX 6.5 - Tab Control (VB6 only)
SftTree/OCX 7.5 - Tree Control
SftTree/NET 2.0 - Tree Control
This sample illustrates cell editing using edit controls and combo boxes, cell navigation, uneditable cells, checkbox cell image.
The source code is located at C:\Program Files (x86)\Softelvdm\SftTree OCX 8.0\Samples\VB6\CellEditing\Form1.frm or C:\Program Files\Softelvdm\SftTree OCX 8.0\Samples\VB6\CellEditing\Form1.frm (on 32-bit Windows versions).
VERSION 5.00
Object = "{04048830-2BE4-4868-8CDC-B8E6FC7815C5}#7.5#0"; "SftTree_IX86_U_80.ocx"
Begin VB.Form Form1
BorderStyle = 3 'Fixed Dialog
Caption = "Softel vdm, Inc. - CellEditing Sample"
ClientHeight = 8880
ClientLeft = 45
ClientTop = 435
ClientWidth = 8865
BeginProperty Font
Name = "Microsoft Sans Serif"
Size = 8.25
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 8880
ScaleWidth = 8865
StartUpPosition = 3 'Windows Default
Begin SftTreeLib80.SftTree SftTree1
Height = 8295
Left = 120
TabIndex = 0
Top = 480
Width = 7335
PropVer = 75
xcx = 12938
xcy = 14631
PropFile = ""
PropDesignTime = 1
DeletePropFile = 0
IntVal = 55
xBfStyle1 = 64051980
xBfStyle2 = 1488891551
xBfStyle3 = 1441616787
xBfStyle4 = -1441616787
FlatProperties = 0
Appearance = 1
AutoRespond = -842150451
BackgroundStyle = 2
BackgroundX = 0
BackgroundY = 0
BorderStyle = 0
ButtonStyle = 2
CellEventHandling= 0
CellEditStyle = 0
CellEditLimit = 0
ColumnCount = 3
CopyItemDataString= 1
CustomCode = 0
DragImage = -842150451
DragMethod = 1
DragType = 3
Enabled = 1
HandleReturn = -842150451
MousePointer = 0
LeftButtonOnly = 1
LeftItemClickOnly= 1
OLEDropMode = 0
RightToLeft = 0
UseThemes = -1 'True
Scrollbars = 3
ScrollbarStyle = 0
ShowTruncated = 1
VAlignStyle = 0
VirtualMode = 0
WebLicense = ""
SmoothScroll = 1
ButtonAppearance= 8
MouseOverTransitionEffect= 0
EdgeVerticalColor= -1
EdgeHorizontalColor= -1
BeginProperty ItemEditFont {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "MS Sans Serif"
Size = 8.25
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
BeginProperty Columns {9EBAA93E-293D-44FA-9989-08F078763A1F}
InheritBgColor = 1
OpenEnded = 1
OpenEnded2 = 1
EndProperty
BeginProperty Headers {9EBAA936-293D-44FA-9989-08F078763A1F}
Appearance = 1
BackColor = -2147483633
ForeColor = -2147483630
GrayedColor = -2147483631
HilightColor = -2147483628
Multiline = 1
ShadowColor = -2147483632
Reorderable = 1
Resizable = 1
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "Microsoft Sans Serif"
Size = 8.25
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
SortIndicators = 0
EndProperty
BeginProperty Footers {9EBAA956-293D-44FA-9989-08F078763A1F}
Appearance = 0
BackColor = -2147483633
ForeColor = -2147483630
GrayedColor = -2147483631
HilightColor = -2147483628
Multiline = 1
ShadowColor = -2147483632
Reorderable = 1
Resizable = 1
EndProperty
BeginProperty Items {9EBAA93C-293D-44FA-9989-08F078763A1F}
AutoExpandDragDrop= 1
AutoExpandHover = 0
BackColor = -2147483643
BackColorOdd = -2147483643
CalcLimit = 0
CalcVisibleOnly = 0
Cell3D = 0
CharSearchColumn= -1
CharSearchMode = 1
DropHighlightColor= -2147483635
DropHighlightStyle= 1
EditNoFocusStyle= 2
FlybyHighlight = 1
ForeColor = -2147483640
ForeColorOdd = -2147483640
GrayedColor = -2147483631
GridHorizontalColor= -2147483632
GridStyle = 6
GridVerticalColor= -2147483632
HilightColor = -2147483628
HorizontalExtentPix= 0
HorizontalExtent2Pix= 0
HorizontalOffsetPix= 0
HorizontalOffset2Pix= 0
Indentation = -1
ItemImageAlign = 1
Lines = 1
MaxHeightPix = 0
MinHeightPix = 0
MultiSelect = 0
NoFocusStyle = 0
NoSelection = 0
RubberbandSelection= 1
SelectBackColor = -2147483635
SelectBackColorNoFocus= -2147483633
SelectForeColor = -2147483634
SelectForeColorNoFocus= -2147483630
ShadowColor = -2147483632
Style = 0
ScrollTips = 1
SelectionArea = 1
SelectStyle = 2
ShowFocusRectangle= 1
ToolTipAlways = 0
ToolTipBackColor= -1
ToolTipForeColor= -1
ToolTipsUseEntireCell= 0
TopIndex = 0
TreeLineColor = -2147483631
TreeLineGrayedColor= -2147483631
TreeLineStyle = 3
UpdateCurrentExpandCollapse= 0
OutlineStyle = 1
SelectOutlineBorderColor= -1
SelectInnerBorderColor= -1
SelectInnerFill1= -1
SelectInnerFill2= -1
SelectHotOutlineBorderColor= -1
SelectHotInnerBorderColor= -1
SelectHotInnerFill1= -1
SelectHotInnerFill2= -1
SelectNoFocusOutlineBorderColor= -1
SelectNoFocusInnerBorderColor= -1
SelectNoFocusInnerFill1= -1
SelectNoFocusInnerFill2= -1
HotOutlineBorderColor= -1
HotInnerBorderColor= -1
HotInnerFill1 = -1
HotInnerFill2 = -1
DropTargetOutlineBorderColor= -1
DropTargetInnerBorderColor= -1
DropTargetInnerFill1= -1
DropTargetInnerFill2= -1
DisabledItemsSelectable= 1
AutoExpandDragDropInterval= 1200
AutoExpandHoverInterval= 1200
ToolTipIntervalOn= 200
ToolTipIntervalOff= 100
BeginProperty ItemImageExpandable {980702E2-0AB6-41B1-9B85-F8755A697255}
Object.Height = 0
Object.Width = 0
Picture = "Form1.frx":0000
Appearance = -1
FrameColor = -1
SampleColor = -1
EndProperty
BeginProperty ItemImageExpanded {980702E2-0AB6-41B1-9B85-F8755A697255}
Object.Height = 0
Object.Width = 0
Picture = "Form1.frx":0552
Appearance = -1
FrameColor = -1
SampleColor = -1
EndProperty
BeginProperty ItemImageLeaf {980702E2-0AB6-41B1-9B85-F8755A697255}
Object.Height = 0
Object.Width = 0
Picture = "Form1.frx":0AA4
Appearance = -1
FrameColor = -1
SampleColor = -1
EndProperty
EndProperty
BeginProperty RowColumnHeader {9EBAA942-293D-44FA-9989-08F078763A1F}
Appearance = 1
ButtonDown = 0
RemainUp = 1
Enabled = 1
ImageHAlign = 0
ImageVAlign = 0
TextHAlign = 0
TextVAlign = 0
Text = ""
ForeColor = -2147483630
BackColor = -2147483633
HilightColor = -2147483628
ShadowColor = -2147483632
GrayedColor = -2147483631
BeginProperty Image {980702E2-0AB6-41B1-9B85-F8755A697255}
Object.Height = 0
Object.Width = 0
Picture = "Form1.frx":0FF6
Appearance = -1
FrameColor = -1
SampleColor = -1
EndProperty
OverrideTheme = 0
EndProperty
BeginProperty RowColumnFooter {9EBAA95A-293D-44FA-9989-08F078763A1F}
Appearance = 1
ButtonDown = 0
RemainUp = 1
Enabled = 1
ImageHAlign = 0
ImageVAlign = 0
TextHAlign = 0
TextVAlign = 0
Text = ""
ForeColor = -2147483630
BackColor = -2147483633
HilightColor = -2147483628
ShadowColor = -2147483632
GrayedColor = -2147483631
OverrideTheme = 0
EndProperty
BeginProperty RowHeaders {9EBAA944-293D-44FA-9989-08F078763A1F}
Appearance = 3
RemainUp = 1
Enabled = 1
Lines = 1
TextHAlign = 0
TextVAlign = 0
Object.Width = 40
BackColor = -2147483633
ForeColor = -2147483630
GrayedColor = -2147483631
HilightColor = -2147483628
ShadowColor = -2147483632
SelectBackColor = -2147483633
SelectForeColor = -2147483630
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "Microsoft Sans Serif"
Size = 8.25
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
EndProperty
BeginProperty Splitter {9EBAA94A-293D-44FA-9989-08F078763A1F}
SplitColumn = 0
Object.Visible = 0
OffsetPix = 0
WidthPix = 7
EndProperty
BeginProperty Column(0) {9EBAA938-293D-44FA-9989-08F078763A1F}
BackColor = -1
CellHAlign = 0
CellMultiline = 0
CellVAlign = 0
CellWordWrap = 0
ForeColor = -1
Merge = 0
MergeInto = 0
MinWidth = 0
SelectBackColor = -1
SelectForeColor = -1
ToolTip = 1
Object.Width = 100
RealPos = 0
DispPos = 0
BackColorEnd = -1
SelectBackColorEnd= -1
ProgressColor = -1
ProgressColorEnd= -1
BackColorOrientation= 0
ProgressColor = -1
ProgressColorEnd= -1
ProgressColorOrientation= 0
ProgressStyle = 0
EndProperty
BeginProperty Header(0) {9EBAA93A-293D-44FA-9989-08F078763A1F}
Enabled = 1
KeepPosition = 0
Locked = 0
ImageHAlign = 0
ImageVAlign = 0
RemainUp = 1
Text = "First Column"
TextHAlign = 0
TextVAlign = 0
BackColor = -1
ForeColor = -1
SelectBackColor = -1
SelectForeColor = -1
BackColorDisabled= -1
ForeColorDisabled= -1
OverrideTheme = 0
Button = 0
EndProperty
BeginProperty Footer(0) {9EBAA958-293D-44FA-9989-08F078763A1F}
Enabled = 1
KeepPosition = 0
ImageHAlign = 0
ImageVAlign = 0
RemainUp = 0
Text = ""
TextHAlign = 0
TextVAlign = 0
BackColor = -1
ForeColor = -1
SelectBackColor = -1
SelectForeColor = -1
BackColorDisabled= -1
ForeColorDisabled= -1
OverrideTheme = 0
Button = 0
EndProperty
BeginProperty Column(1) {9EBAA938-293D-44FA-9989-08F078763A1F}
BackColor = -1
CellHAlign = 0
CellMultiline = 0
CellVAlign = 0
CellWordWrap = 0
ForeColor = -1
Merge = 0
MergeInto = 0
MinWidth = 0
SelectBackColor = -1
SelectForeColor = -1
ToolTip = 1
Object.Width = 100
RealPos = 1
DispPos = 1
BackColorEnd = -1
SelectBackColorEnd= -1
ProgressColor = -1
ProgressColorEnd= -1
BackColorOrientation= 0
ProgressColor = -1
ProgressColorEnd= -1
ProgressColorOrientation= 0
ProgressStyle = 0
EndProperty
BeginProperty Header(1) {9EBAA93A-293D-44FA-9989-08F078763A1F}
Enabled = 1
KeepPosition = 0
Locked = 0
ImageHAlign = 0
ImageVAlign = 0
RemainUp = 1
Text = "Second Column"
TextHAlign = 0
TextVAlign = 0
BackColor = -1
ForeColor = -1
SelectBackColor = -1
SelectForeColor = -1
BackColorDisabled= -1
ForeColorDisabled= -1
OverrideTheme = 0
Button = 0
EndProperty
BeginProperty Footer(1) {9EBAA958-293D-44FA-9989-08F078763A1F}
Enabled = 1
KeepPosition = 0
ImageHAlign = 0
ImageVAlign = 0
RemainUp = 0
Text = ""
TextHAlign = 0
TextVAlign = 0
BackColor = -1
ForeColor = -1
SelectBackColor = -1
SelectForeColor = -1
BackColorDisabled= -1
ForeColorDisabled= -1
OverrideTheme = 0
Button = 0
EndProperty
BeginProperty Column(2) {9EBAA938-293D-44FA-9989-08F078763A1F}
BackColor = -1
CellHAlign = 0
CellMultiline = 0
CellVAlign = 0
CellWordWrap = 0
ForeColor = -1
Merge = 0
MergeInto = 0
MinWidth = 0
SelectBackColor = -1
SelectForeColor = -1
ToolTip = 1
Object.Width = 100
RealPos = 2
DispPos = 2
BackColorEnd = -1
SelectBackColorEnd= -1
ProgressColor = -1
ProgressColorEnd= -1
BackColorOrientation= 0
ProgressColor = -1
ProgressColorEnd= -1
ProgressColorOrientation= 0
ProgressStyle = 0
EndProperty
BeginProperty Header(2) {9EBAA93A-293D-44FA-9989-08F078763A1F}
Enabled = 1
KeepPosition = 0
Locked = 0
ImageHAlign = 0
ImageVAlign = 0
RemainUp = 1
Text = "Third Column"
TextHAlign = 0
TextVAlign = 0
BackColor = -1
ForeColor = -1
SelectBackColor = -1
SelectForeColor = -1
BackColorDisabled= -1
ForeColorDisabled= -1
OverrideTheme = 0
Button = 0
EndProperty
BeginProperty Footer(2) {9EBAA958-293D-44FA-9989-08F078763A1F}
Enabled = 1
KeepPosition = 0
ImageHAlign = 0
ImageVAlign = 0
RemainUp = 0
Text = ""
TextHAlign = 0
TextVAlign = 0
BackColor = -1
ForeColor = -1
SelectBackColor = -1
SelectForeColor = -1
BackColorDisabled= -1
ForeColorDisabled= -1
OverrideTheme = 0
Button = 0
EndProperty
SavedItemCount = 0
SavedColumnCount= 3
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "Microsoft Sans Serif"
Size = 8.25
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
End
Begin VB.ComboBox Combo1
Appearance = 0 'Flat
Height = 315
Left = 7560
TabIndex = 4
Text = "Combo1"
Top = 2160
Visible = 0 'False
Width = 1215
End
Begin VB.TextBox Text1
Height = 285
Left = 7560
TabIndex = 3
Text = "Text1"
Top = 1680
Visible = 0 'False
Width = 1215
End
Begin VB.CommandButton Command1
Cancel = -1 'True
Caption = "Close"
Height = 375
Left = 7560
TabIndex = 1
Top = 120
Width = 1215
End
Begin VB.Label Label5
Caption = "Click on the SftTree/OCX control and hit F1 to access online help for SftTree/OCX 8.0"
BeginProperty Font
Name = "Microsoft Sans Serif"
Size = 8.25
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 3015
Left = 7560
TabIndex = 5
Top = 2880
Visible = 0 'False
Width = 1215
End
Begin VB.Label Label1
Caption = "Simple Cell Editing Sample with edit controls and combo boxes."
Height = 375
Left = 120
TabIndex = 2
Top = 120
Width = 7335
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Private Const CB_SHOWDROPDOWN = &H14F
Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
Private Sub Command1_Click()
End
End Sub
Private Sub Form_Load()
Dim ItemIndex As Integer
ItemIndex = SftTree1.Items.Add("Click on a cell to edit")
SftTree1.Cell(ItemIndex, 1).Text = "Use Tab/Return keys"
SftTree1.Cell(ItemIndex, 2).Text = "Use arrow keys"
ItemIndex = SftTree1.Items.Add("This sample supports cell navigation")
SftTree1.Cell(ItemIndex, 1).Text = "Ctrl+Home and Ctrl+End"
Dim i As Integer
For i = 1 To 50
Dim Item As SftTreeItem
Dim Cell As SftTreeCell
ItemIndex = SftTree1.Items.Add("An item")
SftTree1.Cell(ItemIndex, 1).Text = "2nd Column"
SftTree1.Cell(ItemIndex, 2).Text = "3rd Column"
ItemIndex = SftTree1.Items.Add("Another item")
Set Item = SftTree1.Item(ItemIndex)
Item.Level = 1
Item.Cell(1).Text = "2nd Column"
Item.Cell(2).Text = "3rd Column"
ItemIndex = SftTree1.Items.Add("This item can't be edited")
Set Item = SftTree1.Item(ItemIndex)
Item.Level = 2
Item.EditIgnore = True
Item.Cell(0).Image.Appearance = sftImageCheckboxYes
Item.Cell(1).Text = "2nd Column (can't edit this item)"
Item.Cell(2).Text = "3rd Column (can't edit this item)"
ItemIndex = SftTree1.Items.Add("A fourth item")
Set Item = SftTree1.Item(ItemIndex)
Item.Level = 1
Set Cell = SftTree1.Cell(ItemIndex, 1)
Cell.Text = "This cell can't be edited"
Cell.EditIgnore = True
Cell.Image.Appearance = sftImageCheckboxYes
SftTree1.Cell(ItemIndex, 1).EditIgnore = True
SftTree1.Cell(ItemIndex, 2).Text = "3rd Column"
Next
SftTree1.ColumnsObj.MakeOptimal
SftTree1.RowHeaders.MakeOptimal
SftTree1.Items.RecalcHorizontalExtent
End Sub
Private Sub SftTree1_ItemClick(ByVal ItemIndex As Long, ByVal ColIndex As Integer, ByVal AreaType As Integer, ByVal Button As Integer, ByVal Shift As Integer)
If AreaType = constSftTreeCellText Then
' User clicked on a cell
SftTree1.Cell(ItemIndex, ColIndex).Edit 0, 0
ElseIf AreaType = constSftTreeCellGraphic Then
' check if check box - toggle
Dim Img As SftPictureObject
Set Img = SftTree1.Cell(ItemIndex, ColIndex).Image
If Img.Appearance = sftImageCheckboxNo Then
Img.Appearance = sftImageCheckboxYes
ElseIf Img.Appearance = sftImageCheckboxYes Then
Img.Appearance = sftImageCheckboxNo
End If
End If
End Sub
Private Sub SftTree1_ItemDblClick(ByVal ItemIndex As Long, ByVal ColIndex As Integer, ByVal AreaType As Integer, ByVal Button As Integer, ByVal Shift As Integer)
If AreaType = constSftTreeColumnRes Then
SftTree1.Column(ColIndex).MakeOptimal
ElseIf AreaType = constSftTreeCellGraphic Then
' check if check box - toggle
Dim Img As SftPictureObject
Set Img = SftTree1.Cell(ItemIndex, ColIndex).Image
If Img.Appearance = sftImageCheckboxNo Then
Img.Appearance = sftImageCheckboxYes
ElseIf Img.Appearance = sftImageCheckboxYes Then
Img.Appearance = sftImageCheckboxNo
End If
End If
End Sub
Private Sub SftTree1_ToolTipVScroll(Text As String, ByVal ItemIndex As Long, ByVal ColIndex As Integer)
Text = "Item " & ItemIndex & " - " & Text
End Sub
Private Sub SftTree1_EditAllowed(ByVal ItemIndex As Long, ByVal ColIndex As Integer, Allowed As Boolean)
' Last chance to suppress cell editing for a cell
'If ItemIndex = 1 And ColIndex = 1 Then
' Allowed = False
'End If
End Sub
Private Sub SftTree1_EditInitializing(Window As stdole.OLE_HANDLE, vData As Variant, ByVal EditIndex As Long, ByVal EditCol As Integer, LeftPix As stdole.OLE_XPOS_PIXELS, TopPix As stdole.OLE_YPOS_PIXELS, WidthPix As stdole.OLE_XSIZE_PIXELS, HeightPix As stdole.OLE_YSIZE_PIXELS)
Dim ctrl As Control
' Choose a control based on current column being edited
If EditCol = 1 Then
Set ctrl = Combo1
Else
Set ctrl = Text1
End If
Dim TextHeight As Integer
' Left/Top/Width/Height describes the current cell area
' we need to return the position and size needed for editing.
' In this example, we use the height of the control on the form
' and center it over the cell.
TextHeight = ctrl.Height / Screen.TwipsPerPixelX
TopPix = TopPix + (HeightPix - TextHeight) / 2
HeightPix = TextHeight
' Set the text in the control used for cell editing and
' set other control-specific properties
If ctrl = Text1 Then
Text1.Text = SftTree1.Cell(EditIndex, EditCol).Text
Text1.SelStart = 0
Text1.SelLength = 999
Else
Combo1.Clear
Combo1.AddItem "Option 1"
Combo1.AddItem "Option 2"
Combo1.AddItem "Option 3"
Combo1.AddItem SftTree1.Cell(EditIndex, EditCol).Text
Combo1.Text = SftTree1.Cell(EditIndex, EditCol).Text
End If
' Return the control's window handle
Window = ctrl.hwnd
' Define navigation keys
' VK_TAB
SftTree1.CellEditIntercept Asc(vbTab), cellEditInterceptSftTreeChar + cellEditInterceptSftTreeControlChar + cellEditInterceptSftTreeShiftChar
' VK_RETURN
SftTree1.CellEditIntercept Asc(vbCr), cellEditInterceptSftTreeChar + cellEditInterceptSftTreeControlChar + cellEditInterceptSftTreeShiftChar
' VK_HOME
SftTree1.CellEditIntercept 36, cellEditInterceptSftTreeControlChar
' VK_END
SftTree1.CellEditIntercept 35, cellEditInterceptSftTreeControlChar
If ctrl = Text1 Then
' We want these keys just for the edit control.
' VK_UP
SftTree1.CellEditIntercept 38, cellEditInterceptSftTreeChar + cellEditInterceptSftTreeControlChar + cellEditInterceptSftTreeShiftChar
' VK_DOWN
SftTree1.CellEditIntercept 40, cellEditInterceptSftTreeChar + cellEditInterceptSftTreeControlChar + cellEditInterceptSftTreeShiftChar
End If
End Sub
Private Sub SftTree1_EditInitialized(ByVal Window As stdole.OLE_HANDLE, ByVal vData As Variant, ByVal EditIndex As Long, ByVal EditCol As Integer, ByVal ParentWindow As stdole.OLE_HANDLE, ByVal LeftPix As Long, ByVal TopPix As Long, ByVal WidthPix As Long, ByVal HeightPix As Long, Positioned As Boolean)
' Show the combo box dropdown portion
If Window = Combo1.hwnd Then
' We're taking over positioning, so we can drop down the dropdown portion of the control
Positioned = True
Combo1.Left = LeftPix * Screen.TwipsPerPixelX
Combo1.Top = TopPix * Screen.TwipsPerPixelY
Combo1.Width = WidthPix * Screen.TwipsPerPixelX
' Combo1.Height = HeightPix * Screen.TwipsPerPixelY ' can't set height of a combo box
Combo1.Enabled = True
Combo1.Visible = True
Combo1.SetFocus
SendMessage Window, CB_SHOWDROPDOWN, 1, 0
End If
End Sub
Private Sub SftTree1_EditNavigating(ByVal Key As Long, ByVal Shift As Integer, ByVal ItemIndex As Long, ByVal ColIndex As Integer)
' Process key pressed
SftTree1.EditNavigate Key, Shift
End Sub
Private Sub SftTree1_EditValidate(ByVal Window As stdole.OLE_HANDLE, ByVal vData As Variant, ByVal EditIndex As Long, ByVal EditCol As Integer, InputValid As Boolean)
' Validate the new cell contents
Dim S As String
If Window = Text1.hwnd Then
S = Text1.Text
Else
S = Combo1.Text
End If
S = Trim(S)
If Len(S) <= 0 Then
MsgBox ("Just to demonstrate data input validation, this example rejects empty cells. Please enter some data.")
InputValid = False
End If
End Sub
Private Sub SftTree1_EditEnding(ByVal Window As stdole.OLE_HANDLE, ByVal vData As Variant, ByVal EditIndex As Long, ByVal EditCol As Integer, ByVal SaveInput As Boolean)
' Save the new cell contents
If SaveInput Then
If Window = Text1.hwnd Then
SftTree1.Cell(EditIndex, EditCol).Text = Text1.Text
Else
SftTree1.Cell(EditIndex, EditCol).Text = Combo1.Text
End If
End If
End Sub
