hi Herman,
test code is below. It enables dragging of a GUI button pack. You can change the thickness of the âdragging border rimâ in the param window. For me it works good enough but if anyone can make it better please go ahead 
// Test Code: Drag GUI Button-Pack using mouse, E.M.Pottasch, 8/10/2017
// Button pack can be dragged smoothly with the left mouse button pushed
// down in the border area, but will finally settle in nearest Row and
// Column once the left mouse button is lifted
Version( 6.25 );
GfxSetCoordsMode( 0 );
RequestMouseMoveRefresh();
GfxSetZOrder( 2 );
reset = ParamTrigger( "Reset Button Pack Position", "Press Here" );
//DragLock = ParamToggle( "Lock Dragging of Buttons", "On|Off", 1 );
CellHeight = Param( "Cell Height (Pixels)", 20, 5, 200, 1 );
CellWidth = Param( "Cell Width (Pixels)", 95, 5, 200, 1 );
CellXSpace = Param( "Space Between Buttons X Direction (Pixels)", 0, 0, 50, 1 );
CellYSpace = Param( "Space Between Buttons Y Direction (Pixels)", 0, 0, 50, 1 );
transx = Param( "Small Move Button Pack along X-Axis (Pixels)", 0, 0, 2000, 1 );
transy = Param( "Small Move Button Pack along Y-Axis (Pixels)", 0, 0, 2000, 1 );
DragBorderWidth = Param( "Drag Border Width (Pixels)", 10, 0, 500, 1 );
rm = RadioButtonLeftMargin = Param( "Radion Button Left Margin (Pixels)", 2, 0, 10, 1 );
FontPointsize = Param( "Font Pointsize", 10, 1, 50, 1 );
FontType = ParamList( "Font Type", "Segoe UI|Tahoma|Arial|Arial Black|Verdana|Courier New|Times New Roman|Lucida Sans Unicode|Trebuchet MS|Lucida Console", 3 );
ButtonclrBack = ParamColor( "Button Back Color", ColorRGB( 254, 254, 0 ) );
per1 = Param( "Period 1", 20, 1, 500, 1 );
per2 = Param( "Period 2", 80, 1, 500, 1 );
per3 = Param( "Period 3", 110, 1, 500, 1 );
per4 = Param( "Period 4", 150, 1, 500, 1 );
per5 = Param( "Period 5", 210, 1, 500, 1 );
cid = NumToStr( GetChartID() ) + "ProgramName";
id_1 = 40;
id_2 = 41;
id_3 = 42;
id_4 = 43;
id_5 = 44;
GuiSetFont( FontType, FontPointsize );
id0 = GuiGetEvent( 0, 0 );
id1 = GuiGetEvent( 0, 1 ); // returns notify flag (1 ==> click event)
clickevent = id1 == 1;
x0 = transx;
y0 = transy;
GfxSelectSolidBrush( ButtonclrBack );
pp = 0;
nn = 1;
for( i = id_1; i <= id_5; i++ )
{
GuiRadio( "Radio " + i, i, x0 + ( CellWidth + CellXSpace ) * ( Nz( StaticVarGet( "Column" + cid ) ) + 0 ), y0 + ( CellHeight + CellYSpace ) * ( Nz( StaticVarGet( "Row" + cid ) ) + nn ), CellWidth, CellHeight, 1 );
x1 = x0 + ( CellWidth + CellXSpace ) * ( Nz( StaticVarGet( "Column" + cid ) ) + 0 ) - rm;
y1 = y0 + ( CellHeight + CellYSpace ) * ( Nz( StaticVarGet( "Row" + cid ) ) + nn ) - ( CellYSpace + 0 );
x2 = x1 + CellWidth + rm;
y2 = y1 + CellHeight + ( CellYSpace + 0 );
x3 = 0;
y3 = 0;
GfxRoundRect( x1, y1, x2, y2, x3, y3 );
if( i == id_1 )
{
xmin = x1 - DragBorderWidth;
ymin = y1 - DragBorderWidth;
}
if( i == id_5 )
{
xmax = x2 + DragBorderWidth;
ymax = y2 + DragBorderWidth;
}
nn++;
}
// at startup
if( Nz( StaticVarGet( "startval" ) ) == 0 )
{
prevcheck = 0;
for( i = id_1; i <= id_5; i++ )
{
if( Nz( StaticVarGet( "StaticGuiGetCheck" + cid + i ) ) == 1 )
{
GuiSetCheck( i, 1 );
prevcheck = 1;
}
else
{
GuiSetCheck( i, 1 );
}
}
if( prevcheck == 0 )
{
GuiSetCheck( id_1, 1 );
StaticVarSet( "StaticGuiGetCheck" + cid + id_1, 1, 1 );
}
Say( "startup" );
StaticVarSet( "startval", 1 );
StaticVarSet( "DragToggle" + cid, 0 );
// if column and row not already set at startup then set both to 0
if( Nz( StaticVarGet( "Column" + cid ) ) == 0 )
{
StaticVarSet( "Column" + cid, 0, 1 );
}
if( Nz( StaticVarGet( "Row" + cid ) ) == 0 )
{
StaticVarSet( "Row" + cid, 0, 1 );
}
}
DragToggle = StaticVarGet( "DragToggle" + cid );
if( Nz( StaticVarGet( "DragClicked" + cid ) ) )
{
if( Nz( StaticVarGet( "DragToggle" + cid ) ) )
{
StaticVarSet( "DragToggle" + cid, 0 );
StaticVarSet( "DragClicked" + cid, 0 );
}
else
{
StaticVarSet( "DragToggle" + cid, 1 );
StaticVarSet( "DragClicked" + cid, 0 );
}
}
if( reset == 1 )
{
StaticVarSet( "Column" + cid, 0, 1 );
StaticVarSet( "Row" + cid, 0, 1 );
Say( "Reset Button Pack Position" );
RequestTimedRefresh( 0.1 ); // force chart refresh
}
// radio button toggle
if( clickevent )
{
for( i = id_1; i <= id_5; i++ )
{
if( i == id0 )
{
GuiSetCheck( i, 1 );
StaticVarSet( "StaticGuiGetCheck" + cid + i, 1, 1 );
Say( "set radio button number" + i );
}
else
{
GuiSetCheck( i, 0 );
StaticVarSet( "StaticGuiGetCheck" + cid + i, 0, 1 );
}
}
}
// set radio button at each refresh (possibly no longer needed in next beta)
for( i = id_1; i <= id_5; i++ )
{
GuiSetCheck( i, Nz( StaticVarGet( "StaticGuiGetCheck" + cid + i ) ) );
}
function OnLMouseButton( px, py )
{
StaticVarSet( "startpx" + cid, px );
StaticVarSet( "startpy" + cid, py );
if( px > xmin AND px < xmax AND py > ymin AND py < ymax )
{
StaticVarSet( "DragClicked" + cid, 1 );
}
}
function OnLButtonIsDown( px, py )
{
Col0 = StaticVarGet( "Column" + cid );
Row0 = StaticVarGet( "Row" + cid );
spx = StaticVarGet( "startpx" + cid );
spy = StaticVarGet( "startpy" + cid );
dpx = ( px - spx );
dpy = ( py - spy );
dCol = ( dpx / CellWidth );
dRow = ( dpy / CellHeight );
StaticVarSet( "Column" + cid, Max( 0, ( dCol + Col0 ) ), 1 );
StaticVarSet( "Row" + cid, Max( 0, ( dRow + Row0 ) ), 1 );
StaticVarSet( "startpx" + cid, px );
StaticVarSet( "startpy" + cid, py );
}
if( DragToggle )
{
GfxSetZOrder( 1 );
GfxSelectSolidBrush( ColorRGB( 0, 0, 254 ) );
GfxRoundRect( xmin, ymin, xmax, ymax, 0, 0 );
GfxSetZOrder( 0 );
}
function OnHoverMouse( px, py )
{
GfxSetZOrder( 1 );
GfxSelectSolidBrush( ColorRGB( 0, 254, 0 ) );
GfxRoundRect( xmin, ymin, xmax, ymax, 0, 0 );
GfxSetZOrder( 0 );
}
function EventHandler()
{
b = GetCursorMouseButtons();
px = GetCursorXPosition( 1 );
py = GetCursorYPosition( 1 );
if( b & 8 )
{
if( b & 1 ) OnLMouseButton( px, py );
}
else
{
if( b == 0 )
{
if( px > xmin AND px < xmax AND py > ymin AND py < ymax )
{
OnHoverMouse( px, py );
}
// settle button pack to the nearest Row and Column
StaticVarSet( "Column" + cid, round( Nz( StaticVarGet( "Column" + cid ) ) ), 1 );
StaticVarSet( "Row" + cid, round( Nz( StaticVarGet( "Row" + cid ) ) ), 1 );
StaticVarSet( "DragToggle" + cid, 0 );
//_TRACE("px: " + px + " py: " + py );
}
if( b == 1 AND DragToggle ) OnLButtonIsDown( px, py );
}
}
EventHandler();
GraphXSpace = 5;
SetChartBkColor( ColorBlack );
SetChartOptions( 0, chartShowDates );
SetBarFillColor( IIf( C > O, ColorRGB( 0, 75, 0 ), IIf( C <= O, ColorRGB( 75, 0, 0 ), colorLightGrey ) ) );
Plot( C, "", IIf( C > O, ColorRGB( 0, 250, 0 ), IIf( C <= O, ColorRGB( 250, 0, 0 ), colorLightGrey ) ), 64, Null, Null, 0, 0, 1 );
for( i = id_1; i <= id_5; i++ )
{
gc = GuiGetCheck( i );
if( gc == 1 AND i == 40 )
{
pp = per1;
}
if( gc == 1 AND i == 41 )
{
pp = per2;
}
if( gc == 1 AND i == 42 )
{
pp = per3;
}
if( gc == 1 AND i == 43 )
{
pp = per4;
}
if( gc == 1 AND i == 44 )
{
pp = per5;
}
}
if( pp > 0 )
Plot( MA( C, pp ), "", colorYellow, styleLine | styleNoRescale, Null, Null, 0, 0, 1 );
Title = "Test Code [ Move Button Pack ]";