Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
What's wrong in my code?
Message
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 8 SP1
OS:
Windows XP SP2
Miscellaneous
Thread ID:
01006642
Message ID:
01006949
Views:
33
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)
If it's not broken, fix it until it is.


My Blog
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform