 |
panik! Level: Big Cheese
 Registered: 12-02-2005 Posts: 19
|
Editing FlexGrid
So I found a routine which allows you to edit a FlexGrid cell by placing a textbox over the cell. But, whenever the code gets called I get an error on statements that use "Text1" in the statement, as in:
Sub GridEdit(KeyAscii As Integer)
'use correct font
text1.FONTNAME = MSFlexGrid1.FONTNAME
text1.FontSize = MSFlexGrid1.FontSize
as I said it does not like the "text1.fontname" statement.
What do I have to do to get this to work?
I feel like I'm missing something basic.
Thanks!
|
|
14-02-2005 at 03:32 PM |
|
|
humberto Level: VB Lord
 Registered: 13-01-2005 Posts: 246
|
Re: Editing FlexGrid
Sub entry_grid_KeyPress(KeyAscii As Integer)
MSFlexGridEdit entry_grid, txtEdit, KeyAscii
End Sub
Sub MSFlexGridEdit(MSFlexGrid As Control, Edt As Control, KeyAscii As
Integer)
' Use the character that was typed.
Select Case KeyAscii
' A space means edit the current text.
Case 0 To 32
Edt = MSFlexGrid
Edt.SelStart = 1000
' Anything else means replace the current text.
Case Else
Edt = Chr(KeyAscii)
Edt.SelStart = 1
End Select
' Show Edt at the right place.
Edt.Move MSFlexGrid.CellLeft + MSFlexGrid.Left, MSFlexGrid.CellTop +
MSFlexGrid.Top, _
MSFlexGrid.CellWidth, MSFlexGrid.CellHeight
Edt.Visible = True
' And let it work.
Edt.SetFocus
End Sub
Sub EditKeyCode(MSFlexGrid As Control, Edt As _
Control, KeyCode As Integer, Shift As Integer)
' Standard edit control processing.
Select Case KeyCode
Case 27 ' ESC: hide, return focus to MSFlexGrid.
Edt.Visible = False
MSFlexGrid.SetFocus
Case 13 ' ENTER return focus to MSFlexGrid.
MSFlexGrid.SetFocus
Case 38 ' Up.
MSFlexGrid.SetFocus
DoEvents
If MSFlexGrid.Row > MSFlexGrid.FixedRows Then
MSFlexGrid.Row = MSFlexGrid.Row - 1
End If
Case 40 ' Down.
MSFlexGrid.SetFocus
DoEvents
If MSFlexGrid.Row < MSFlexGrid.Rows - 1 Then
MSFlexGrid.Row = MSFlexGrid.Row + 1
End If
End Select
End Sub
|
|
|
14-02-2005 at 03:46 PM |
|
|
|
|
 |
 |