Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Grid - AfterRowColChange
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 8 SP1
OS:
Windows XP SP2
Database:
Visual FoxPro
Miscellaneous
Thread ID:
00966222
Message ID:
00967351
Views:
11
Hi Serghey,
The code I posted was just for the repro, I can put your code in our classes code where we formerly had toGrid.setfocus().
Our first work around was similar to what you came up with, but then we tested toGrid.afterRowColChange() and that seemed to do what we wanted - i.e. running the method code regardless of AllowCellSelection setting.
Do you see anything wrong with calling toGrid.afterRowColChange()?
Thanks again.

PS Do you think I should do a bug report?

>Hi Doru,
>
>Sorry for delay. Yes, SetFocus on a grid doesn't fire AfterRowColChange when AllowCellelection=.F. I think it's a bug. Anyway, here's a workaround I come up with. Below is only relevant part of your code. Let me know what you think about it.
>	PROCEDURE RefreshGrid(toGrid)
>		IF NOT toGrid.AllowCellSelection
>			Thisform.LockScreen = .T.
>			toGrid.AllowCellSelection = .T.
>			toGrid.SetFocus()
>			toGrid.AllowCellSelection = .F.
>			Thisform.LockScreen = .F.		
>		ELSE
>			toGrid.SetFocus()
>		ENDIF	
>	ENDPROC
>
>	PROCEDURE command2.Click
>		if recno()>1
>			skip -1
>		ENDIF
>		Thisform.RefreshGrid(thisform.grdZ)
>	ENDPROC
>
>	PROCEDURE command3.Click
>		if recno()<5
>			skip 1
>		endif
>		Thisform.RefreshGrid(thisform.grdZ)
>	ENDPROC
>
Don't beat me for the name of the method RefreshGrid. :)
>You can peak better one.
>
>>Hi Sergey,
>>Just to clear this up...
>>Did you try the repro code?
>>Can you confirm the SetFocus does not work with AllowCellelection=.F. (i.e. it does not fire AfterRowColChange)?
>>We fixed the problem by replacing SetFocus with AfterRowColChange, but I believe we shouldn't have to call any of the two methods. I think that when you move the record in the grid source, the AfterRowColChange should fire. The way it is now, it is not consistent: visually the grid changes the record marker and the row highlight, but the method code does not run.
>>
>>...
>>>Grid.setfocus() with AllowCellelection=.F. works fine for me. Can you post a simple code that repro this problem?
>>...
Doru
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform