REVO5500 h gridDrawer_0_7 2 @ W palette true --on closeStack -- lock screen -- lock messages -- topLevel this stack -- save this stack --end closeStack on closeStack --pass closeStack end closeStack on preOpenStack lock screen put the short name of this stack into tShortStackName send "palette stack" && tShortStackName to me in 2 milliseconds end preOpenStack on closeStackRequest lock screen -- lock messages -- topLevel this stack put the stackFileVersion into tstackFileVersion set the stackFileVersion to "5.5" save this stack set the stackFileVersion to tstackFileVersion put the long id of this stack into tLongID pass closeStackRequest end closeStackRequest 8 gridDrawer U Lucida Grande cREVLoadInfo revResumeStack false cRevOnline id 757 cREVGeometryCache stackID 1128 cREVGeneral breakpointconditions scripteditorvscroll 0scripteditorselection 399breakpoints breakpointstates stackfileversion 5.5scalefactor 1 card id 1002 P qon openCard set the behavior of group "showGridWidget" to the long id of btn "DragDropBehavior" end openCard Y : cREVGeometryCacheIDs 1389867959744 11101389867959745 11111389867959746 11121389867959747 11131389867959748 11141389577474058 10881389867959750 11161389867959749 11151389188546457 10131389867959751 11171389868630137 11241389704331334 10971389867953315 11071389187996795 10101389715975024 11001389868630121 11251389743059710 11051389868877947 11261389867953290 11081389868877948 11271389867959743 1109 cREVGeometrycache total 21order cREVGeneral scripteditorvscroll 0scripteditorselection 112 @ I L Q S about !` @ c cREVTable currentview Bernd Niggemann Jan 2014 to show a snap-to-grid grid in LiveCode drag/drop or copy group "showGridWidget" below to a card. It will then automatically create a backgroundPattern for the card with a grid. The button of the group will show "hide Grid". That button toggles the visible of the grid. Grid on/off button toggles snap-to grid Click gray circle with white x deletes widget from the card and restores background color if present. If you want you can put the stack into the plugins folder to access it from the development menu. Enter a number an hit return to change gid size. Changes preferences. Click on arrow to reduce/expand stack. To inspect this stack check 'select grouped controls" in the properties inspector cREVGeneral revUniqueID 1389187996795 Bernd Niggemann Jan-May 2014 bto show a snap-to-grid grid in LiveCode drag/drop or copy group "showGridWidget" below to a card. It will then automatically create a backgroundPattern for the card with a grid. The button of the group will show "hide Grid". That button toggles the visible of the grid. (Grid on/off button toggles snap-to grid fClick gray circle with white x deletes widget from the card and restores background color if present. bIf you want you can put the stack into the plugins folder to access it from the development menu. SEnter a number and hit return to change gid size. Changes preferences of Livecode. 'Click on arrow to reduce/expand stack. RTo inspect this stack check 'select grouped controls" in the properties inspector Hovering over gridDrawer will change from edit mode to browse mode to make it easier to change settings. Selected objects are stored and reselected after leaving gridDrawer and edit mode will be reinstated. MOnce the widget is placed on a card you can drag it around to fit your needs h ` o dragInfo 2 z cREVTable currentview [
drag/drop this group to a card
where you want to display a grid
<-
cREVGeneral revUniqueID 1389188546457 drag/drop this group to a card !where you want to display a grid <- @ DragDropBehavior Ep+## this script is a modification of the drag/drop script of Livecode stack "revTools" on mouseDown put the long id of the target into tTarget put findOwner(tTarget) into tTarget -- searches up to card level and backs down one level, works for groups and single controls if there is a stack "bnDragControl" then delete stack "bnDragControl" if the tool is not "browse tool" and the tool is not "pointer tool" then choose "pointer" tool end if local tDragFromStack put the short name of this stack into tDragFromStack local tShortName put the short name of tTarget into tShortName lock messages local tStartLoc put the screenMouseLoc into tStartLoc repeat -- check for some movement before drag local tNowLoc put the screenMouseLoc into tNowLoc if (abs(item 1 of tNowLoc - item 1 of tStartLoc) > 7) or (abs(item 2 of tNowLoc - item 2 of tStartLoc) > 7) then exit repeat else if the mouse is up then pass mouseDown next repeat end if end repeat reset the templateStack local tLoc put the mouseLoc into tLoc put globalLoc(tLoc) into tLoc set the name of the templateStack to "bnDragControl" set the visible of the templateStack to false set the backGroundColor of the templateStack to the hiliteColor set the decorations of the templateStack to "noShadow" set the style of the templateStack to "palette" -- DEBUG if the cWindowShape of tTarget is not empty then set the windowShape of the templateStack to the cWindowShape of tTarget else -- put "windowShape empty" end if set the blendLevel of the templateStack to 50 create stack set the defaultStack to "bnDragControl" -- OK-2007-11-30 : Refactored to external function local tObjectSize put the width of tTarget, the height of tTarget into tObjectSize -- put objectSize(tShortName) into tObjectSize local tWidth, tHeight put item 1 of tObjectSize into tWidth put item 2 of tObjectSize into tHeight set the minWidth of this stack to tWidth set the minHeight of this stack to tHeight set the width of this stack to tWidth + the cAddWidth of the target set the height of this stack to tHeight + the cAddHeight of the target copy tTarget to stack "bnDragControl" set the loc of control (the short name of tTarget) to the loc of this card set the loc of this stack to tLoc close stack "bnDragControl" show this stack go stack "bnDragControl" -- DEBUG -- put the windowShape of this stack # TH-2008-01-15 : Bug fix 4962 to prevent controls being dropped on stacks behind other stacks. # since dragging creates a temporary stack need to perform check to flag this as an invalid stack # for dropping controls onto local tAllStacks local tOpenStacks put the openStacks into tOpenStacks repeat for each line tStack in tOpenStacks if the short name of stack tStack is "bnDragControl" then next repeat end if if the visible of stack tStack and not the cantModify of stack tStack and the mode of stack tStack is 1 and tStack <> tDragFromStack then put the rect of stack tStack & tab & "valid" & tab & tStack & return after tAllstacks else put the rect of stack tStack & tab & "invalid" & tab & tStack & return after tAllstacks end if end repeat local tCurrentCursor put the cursor into tCurrentCursor local tCount put 0 into tCount local tStackShowing put empty into tStackShowing local tGridSize put the gridSize into tGridSize local tGrid put the grid into tGrid local tLeftCorrect put tWidth div 2 into tLeftCorrect local tTopCorrect put tHeight div 2 into tTopCorrect repeat put the screenMouseLoc into tNowLoc if tGrid and tStackShowing is not empty then local tStackTopLeft, tRight, tLeft # OK-2007-07-11 : This appears to be a bug, tStackTopLeft was being used without being initialised # So i added the initialisation, which was previously further down. put the topLeft of stack tStackShowing into tStackTopLeft put item 2 of tNowLoc - item 2 of tStackTopLeft - tTopCorrect into tRight put item 1 of tNowLoc - item 1 of tStackTopLeft - tLeftCorrect into tLeft put tLeft - (tLeft mod tGridSize) + item 1 of tStackTopLeft + tLeftCorrect into item 1 of tNowLoc put tRight - (tRight mod tGridSize) + item 2 of tStackTopLeft + tTopCorrect into item 2 of tNowLoc end if set the loc of this stack to tNowLoc add 1 to tCount if tCount is 12 then put 0 into tCount local tH put item 1 of tNowLoc into tH local tV put item 2 of tNowLoc into tV local tMatch put false into tMatch local tLineNo local tValid put validDropLocation(tAllStacks, tH, tV) into tValid put line 1 of tValid into tMatch put line 2 of tValid into tLineNo if tMatch then if tCurrentCursor is not 32 then set cursor to 32 put 32 into tCurrentCursor end if local tBorderStack set the itemdelimiter to tab put item 3 of line tLineNo of tAllStacks into tBorderStack set the itemdelimiter to comma if tBorderStack is not tStackShowing and there is a grc "revTempBorder" of stack tStackShowing then delete grc "revTempBorder" of stack tStackShowing if there is a grc "revTempBorder" of stack tBorderStack then next repeat set the rect of the templateGraphic to the rect of this cd of stack tBorderStack local tLineSize put the lineSize of the templateGraphic into tLineSize set the lineSize of the templateGraphic to 2 local tForeColor put the foreColor of the templateGraphic into tForeColor set the foreColor of the templateGraphic to the hiliteColor local tFilled put the filled of the templateGraphic into tFilled set the filled of the templateGraphic to false local tName put the short name of the templateGraphic into tName set the name of the templateGraphic to "revTempBorder" set the defaultStack to tBorderStack create grc set the lineSize of the templateGraphic to tLineSize set the foreColor of the templateGraphic to tForeColor set the filled of the templateGraphic to tFilled set the name of the templateGraphic to tName set the defaultStack to "bnDragControl" put tBorderStack into tStackShowing put the topLeft of stack tStackShowing into tStackTopLeft else if tCurrentCursor is not "arrow" then set cursor to arrow put "arrow" into tCurrentCursor -- remove drag border if present if there is a grc "revTempBorder" of stack tStackShowing then delete grc "revTempBorder" of stack tStackShowing put empty into tStackShowing end if end if local tExit if tExit then exit repeat end if if the mouse is up then put true into tExit end repeat if there is a grc "revTempBorder" of stack tStackShowing then delete grc "revTempBorder" of stack tStackShowing end if set cursor to arrow delete this stack if there is a stack "bnDragControl" then delete stack "bnDragControl" end if reset the templateStack put the screenMouseLoc into tNowLoc if tGrid and tStackShowing is not empty then put item 1 of tNowLoc - item 1 of tStackTopLeft - tLeftCorrect into tLeft put item 2 of tNowLoc - item 2 of tStackTopLeft - tTopCorrect into tRight put tLeft - (tLeft mod tGridSize) + item 1 of tStackTopLeft + tLeftCorrect into item 1 of tNowLoc put tRight - (tRight mod tGridSize) + item 2 of tStackTopLeft + tTopCorrect into item 2 of tNowLoc end if put item 1 of tNowLoc into tH put item 2 of tNowLoc into tV put false into tMatch put validDropLocation(tAllStacks, tH, tV) into tValid put line 1 of tValid into tMatch put line 2 of tValid into tLineNo if tMatch then local tDefaultStack set the itemdelimiter to tab put item 3 of line tLineNo of tAllStacks into tDefaultStack set the itemdelimiter to comma else put empty into tDefaultStack end if if the number of words in revFilterStacksList(tDefaultStack) is 0 then beep exit mouseDown end if unlock messages set the defaultStack to tDefaultStack put localLoc(tNowLoc) into tNowLoc -- select tTarget copy tTarget to stack tDefaultStack --paste put it into tObject -- put the long name of the selectedObject into tObject -- last control is part of the group hence owner of set the loc of tObject to tNowLoc select empty if the altKey is not down then choose pointer tool select tObject end if if the left of tObject < 0 then set the left of tObject to 0 end if if the top of tObject< 0 then set the top of tObject to 0 end if end mouseDown # TH-2008-01-15 : Bug fix 4962 to prevent controls being dropped on stacks behind other stacks. # Parameters # pStacks : return delimited list of open stacks, with each item being