Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Grid Relationships
Message
De
17/09/1998 07:40:12
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
 
 
À
17/09/1998 06:34:35
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
00137707
Message ID:
00137716
Vues:
18
>Heres a little poblem that I have encountered. I have two grids on a form, the first one holds names and addresses of parents, the second grid holds names and DOB's of their children. Now in order for the relationship between the grids to work I have to have the child table ordered on a particular index. So far, so groovy.
>
>Now what I want to do is to add the ability for the user to click on various grid headers to re-order the grid display based on the column that the header sits on. To do this, I would think that I would have to use another index tag on the child table but this would break the relationship and nothing is diplayed in the grid.
>
>It doesnt sound too hard a thing to do, but I've been staring at the problem so long now that I cant see the wood for the trees.
>
>Any ideas?
>
>
>Ashley Cottle
>AssureSoft Ltd
>AshleyC@cosworth.infotrade.co.uk
Hi Ashley,
Multipl ways of doing it there could be.
1) Use ingrid for searching so you don't play with headers and order
2) All other tags other than relation could be RelField+Field so changing order preserves relation
3) Child could be a view with field from parent.id and parent grid.afterrowcolcahnge requery("child")
4) If child is not going to be edited recordsource could be an SQL with [where child.id = eval(thisform.parentgrid.recordsource+".id")]
List goes on. Some of these will also need you change native header with a custom header :
define class myheader as header
  procedure click
    thisform.lockscreen = .t.
	if !empty(this.parent.myTextBox.tagname)
		set order to tag (this.parent.myTextBox.tagname) ;
			in (this.parent.parent.recordsource)
	else
		set order to 0	in (this.parent.parent.recordsource)
	endif
	nTempCurrec = recno(this.parent.parent.recordsource)			
	this.parent.parent.refresh
	if between(nTempCurrec,1,reccount(this.parent.parent.recordsource))
		go nTempCurrec in (this.parent.parent.recordsource)
	endif
    thisform.lockscreen = .f.
  endproc
enddefine
In grid.init you loop through columns, removeobject("header1"), addobject("Header1","myheader"). Also notice that this example header class refers to a textbox class with a custom tagname property. You could change that to tag, comment etc which native controls have by default.
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform