Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
What's wrong in my code?
Message
 
 
To
21/04/2005 07:08:31
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
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:
01006942
Views:
37
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