Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Grids with containers
Message
From
13/07/2001 05:47:09
 
 
To
12/07/2001 14:44:50
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Miscellaneous
Thread ID:
00528028
Message ID:
00530119
Views:
22
Hi!

>My grid column contains two controls - a container (that contains a textbox), and another separate textbox, and use DynamicCurrentControl to ensure that the container only shows for the current record. This works ... but ... the textbox inside the container does not seem to get focus correctly. I have had to put a container.SetFocus() in the grid's AfterRowColChange() to set it explicity, this does work but slows scrolling down a lot and also causes the control to flicker. Any suggestions?
>

In such case use Sparse=.F. and make current control the container, and do not use the default textbox and DynamicCurrentControl. The data in column will be displayed like usually in the non-current rows, when selecting the cell will show the container. Well, in current row when cell is not selected, the container will not appear too, so think if this is acceptable.

If you still want to use the way you did, I will show you a trick of how to speed up the process, however, get rid of flickering by self. Make a flag property that will be .F. and set it to .T. in the BeforeRowColChange (lGoingToChange, for example). In the refresh procedure called from the DynamicRowColChange run the code to fix the property that tracks the current row number, for example (striped out from my code):
if this.parent.parent.lGoingChange
	this.parent.parent.lGoingChange = .F.
	this.parent.parent.nRecNo=recno(this.parent.parent.RecordSource)
endif
Above way grid.Refresh call in the AfterRowColChange event is not required. Anyway, control will flicker, but much more quickly and it will be more reliable. Above works for me, however, when I use 2 containers in tyhe column. However, I did not tried this approach with editable grids and grids with textbox+container. I can, however, workaround any problem by as best way as possible remembering following:
- you can use the built-in VFP events-tracking system to figure out how grid methods are fired. Just use DEBUGOUT command to add your own messages from your own code to the list of the events fired in the output window. Described above approach was invented exactly this way.
- you can use the cover shapes or the controls over the grid to make what you want. Display grid as usual, for current row put your data editing controls exactly on the place where required accordingly to current grid configuration, scrolling state and columns order/width/visibility. It is possible, I can give you all the formula if you require. However, I'm going to make a set of articles in the UT for grids where I describe all this too.
Vlad Grynchyshyn, Project Manager, MCP
vgryn@yahoo.com
ICQ #10709245
The professional level of programmer could be determined by level of stupidity of his/her bugs

It is not appropriate to say that question is "foolish". There could be only foolish answers. Everybody passed period of time when knows nothing about something.
Previous
Reply
Map
View

Click here to load this message in the networking platform