Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
TxtBox Screen Location
Message
General information
Forum:
Visual FoxPro
Category:
Classes - VCX
Miscellaneous
Thread ID:
00117562
Message ID:
00117812
Views:
21
Yep. I loved it the first time I saw it. :)

>Nifty function! It works with forms and the _screen object as well.
>
>So the control's position relative to the VFP window could be calculated as:
>
>
>     objtoclient(thisform, 1) + objtoclient(this, 1)
>
>and relative to the entire screen could be calculated as:
>
>     objtoclient(_screen, 1) + objtoclient(thisform, 1) + objtoclient(this, 1)
>
>
>>Hi Ken,Ed & Clark
>>
>>Its actually much simpler. The OBJTOCLIENT() function gets the relative position from form level for any object.
>>
>>>If you want to do this without your controls needing to know how many levels deep it is nested, add AbsoluteTop and AbsoluteLeft properties to all your classes. In the init (or refresh if you expect them to move), add something like this:
>>>
>>>
this.AbsoluteTop = this.parent.AbsoluteTop + this.Top
>>>this.AbsoluteLeft = this.parent.AbsoluteLeft + this.Left
>>>
>>>
>>>This is a simplified example of course. There may be other things you'll need tot take into consideration, but you get the idea.
>>>
>>>
>>>>>>>I have a class based on textBox that is used on various forms. Is there a way to determine the row and column screen postion of the class when it gets focus ?
>>>>>>>
>>>>>>>Thanks CB
>>>>>>
>>>>>>Actually, you can check left,top properties of the object instanciated from this class.
>>>>>
>>>>>Wouldn't that give me left, top in relation to container, instead of the screen ?
>>>>
>>>>Yes, but assuming that you have container properties too, the problem doesn't seem too complicated.
Previous
Reply
Map
View

Click here to load this message in the networking platform