Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Grid ActiveRow always returns 0
Message
 
 
To
16/05/2004 03:55:23
General information
Forum:
Visual FoxPro
Category:
Classes - VCX
Miscellaneous
Thread ID:
00904000
Message ID:
00904444
Views:
19
Peter,

>No, of course you are absolutely right - once it works, it'll never be zero again, except if there are no records in the grid.
>It just seems a very roundabout way of achieving it.

I think then you could simplify things. Make yout cmdDelete.Refresh():
this.Enabled = ( reccount( "YourCursor/TableHere" ) > 0 )
>What bothers me most though, is that calling the SetFocus fires the .Page.Activate event.
>This puts some limitations to what one can do in the .Page.Activate method.

I don't see this so there has to be some code in your form/classes causing this. See the test form below. The grid is on page2 and clicking the button doesn't trigger the Page2.Activate.

>Got to look up RecordMark, that's one I must have missed.
>
>Thank's for your help and have a pleasent sunday.

You too.
**************************************************
*-- Form:         form1 (c:\vfp8app\misc\grdhighlight2.scx)
*-- ParentClass:  form
*-- BaseClass:    form
*-- Time Stamp:   05/16/04 11:05:01 AM
*
DEFINE CLASS form1 AS form

	Top = 0
	Left = 0
	Height = 315
	Width = 570
	DoCreate = .T.
	Caption = "Form1"
	Name = "Form1"

	ADD OBJECT pageframe1 AS pageframe WITH ;
		ErasePage = .T., ;
		PageCount = 2, ;
		Top = 14, ;
		Left = 6, ;
		Width = 532, ;
		Height = 287, ;
		Name = "Pageframe1", ;
		Page1.Caption = "Page1", ;
		Page1.Name = "Page1", ;
		Page2.Caption = "Page2", ;
		Page2.Name = "Page2"

	ADD OBJECT form1.pageframe1.page2.grid1 AS grid WITH ;
		Height = 195, ;
		Left = 16, ;
		Top = 14, ;
		Width = 338, ;
		HighlightStyle = 2, ;
		Name = "Grid1"

	ADD OBJECT form1.pageframe1.page2.command1 AS commandbutton WITH ;
		Top = 117, ;
		Left = 397, ;
		Height = 27, ;
		Width = 84, ;
		Caption = "Command1", ;
		Name = "Command1"

	PROCEDURE Load
		create cursor x1 ( i1 i, i2 i )
		for i = 1 to 20
		   insert into x1 values ( 1, 1 )
		endfor
		go top
	ENDPROC

	PROCEDURE command1.Click
		this.Parent.grid1.SetFocus()
	ENDPROC

ENDDEFINE
*
*-- EndDefine: form1
**************************************************
df (was a 10 time MVP)

df FoxPro website
FoxPro Wiki site online, editable knowledgebase
Previous
Reply
Map
View

Click here to load this message in the networking platform