|
-
Feb 18th, 2000, 02:02 AM
#1
Thread Starter
Hyperactive Member
-
Feb 18th, 2000, 02:36 AM
#2
Hyperactive Member
'set column width
MSFlexGrid1.colwidth(0) = 2500
'enter text
MSFlexGrid1.TextMatrix(1,1) = "Entering text"
-
Feb 18th, 2000, 02:53 AM
#3
Hyperactive Member
You can't actually edit an MSHFlexgrid. But you can make it look like you're editing it.
[*]What you do, is set up a textbox, Text1 and set it's border to none.
[*]Then when the user clicks the MSHFlexgrid, or presses a key while it has the focus have the textbox pop up and automatically size itself to be the exact same size as the cell in the MSHFlexgrid, using the MSHFlexgrid.CellHeight, MSHFlexgrid.CellWidth
[*]Then have it align itself over the top of that cell using MSHFlexgrid.Left + MSHFlexgrid.CellLeft to align the left side and MSHFlexgrid.Top + MSHFlexgrid.CellTop to align the top.
[*]Then the user can type whatever they want into the textbox and when they press Enter or something just save what is in the textbox to the MSHFlexgrid by using something like this: MSHFlexgrid.TextMatrix(MSHFlexgrid.Row, MSHFlexgrid.Col) = Text1.Text
That should work. That's what I did.
------------------
Ryan
[This message has been edited by Gimpster (edited 02-18-2000).]
-
Feb 18th, 2000, 03:20 AM
#4
If you'd like me to send you a demo project that uses the method Gimpster describes, email me.
------------------
Marty
What did the fish say when it hit the concrete wall?
> > > > > "Dam!"
-
Feb 18th, 2000, 03:25 AM
#5
If you'd like me to send you a demo project that uses the method Gimpster describes, email me.
------------------
Marty
What did the fish say when it hit the concrete wall?
> > > > > "Dam!"
-
Feb 18th, 2000, 03:31 AM
#6
Actually, yes, you can, edit cells in the MsFlexGrid. Here's an example. Use this code on KeyPress event of the MsFlexGrid:
Code:
Private Sub MSFlexGrid1_KeyPress(KeyAscii As Integer)
With MSFlexGrid1
Select Case KeyAscii
Case 8
If Not .Text = "" Then
.Text = Left(.Text, Len(.Text) - 1)
End If
Case Else
.Text = .Text & Chr(KeyAscii)
End Select
End With
End Sub
------------------
Serge
Senior Programmer Analyst
[email protected]
[email protected]
ICQ#: 51055819
-
Feb 18th, 2000, 03:52 AM
#7
-
Feb 18th, 2000, 06:42 AM
#8
I know, I have that too. In my project I had to use MSFlexGrid with Textbox and Combobox, to give the user an ability to edit.
The only bad thing about using KeyPress event is that you don't see the blinking carret.
------------------
Serge
Senior Programmer Analyst
[email protected]
[email protected]
ICQ#: 51055819
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
|