LiquidCode Moderator Team
Joined: 05 Dec 2000 Posts: 1751 Location: Space and Time
|
Posted: Sat May 14, 2011 4:06 pm Post subject: Dialog Element Mover |
|
|
I had a big dialog with a lot of elements and I wanted to move all of them over. I didn't want to go and do the math or use dialog designer and move each element. I decided to make a quick app that did the moving for me.
Just copy your dialog code and paste it into the edit box. Use the TOP and LEFT spin elements to "move" the elements. You can enter negative number to move them LEFT or UP.
EDIT: Small bug in %%TheRest fixed
Code: |
#Created by Chris Gingerich (AKA LiquidCode)
option decimalsep,"."
option scale,96
Title Dialog Element Mover
DIALOG CREATE,Dialog Element Mover,-1,0,540,292
REM *** Modified by Dialog Designer on 5/14/2011 - 10:58 ***
DIALOG ADD,GROUP,GROUP1,5,4,533,233,Dialog code to "move"
DIALOG ADD,EDIT,code,21,11,519,211,,,MULTI,SCROLL
DIALOG ADD,TEXT,TEXT2,245,5,,,Top:
DIALOG ADD,SPIN,top,242,45,70,24,,0
DIALOG ADD,TEXT,TEXT4,247,133,,,Left:
DIALOG ADD,SPIN,left,242,176,70,24,,0
DIALOG ADD,BUTTON,Move,255,269,64,24,Move!
DIALOG ADD,TEXT,TEXT1,270,47,,,Negative values can be entered
DIALOG ADD,LINE,LINE1,238,347,1,54
DIALOG ADD,BUTTON,Copy,241,381,133,24,Copy to clipboard
DIALOG ADD,BUTTON,paste,266,381,133,24,Paste from clipboard
DIALOG SHOW
:evloop
wait event
%e = @event()
goto %e
:Close
stop
:PasteBUTTON
dialog set,code,@clipbrd()
goto evloop
:CopyBUTTON
clipboard set,@dlgtext(code)
goto evloop
:MoveButton
if @not(@dlgtext(code))
Warn Please copy and paste only code of elements to move.
goto evloop
end
%%left = @dlgtext(left)
%%top = @dlgtext(top)
%%oc = @new(list)
%%NewCode = @new(list)
list assign,%%oc,@trim(@dlgtext(code))
option fieldsep,","
%x = 0
repeat
parse "%a;%b;%c;%d;%e;%f;%g",@item(%%oc,%x)
%%TheRest = @trim(@strslice(@item(%%oc,%x),%a","%b","%c","%d","%e","%f","%g","))
if @equal(@trim(%a),Dialog Add)
%d = @sum(%%top,%d)
%e = @sum(%%left,%e)
list add,%%NewCode,%a","%b","%c","%d","%e","%f","%g","%%TheRest
else
list add,%%NewCode,@item(%%oc,%x)
end
%x = @succ(%x)
until @equal(%x,@count(%%oc))
dialog set,code,@text(%%NewCode)
list close,%%NewCode
List close,%%oc
goto evloop
|
_________________ Chris
Http://theblindhouse.com |
|