Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Pages don't have Left, Top, Width, Height
Message
De
18/06/2005 19:00:11
 
 
À
18/06/2005 15:36:29
Information générale
Forum:
Visual FoxPro
Catégorie:
Gestionnaire d'écran & Écrans
Divers
Thread ID:
01024634
Message ID:
01024661
Vues:
19
>>Pages don't have Left, Top, Width and Height. Pageframes have PageWidth and PageHeight. But right now I have a routine that adds all Left values of an object and its parents. Like of .pgf.pagoptions.cnttransparent.chkyes. The routine crashes when evaluating .pgf.pagoptions. As it is now, I'd have to make an exception for pages and then take the difference between the pageframe's height and pageheight. Quite cumbersome.
>>
>>I consider to go for the wish to add (readonly) Left, Top, Width and Height for pages. Any feedback beforehand here is welcome.
>
>
>OBJTOCLIENT(oPage,1|2|3|4)
>
Fabio, thanx. I was unaware of this function. I see that you suggest them for the Page object. For the record, its value will be different from the pageframe's PageHeght/PageWidth value. The Left position of objtoclient is relative to the form where the Left position of the object itself is relative to its parent, which may be a container or a pageframe.

But they appear to come in very handy for me, because I am now able to replace the 12 lines that added the Left and Top values of the real object AND its parents by 2 objtoclient statements. And I assume that there's also a speed improvement, although that one never worried me because I noticed no delays. Here's my old code:
loObject = &lcObject
lnLeft   = m.loObject.left
lnTop    = m.loObject.top
*
for ln = 2 to occurs( '.', m.lcObject )
	*
	lcC = left( m.lcObject, at( '.', m.lcObject, m.ln ) - 1 )
	*
	*	Pages don't have Left, etc. So, for objects on pages we have to 
	*	take a look at the pageframe's pagewidth and pageheight properties.
	if &lcC..class == 'Page'
		lnLeft = m.lnLeft + &lcC..parent.width  - &lcC..parent.pagewidth  - 2
		lnTop  = m.lnTop  + &lcC..parent.height - &lcC..parent.pageheight - 2
	else
		lnLeft = m.lnLeft + &lcC..left
		lnTop  = m.lnTop + &lcC..top
	endif
next
And here's my new code:
lnTop  = objtoclient( m.loObject, 1 )
lnLeft = objtoclient( m.loObject, 2 )
Groet,
Peter de Valença

Constructive frustration is the breeding ground of genius.
If there’s no willingness to moderate for the sake of good debate, then I have no willingness to debate at all.
Let's develop superb standards that will end the holy wars.
"There are three types of people: Alphas and Betas", said the beta decisively.
If you find this message rude or offensive or stupid, please take a step away from the keyboard and try to think calmly about an eventual a possible alternative explanation of my message.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform