Last active
September 22, 2022 14:45
-
-
Save CarlTBarnes/a2d910ecea78d4d3ddea6201ee72adba to your computer and use it in GitHub Desktop.
GROUP Move and also All Child Controls X,Y Position
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
!When a GROUP X/Y Position is changed it does NOT move the Child Controls | |
!This loops through the child controls and moves each one | |
! | |
!The XAdjust / YAdjust parameters allow some extra move from the TO Control X/Y | |
!------------------------------------------------------------------------------------ | |
MAP | |
GroupMoveChildren(LONG FromGroup, LONG ToControl, LONG XAdjust=0, LONG YAdjust=0) | |
END | |
!------------------------------------------------------------------------------------ | |
GroupMoveChildren PROCEDURE(LONG FrmGrp, LONG ToGrp, LONG XAdjust=0, LONG YAdjust=0) | |
DX LONG,AUTO !Destination (To X), then Delta X | |
DY LONG,AUTO | |
FX LONG,AUTO | |
FY LONG,AUTO | |
ChildNdx LONG,AUTO | |
ChildFEQ LONG,AUTO | |
CODE | |
IF ToGrp THEN | |
GETPOSITION(ToGrp,DX,DY) | |
ELSE | |
DX=0 ; DY=0 !Did not pass ToControl so just Adjust | |
END | |
DX+=XAdjust ; DY+=YAdjust | |
GETPOSITION(FrmGrp,FX,FY) | |
SETPOSITION(FrmGrp,DX,DY) | |
DX -= FX ; DY -= FY !Delta X/Y to apply to each Child | |
LOOP ChildNdx=1 TO 999 | |
ChildFEQ=FrmGrp{PROP:Child,ChildNdx} | |
IF ~ChildFEQ THEN BREAK. | |
GETPOSITION(ChildFEQ,FX,FY) | |
SETPOSITION(ChildFEQ,FX+DX,FY+DY) | |
END | |
RETURN | |
!This does not move other Parent controls with Children inside the GROUP because PROP:Child does not see them. | |
!E.g. a GROUP can have a GROUP, OPTION or SHEET as a Child that contains child controls inside that. | |
!Should be able to spot that PROP:TYPE and make a Recursive call passing (ChildFEQ,0,Dx,Dy) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment