Page 1 of 1

Problems with the location of an object

Posted: Wed Nov 21, 2012 5:56 am
by planix
Hi All,

I am trying to find out if a locked text field is within the boundaries of a graphic.

I am using drag and drop functionality.

If the locked text field is placed slightly outside of the graphic I want to move it so it lies within the graphic.

The problem I have is that when I check the location of the locked text field I get very odd numbers. Even when I nudge the field right up to the edge of the graphic the numbers don't always match up.

I have put the following into the dragDrop handler of the graphic to allow me to see something of what is going on

Code: Select all

 if the dragDestination is not empty then
      if the topleft of the dragSource is not within the rect of the dragDestination then
      put the short id of the dragSource & ":TOPLEFT SOURCE " & the topleft of the dragSource & "| " & the short id of the dragDestination & ": TOPLEFT DESTINATION " & the topleft of the dragDestination
I get the following when the source (the locked field) is nudged right up to the left of the destination (the graphic).
1006:TOPLEFT SOURCE 359,49| 1025: TOPLEFT DESTINATION 14,218
This isn't making any sense to me since I would have thought the topLeft of the field would have to be something close to the topleft of the graphic. And it simply is not.

The only thing that can be happening is that the field is referencing it's zero point from a different referent. Is that possible. I thought all the controls on a card referenced to the topleft and bottomright of the card rect?

I am using a dual screen extended display but I would have thought all this location stuff was internal to the card/stack location.

Any thoughts?

Re: Problems with the location of an object

Posted: Wed Nov 21, 2012 11:31 am
by Klaus
Hi planox,

sounds like this might just be a misunderstanding of "the dragsource"!?

"the dragsource" <> "the dragdata", which means "the dragsource" is the object where you start your
DRAGging from and it STAYS at its loc, only "the dragdata" are "moving" and being DROPped.
You are actually NOT dragging the dragsource! Know what I mean?

But maybe I know too little about what you are actually doing.

What is the dragsource, what the dragdata etc?
Maybe you better use "on mousedown; grab me, end mousedown" to be able to "drag" an object around
on your card and check its loc "on mouseup" in the same script?


Best

Klaus

Re: Problems with the location of an object

Posted: Thu Nov 22, 2012 6:34 am
by planix
hi,

Thanks for that.

I take your point. I have started scripting this without using the Drag Drop stuff. It is going much better

cheers