Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Programmatically building a grid.
Message
From
30/12/1998 14:19:34
 
 
To
30/12/1998 14:01:39
General information
Forum:
Visual FoxPro
Category:
Object Oriented Programming
Miscellaneous
Thread ID:
00171617
Message ID:
00171638
Views:
34
>>I've got a grid object in a container that only has 1 column in it.
>>During program execution, I dynamically add columns to the grid with the AddObject method. Everything works fine, but I would like to allow the user to right-click or double-click in the text boxes in the grid. I've placed wait windows in the right-click and double-click events of the grid, and they never fire.
>>
>>Now for something even more interesting.
>>
>>I created a class called "blah" that was based on the TextBox control. In this new class, I added wait windows in the double-click and right-click events of the "blah" class. In my program I cycle through all of the columns that I'm adding to the grid, and do a RemoveObject("Text1") to remove the TextBox control that is placed there by default, then then AddObject("Text1", "blah") to add in my custom version of the TextBox control.
>>
>>Now when I run my program, I can't see the data in any cell that I click in, and I can't use the arrow keys to navigate through the grid.
>>All the data is displayed in the grid properly, but it just vansihes when I click in it, and reappears when I move to another cell.
>>
>>I want to be able to double-click or right-click in a cell so that I can do other stuff based on the value of the cell.
>>
>>Does anyone have any ideas?
>>
>>Thanks,
>>Jeff Newbill
>
>Basically, you did everything right, but, unfortunately, it seems that grid gets corrupted somewhere in the middle. You know, grids used to be corrupted when there are too many on-fly re-buildings. IMO, the better way to have a solid grid is to create it in form designer as a first place and permannently base on read/write cursor. Then, whatever interface solutions you want to apply to this grid, it will be actually repopulating (DELETE/ZAP/INSERT) of this cursor.

That's a good point. It certainly would save a lot of headaches when the Grid suddenly de-stabilizes for no known reason. A full rebuild with identical code fixes. Having some kind of data driven grid builder is an excellent idea. Do you think that control sources should only be placed programatically/run time not design time?.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform