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 Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Grid Control Has Screwy Side Effect

Status
Not open for further replies.

Shanachie

Programmer
Jun 18, 2000
92
US
My app has a grid to show the detail lines of a purchase order. One of the columns is a dropdown to allow the user to choose from a list of services. When chosen, the dropdown assigns values to columns containing the service number, the description (name) of the service, and the unit price of the service. Inexplicably, it also somehow sets the PO line number column to the index number of the item chosen. If, in the 5th line of the PO, I choose the 12th service on the list, the line number is set to 12! I can't seem to find where this is happening and why.

I have narrowed the timing of this to somewhere between the Click event and the Valid event for the dropdown. The debugger's event tracking only shows Paint events between them. (I've had the tracker skip Init, Destroy, MouseUp, MouseDown, and MouseMove events to keep the file manageable.)

The underlying table displayed by the grid reflects the change so it's not a display abberation.

I'm running out of ideas.

Suggestions?

Shanachie
 
I've had the same trouble with ComboBox controls in Grids... selecting an item from the combo box also picks the item in the grid that the mouse is over when you make the selection in the combo box.

It's like the mouse click "bounces" and clicks both the item in the dropdown list of the combo box, and clicks the row in the grid that it is over.

You can set a flag "DroppedDown" to Seconds() in the DropDown event of the comboboxes, then check that flag in the grid's BeforeRowColumn change event, and if DroppedDown+0.1>Seconds() then it's a bounce, and ignore it with RETURN .F. or NODEFAULT, or whatever prevents the row/col change from occuring.
 
I've seen the same thing. In fact, one problem I saw was that another dropdown (BTW readers, "dropdowns" are really "combo boxes", I just forget their real name) put a popular choice over the "Cancel" button at the bottom of the form. This led to much chaos until I figured it out.

However, that's not what's up with the current problem. The list isn't anywhere near the line number column. And I just checked to be sure and there is nothing but empty grid under the choice. (Any way that could be the problem?)

I'm tempted to kludge it by storing the line number when the dropdown gets focus and resetting it during the Valid event. Just seems like fixing the symptom, not the problem.

Any other ideas? I'm baffled.

Shanachie
 
I don't know what the problem is, but one thing you might try is putting some 'nodefault's in various things and see what they do. That might shed some light on where the problem is. Dave Dardinger
 
I don't understand. What do you mean by "putting some 'nodefault's in various things..."? Do you mean changing the events from default?

I appreciate the help. I just don't quite know what you mean.

TIA,
Shanachie
 
Just saw this thread and thought I'd reply....I had the same problem. Have you bound the column?

It all got resolved if I set grid1.boundto = .t.

[spin] ITflash [spin]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top