leAttachFig

P

PolyPusher

Guest
All,

I have some code(didn't write it) that is bound to the keyboard and
moves data around that is selected. The issue that I am seeing is if
there is text, etc that is attached(leAttachFig) to another object and
both are selected(object and text) then the text moves once with the
object and again after that. So, is there away to "see" the attached
data and not move it, just have it move with the object?

Thank you in advance for any help,
Eric




procedure( MyyMoveRelativeDOWN(); use users y with a minus, zero
out x with var ZeroX
let((i)
foreach(i geGetSelectedSet()
if( geIsFigPartiallySelected(i) then ;( i ~>
shape || i ~> path ) then
leStretchShape( i list( ZeroX -Myy )
geGetSelSetFigPoint( i ) t )
else
dbMoveFig( i nil list( list( ZeroX -
Myy ) "R0" ) )
)
)
)
printf("You have moved objects down %L\n" Myy)
)
 
Hi PolyPusher,

Just additional info for you. You can find whether the object is
attached or not by seeking for its property.

objectId~>parent = nil ( not attached )
objectId~>parent = dbxxxxx ( attached )

You may use this info to do some checking before moving it.

Regards,
How
 
On Jun 17, 7:50 pm, "KB.How" <kianboon....@gmail.com> wrote:
Hi PolyPusher,

Just additional info for you. You can find whether the object is
attached or not by seeking for its property.

objectId~>parent = nil ( not attached )
objectId~>parent = dbxxxxx ( attached )

You may use this info to do some checking before moving it.

Regards,
How
How,

I was able to update the code to not move a "child" object by checking
to see if there is a parent, now there is the case where if the user
selects attached data (child object) the code reports that I moved
something but didn't! Basically, the code as I have it moves only
the parents and children ride for free ;)

It seems I need to

1.Move the parent if the parent and child is selected.

2.When the parent is not selected but the child is, move the child.

Remember, my original case was the code moved the attached("child
data") and it got moved again when the parent moved.

Any ideas?

Thank you for your help, really appreciate it!
Eric




procedure( OneManGridMoveRelativeRIGHT()
let((i)
foreach(i geGetSelectedSet()
if( geIsFigPartiallySelected(i) &&
i~>parent==nil then
leStretchShape( i list( OneManGridX
ZeroY ) geGetSelSetFigPoint( i ) t )
else
if(i~>parent==nil
dbMoveFig( i nil list( list
( OneManGridX ZeroY ) "R0" ) ))

)
)
)
printf("You have moved objects right %L\n" OneManGridX)
)
 
Hi PolyPusher,

When the object is attached to each other, when you move the parent,
the attached child will move together with the parent as well. And
when you move the child, the parent will remain not move. To avoid
moving object (child) for 2 times, you need to store the parent db
into a list and check each object before moving them.

I did some modification for the code, when the object has parent and
parent is selected, then move the parent ( child will move along with
parent), if not, move only the child.

* I was in hurry and doesn't not test the code yet, do testing before
use k. Thanks

procedure( OneManGridMoveRelativeRIGHT(@optional (cv geGetEditCellView
()))
let((i moveItems)

;----------------------------------------------
; Process each selected object
;----------------------------------------------
foreach(obj geGetSelectedSet()

;-----------------------------------------------------------------------
; Stretch the shape is object is partially selected
; and no attached to any parent
;-------------------------------------------------------------------------
      if( geIsFigPartiallySelected(obj) && obj~>parent then
        leStretchShape( obj list( OneManGridX ZeroY )
geGetSelSetFigPoint( obj ) t )
else
;-------------------------------------------------------------
; Process object when not in move item list
;-------------------------------------------------------------
unless( member(obj moveItems)
;------------------------------------------------------------------------------------------------
; If attached to parent, check whether the parent
is selected or not
; If selected, move the parent, and the child will
move along as well
;--------------------------------------------------------------------------------------------------
if( obj~>parent && geIsFigSelected(obj~>parent)
then
dbMoveFig( obj~>parent cv list( list
( OneManGridX ZeroY )  "R0" ) )
moveItems = cons(obj~>parent moveItems)
else
dbMoveFig( obj cv list( list ( OneManGridX
ZeroY ) "R0" ) )
);if

;-----------------------------------------------------
; Store moved items into a list
;------------------------------------------------------
moveItems = cons(obj moveItems)
);unless
);if
);foreach

printf("You have moved objects right %L\n" OneManGridX)
);let
);proc



Regards,
How
 
On Jun 18, 8:15 pm, "KB.How" <kianboon....@gmail.com> wrote:
Hi PolyPusher,

When the object is attached to each other, when you move the parent,
the attached child will move together with the parent as well. And
when you move the child, the parent will remain not move. To avoid
moving object (child) for 2 times, you need to store the parent db
into a list and check each object before moving them.

I did some modification for the code, when the object has parent and
parent is selected, then move the parent ( child will move along with
parent), if not, move only the child.

* I was in hurry and doesn't not test the code yet, do testing before
use k. Thanks

procedure( OneManGridMoveRelativeRIGHT(@optional (cv geGetEditCellView
()))
    let((i moveItems)

        ;----------------------------------------------
        ; Process each selected object
        ;----------------------------------------------
        foreach(obj geGetSelectedSet()

           ;-----------------------------------------------------------------------
           ; Stretch the shape is object is partially selected
           ; and no attached to any parent
           ;-------------------------------------------------------------------------
           if( geIsFigPartiallySelected(obj) && obj~>parent then
              leStretchShape( obj list( OneManGridX ZeroY )
geGetSelSetFigPoint( obj ) t )
            else
                ;-------------------------------------------------------------
                ; Process object when not in move item list
                ;-------------------------------------------------------------
                unless( member(obj moveItems)
                    ;--------------------------------------------------------------------------­----------------------
                    ; If attached to parent, check whether the parent
is selected or not
                    ; If selected, move the parent, and the child will
move along as well
                    ;--------------------------------------------------------------------------­------------------------
                    if( obj~>parent && geIsFigSelected(obj~>parent)
then
                        dbMoveFig( obj~>parent cv list( list
( OneManGridX ZeroY )  "R0" ) )
                        moveItems = cons(obj~>parent moveItems)
                    else
                        dbMoveFig( obj cv list( list ( OneManGridX
ZeroY )  "R0" ) )
                    );if

                    ;-----------------------------------------------------
                    ; Store moved items into a list
                    ;------------------------------------------------------
                    moveItems = cons(obj moveItems)
                );unless
            );if
        );foreach

        printf("You have moved objects right %L\n" OneManGridX)
    );let
);proc

Regards,
How
How,

I was able to get some of the code working(I obviously am still a
begineer).

Now I have the following.

If the child data is selected, it is moved.

If parent is selected it moves and the attached moves with it

BUT if the parent and the child is selected, they are both moved
TWICE.

I think that the if then else is not quit right, I may have goofed it
up.

I know I am asking alot, but could you help me get over this hurdle?

Thank you,
Eric




procedure(OneManGridMoveRelativeRIGHT(@optional (cv geGetEditCellView
()))
let((i moveItems)
;----------------------------------------------
; Process each selected object
;----------------------------------------------
foreach(obj geGetSelectedSet()
;-----------------------------------------------------------------------
; Stretch the shape if object is partially selected
; and not attached to any parent
;-------------------------------------------------------------------------
if(geIsFigPartiallySelected(obj) && obj~>parent==nil then
leStretchShape(obj list(OneManGridX ZeroY)
geGetSelSetFigPoint( obj ) t )
else
;-------------------------------------------------------------
; Process object when not in move item list
;-------------------------------------------------------------
unless(member(obj moveItems)
;--------------------------------------------------------------------------­----------------------
; If attached to parent, check whether the parent
is selected or not
; If selected, move the parent, and the child will
move along as well
;--------------------------------------------------------------------------­------------------------
if( obj~>parent && geIsFigSelected(obj~>parent)
then
dbMoveFig(obj~>parent cv list(list(OneManGridX
ZeroY) "R0" ))
moveItems = cons(obj~>parent moveItems)
else
dbMoveFig(obj cv list(list(OneManGridX ZeroY)
"R0" ))
);if
;-----------------------------------------------------
; Store moved items into a list
;------------------------------------------------------
moveItems = cons(obj moveItems)
);unless
);if
);foreach
printf("You have moved objects right %L\n" OneManGridX)
);let
);proc
 

Welcome to EDABoard.com

Sponsor

Back
Top