Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Flex grid focus ...

Status
Not open for further replies.

eequalsmc2plus1

Programmer
Aug 26, 2002
28
ZA
Hi,

Another grid question,
I got grid and when someone click on it, focus set to text box, then on the change event of text box I set the grid text = textbox text. BUT ... person cant see where they are on the grid because focus is set to the text box.
How you get around this ?
Tried not setting focus to text box and then on the keypress event of grid setting the text box text = text & chr(keyascii) from the grid, works fine, but when you try delete text it screws up, puts lines in text box.
What else can I do ?

Thanks,
Damian
 
In the SetFocus event of the text box, you could position (and make visible) the text box to be directly over the cell being edited.

Text.left = Grid.Left + Grid.CellLeft
Text.Top = Grid.Top + Grid.CellTop

and the Lost_focus event of the text box, put the text box back where it belongs, or my preference, is the make the text box invisible Good Luck
--------------
As a circle of light increases so does the circumference of darkness around it. - Albert Einstein
 
I use the enter cell event to create a similar effect. From this event I call the following procedure which positions the text box.


Private Sub Position_TextBox(pGrid As MSFlexGrid)
'// Postions the floating text box within the appropriate cell of the grid.
txtFloat.top = pGrid.CellTop + pGrid.top
txtFloat.Left = pGrid.CellLeft + pGrid.Left
txtFloat.width = pGrid.CellWidth
txtFloat.Height = pGrid.CellHeight
txtFloat.Visible = True
txtFloat.SelStart = 0
txtFloat.SelLength = Len(txtFloat.Text)
txtFloat.SetFocus
End Sub
Thanks and Good Luck!

zemp
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top