|
-
Apr 17th, 2001, 10:38 AM
#1
Thread Starter
Junior Member
-
Apr 17th, 2001, 10:54 AM
#2
You need to place a text box over the cell clicked into, and get the user to type the entry into this. When the focus is lost from the text box, the entry is updated :
Code:
Private Type FlxCell
row As Long
col As Long
End Type
'Set up a new type used to define a cell in the flexgrid
'- this includes 2 number variables, to reference in the row & column.
Private Active_FlxCell As FlxCell
'Introduce new variable for above created cell / new type.
Private Sub FlxGrd_dblClick()
If FlxGrd.row > 0 And FlxGrd.col = 2 Then
Active_FlxCell.row = FlxGrd.row
Active_FlxCell.col = FlxGrd.col
'If a cell is selected, check if this is the top row (which would be the heading)
FlxGrd.ScrollBars = flexScrollBarNone
'User can't scroll down until the cell has been unselected.
With TxtEdit
.Top = FlxGrd.CellTop + FlxGrd.Top
.Left = FlxGrd.CellLeft + FlxGrd.Left
.Width = FlxGrd.CellWidth
.Text = FlxGrd.Text
.Visible = True
.ZOrder
.SetFocus
End With
'Set the size of the textbox to fit around the selected cell, make it
'visible for the user to see, and copy the active cell's text inside the text box.
End If
End Sub
Private Sub TxtEdit_LostFocus()
FlxGrd.ScrollBars = flexScrollBarBoth
'Place scrollbars back onto the Flexgrid control.
If Not IsNull(TxtEdit.Text) Then
'user typed an entry in the text box
FlxGrd.TextMatrix(Active_FlxCell.row, Active_FlxCell.col) = TxtEdit.Text
End If
End Sub
This is what I used. If you look in the MSDN samples that come with VB, there a project called MSFlexgd.vbp, which is a sample app of using the flexgrid control
Last edited by alex_read; Apr 17th, 2001 at 10:59 AM.
-
Apr 17th, 2001, 12:39 PM
#3
Thread Starter
Junior Member
thx but...
thank you, it's exactly what i want!!!
But I still have a question.
I can't change the width of my cells...
And can the cells have different size than the others???
-
Apr 18th, 2001, 02:27 AM
#4
You need to do this in your code at startup. I.e. -
Code:
Private Sub Form_Load()
With MSFlexGrid1
.ColWidth(0) = 1000
.ColWidth(1) = 1000
.ColWidth(2) = 1000
End With
End Sub
-
Apr 18th, 2001, 07:13 AM
#5
Thread Starter
Junior Member
thx
I have a simple question....
Why I haven't found it alone...
Thanks!!!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|