>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 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.
Thank you for your help!
"The creative process is nothing but a series of crises." Isaac Bashevis Singer
"My experience is that as soon as people are old enough to know better, they don't know anything at all." Oscar Wilde
"If a nation values anything more than freedom, it will lose its freedom; and the irony of it is that if it is comfort or money that it values more, it will lose that too." W.Somerset Maugham