GdaGuy Level: Trainee
 Registered: 20-10-2005 Posts: 1
|
Re: buttons/dropdown on Datagrid 6.0
Public WasVisible As Boolean
Public Sub SynchCombo()
'Forget the button property.
'Use a regular combo box and this code to synchronize the position of the combo box with the grid column and row
'call this procedure in the RowColChange and Scroll procedures
'you might have to make a few adjustments, I have'nt exhausted the testing
Dim ComboColumn As Long
On Error Resume Next
ComboColumn = 2 'the column index of the column you're trying to do the dropdown for.
RegularCombobox.Visible = (DataGrid.Col = ComboColumn)
WasVisible = (DataGrid.Col = ComboColumn)
If DataGrid.Columns(ComboColumn).Left <= 0 Or DataGrid.RowTop(DataGrid.Row) <= 0 Then
If RegularCombobox.Visible = True Then
WasVisible = True
RegularCombobox.Visible = False
End If
Else
If RegularCombobox.Visible = False And WasVisible = True Then
RegularCombobox.Visible = True
End If
RegularCombobox.Left = DataGrid.Left + DataGrid.Columns(ComboColumn).Left
RegularCombobox.Top = DataGrid.Top + DataGrid.RowTop(DataGrid.Row)
End If
RegularCombobox.Width = DataGrid.Columns(ComboColumn).Width
RegularCombobox = DataGrid.Columns(ComboColumn).Text
If DataGrid.Col = ComboColumn Then RegularCombobox.SetFocus
End Sub
|