Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
What's wrong in my code?
Message
De
21/04/2005 09:31:52
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 8 SP1
OS:
Windows XP SP2
Divers
Thread ID:
01006642
Message ID:
01006961
Vues:
51
This message has been marked as a message which has helped to the initial question of the thread.
I don't have an idea about the purpose of the code nor the FAQ entry.
You don't need to set it to null as long as it's local. I've used it in many places and versions with no memory leaks. However since you're checking object name you might even make it shorter usign lower(justext(sys(1272,sys(1270)))).
Cetin

>Cetin,
>
>If you don't see problems in the code bellow, I think, John's FAQ should be updated using this piece of code instead. I'll send a message to John asking him to update his FAQ then.
>
>I just thought, that I may want to set loObject to NULL. Do you know, if there are any problems using sys(1270) function related to memory usage?
>
>>Terrific! The whole code now is much shorter and I don't have to code it in individual instances, if my button is on the pageframe and not on the form.
>>
>>
>>********************************************************************
>>*  Description.......: CancelValidation
>>*  Calling Samples...:
>>*  Parameter List....:
>>*  Created by........: ideas by John Koziol /Cetin Basoz
>>*  Modified by.......: NN
>>********************************************************************
>>LOCAL llReturn, loObject
>>loObject = SYS(1270) && Reference to an object under mouse
>>llReturn = .f.
>>IF VARTYPE(m.loObject) = "O" AND LOWER(m.loObject.name) = "cmdcancel" AND MDOWN()
>>   llReturn = .t.
>>endif
>>
>>return m.llReturn  or lastkey()= 46 OR thisform.ReleaseType = 1 && Alt+C (shortcut for Cancel)
>>
>>
>>>.Top is relative to its parent. ObjToClient result is relative to form.
>>>You could instead use sys(1270) as a shortcut.
>>>Cetin
>>>
>>>>Disregard. After I changed right and bottom to use button's properties, it worked. Not sure, why there is a difference between using objToClient and .top.
>>>>
>>>>Hi everyone,
>>>>
>>>>I'm looking at this simple thing longer than it should take but could not find a problem. I used top and left + pageframe top/left, then switched to objtoClient, but my code is still not working. Could it be a problem with Pages collection? If yes, how can I reference an active page?
>>>>
>>>>Thanks.
>>>>
>>>>local nCancelTop, nCancelHeight, nCancelLeft, nCancelWidth, llReturn, lnMousePosY, lnMousePosX
>>>>lnMousePosY = mrow(thisform.name,3)
>>>>lnMousePosX = mcol(thisform.name,3)
>>>>with thisform.pgPatient.pages(thisform.pgPatient.activepage)
>>>>	nCancelTop = OBJTOCLIENT(.cmdCancel, 1)
>>>>	nCancelBottom = m.nCancelTop + OBJTOCLIENT(.cmdCancel, 4)
>>>>	nCancelLeft = OBJTOCLIENT(.cmdCancel, 2)
>>>>	nCancelRight = m.nCancelLeft + OBJTOCLIENT(.cmdCancel, 3)
>>>>endwith
>>>>
>>>>llReturn = .f.
>>>>
>>>>if between(m.lnMousePosY,m.nCancelTop,m.nCancelBottom) and ;
>>>>		between(m.lnMousePosX,m.nCancelLeft,m.nCancelRight) and ;
>>>>		mdown()
>>>>	llReturn = .t.
>>>>endif
>>>>
>>>>return m.llReturn  or lastkey()= 46 or thisform.releasetype = 1 && Alt+C (shortcut for Cancel)
Ç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
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform