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

control source issue?

Status
Not open for further replies.

redzombi5k

Programmer
Jan 21, 2009
22
US
Hello everyone,
I have a issue that im sure if i explain properly has a very simple solution, but its kicking my butt!

I have a simple form with 4 textboxes, an edit box that are all control sourced to the same free table, there is also a list box with a rowsource(same table). For some unknown to me reason, when i change from one textbox to another one or from a text box to the edit box everything except the listbox goes gray (disabled). Now it does not always do this from one box to the next, I have not figured the exact pattern here, seems somewhat inconsistent.
Anyway i placed a button on my form with the code "thisform.refresh()" only, and this reenables all controls with the proper values in them and everything, another way to reenable these is to click on another row in the listbox.This is a rather irritating bug, and i was hoping you might be able to point me in the direction of a fix.
Thanks!
 
I agree with Olaf. One way in which a textbox can "go grey" (that is, become read-only) is if the table moves to end-of-file.

I suspect the Listbox is causing the trouble. If it has a RowSourceType of 6, then the record pointer will move whenever you move the highlight in the Listbox. I suggest you try temporarily removing the Listbox to see if the problem goes away.

If that doesn't help, try building the form again from scratch, one step at a time. That will help you identify what you did to cause the problem to appear.

Mike


__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro tips, advice, training, consultancy
Custom software for your business
 
Well, it would appear you guys were correct.
Listbox rowsourcetype is 6, my confusion lies with why it is reaching eof() as i thought it would only move the record pointer to what was available in the listbox, not to the end of file?
I tried playing with some - if eof() clauses and the skip -1, but it still was not acting as i would hope. Will continue tinkering, always open to a friendly suggestion :)
Thanks!
 
The Listbox moves to EOF while reading in all the items. Even if it wouldn't go to EOF it would at least be at BOF. Once it has all records in it, you can GOTO some record I assume, then it would work like a grid and whenever you choose an item all single record controls would display that like it also works with a grid instead of a listbox. The grid differs while scanning through the rows to display records, in that it stops when the display is full, the listbox propagates it's item array with all records, though.

Bye, Olaf.
 
One other source of your problem may be a filter or a locate not finding any record, then you move to EOF too. If that is done in some validate or lostfocus you may have such behavior. For example to check for uniqueness of a new value in record validation use the same table again with another alias and locate within that other alias. Don't move within the alias you bind to controls other than with a next/previous button or by user interaction in a grid or listbox, but not programmatically.

Bye, Olaf.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top