By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,635 Members | 1,707 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,635 IT Pros & Developers. It's quick & easy.

Detect whether clicks are inside or outside a flexgrid

P: n/a
Hi,

In VB6 Pro SP5, I have a form that contains an MSFlexGrid and a few
other textboxes and comboboxes. I am using the technique from MSDN
article Q241355, which describes how to tab and edit in a flexgrid.
Briefly, the technique is to overlay the cell to be edited with
"floating" textbox; data is edited in the floating textbox and moved
to the cell when the floating textbox loses focus.

The technique works well except for when the mouse is clicked on a
control outside the flexgrid. In this case, the grid behaves as
though the tab key was pressed: focus appears to move to the next cell
in the grid rather than moving to the control that was clicked. (What
actually happens is that the floating textbox is moved to cover the
next cell in the grid, that cell's text is copied to the floating
textbox, which then receives focus. This would be correct if the user
had tabbed to the next cell in the grid; however, if the user clicks
on an unrealted control, focus should go to that control.)

I think I could fix this if I could detect (from the floating
textbox's LostFocus procedure) that the mouse click was outside the
flexgid.

If I could detect from within the textbox's LostFocus procedure that
the mouse was clicked, say, in a unrelated combobox, I could skip the
remainder of the code in the LostFocus procedure, and allow focus to
transfer to the combobox.

Does anyone have any ideas on how to detect whether the mouse was
clicked inside or outside the grid?

PS: I understand that there are other grid controls I could buy, but
I'd like to get this to work with MSFlexGrid.
Thanks,
Mike
..
Jul 17 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.