Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Understanding ScaleMode and control coordinates
Message
From
15/09/2008 14:45:52
Dragan Nedeljkovich (Online)
Now officially retired
Zrenjanin, Serbia
 
General information
Forum:
Visual FoxPro
Category:
Other
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Vista
Network:
Windows 2008 Server
Database:
MS SQL Server
Miscellaneous
Thread ID:
01347419
Message ID:
01347728
Views:
24
This message has been marked as a message which has helped to the initial question of the thread.
>>Hi Dmitry,
>>
>>>How can I change the way the button coordinates are determined to make sure that the popup menu moves with the button?
>>
>>For the simple case of a container, you can add the top and left coordinates. As a generic solution that also works inside a pageframe use:
>>
>>	Local lnRow, lnColumn, lcName, loPos
>>	lcName = Sys(2015)
>>	Thisform.AddObject( m.lcName, "Commandbutton" )
>>	loPos = GetPem( Thisform, m.lcName )
>>	loPos.Move( Objtoclient(This,2), Objtoclient(This,1), This.Width, This.Height )
>>	Thisform.ScaleMode = 0
>>	lnRow = loPos.Top + loPos.Height
>>	lnColumn = loPos.Left
>>	Thisform.ScaleMode = 3
>>	Thisform.RemoveObject( m.lcName )
>>
>
>Hi Christof,
>
>Your approach works. Thank you very much. But I was wondering if it can be simplified. The way I understand your code works is you create (dynamically) a new commandbutton object and move it in place of the current one (where this code is executed). Then you get the position of this temporary commandbutton. What I am wondering is couldn't you just get the position of the current object position without creating a temporary one? But I am probably missing something because when I tried the following:
>
>
>loPos = GetPem( Thisform, this )
>
>
>I get error.

The second parameter is a string, the name of the object, relative to its immediate parent. If you're in a container on a page on a pageframe, you won't get anything, because your object is not a member of a form, it's parent, or parent's parent is.

getpem(thisform, this.name)

may work, but only if your object is directly on the form.

>The reason I wanted to avoid creating a temporary commandbutton is I am concerned that creating a new object (temporary commandbutton) every time user clicks on the button will "do something" (and I don't know what really) with memory.

A simple commandbutton, i.e. a baseclass, uses few dozen bytes of memory - its definition is already in there, as it is a base class, so it's only a block of memory to hold its properties. Which is actually very cheap, considering that it's invisible. If it but flickered for one frame, it would have consumed far more memory and CPU time.

back to same old

the first online autobiography, unfinished by design
What, me reckless? I'm full of recks!
Balkans, eh? Count them.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform