View previous topic :: View next topic |
Author |
Message |
Skit3000 Admin Team
Joined: 11 May 2002 Posts: 2166 Location: The Netherlands
|
Posted: Sun Sep 22, 2002 5:51 pm Post subject: Another new element: Multi Document Interface |
|
|
Hey,
Another new dialog element, this time one for making a Multi Document Interface!
There are still a lot of bugs in it, but who cares?
Code: |
rem This code only supports a maximum of 5 windows...
rem Before making a new Window you must move the old one to the right, so
rem that elements of the new window don't get 'sticky' and stay in a wrong one.
DIALOG CREATE,Multi Document Interface,-1,0,681,360
rem If you get the REM lines in :Createwindow working, you can remove
rem the next:
DIALOG ADD,STYLE,TITLESTYLE,Courier New,,B,,WHITE
DIALOG ADD,STYLE,BACKGROUNDSTYLE,,,,GRAY,
DIALOG ADD,GROUP,BACKGROUNDGROUP,28,0,682,314,,,BACKGROUNDSTYLE
DIALOG ADD,MENU,File,New,Open,Save,Save As,Close,-,Exit
DIALOG ADD,MENU,Extra
DIALOG ADD,MENU,Help,About,Help
DIALOG ADD,GROUP,MENUGROUP,0,0,682,28
DIALOG ADD,BUTTON,NEW,2,2,64,24,New
DIALOG ADD,BUTTON,OPEN,2,70,64,24,Open
DIALOG ADD,BUTTON,SAVE,2,138,64,24,Save
DIALOG ADD,STATUS,STATUS1
DIALOG ADD,TEXT,TEXT1,8,426,,,TEXT1,,STYLE1
DIALOG SHOW
rem Name |number|top|left|wid|hei|value|close?|styles
%%MDISettings = WINDOW1|1 |50 |50 |250|200| |close |multi|wrap|scroll|tabs
rem Number is the window number. You can use random ones.
rem In value you can give up the value that the edit must have.
rem The Close parameter is to give the window a Close-button. When pressed, it makes a
rem WindownameCLOSEBUTTON event.
rem The Styles are the styles for the edit box.
gosub Createwindow
:Evloop
wait event
%%event = @event()
goto %%event
:NewBUTTON
:NewMENU
%%MDISettings = Window@succ(%%number)|@succ(%%number)|50|@fadd(50,%%number)|250|200||close|multi|wrap|scroll|tabs
gosub Createwindow
goto evloop
:OpenBUTTON
:OpenMENU
%%file = @filedlg()
if @not(@equal(%%file,))
list create,9
list loadfile,9,%%file
%%MDISettings = Window@succ(%%number)|@succ(%%number)|50|@fadd(50,%%number)|250|200||close|multi|wrap|scroll|tabs
gosub Createwindow
%%var1 = 0
repeat
dialog set,%%name"EDIT",@dlgtext(%%name"EDIT")@cr()@chr(10)@item(9,%%var1)
%%var1 = @succ(%%var1)
until @equal(%%var1,@count(9))
list close,9
dialog set,%%name"TITLE",@name(%%file)
end
goto evloop
:SaveBUTTON
:SaveMENU
:Save AsMENU
%%file = @filedlg(,,,SAVE)
if @not(@equal(%%file,))
list create,9
list add,@dlgtext(%%name"EDIT")
list close,9
end
goto evloop
:CloseMENU
dialog remove,%%name
goto evloop
:ExitMENU
goto Close
exit
:AboutMENU
:HelpMENU
info Maybe another time??? Made by Skit 3000.
goto evloop
:Window1CLOSEBUTTON
:Window2CLOSEBUTTON
:Window3CLOSEBUTTON
:Window4CLOSEBUTTON
:Window5CLOSEBUTTON
rem Use this to remove a MDI-window
dialog remove,@substr(%%event,1,@pred(@pos(CLOSEBUTTON,%%event)))
goto evloop
:Close
exit
rem -------------------------------------------------------------------------
rem The next is to move a Window. You can make it very short by making a routin in
rem the Evloop...
:Window1gradientbarclick
:Window1titleclick
%%MDIWindowname = Window1
goto Movewindow
:Window2titleclick
:Window2gradientbarclick
%%MDIWindowname = Window2
goto Movewindow
:Window3titleclick
:Window3gradientbarclick
%%MDIWindowname = Window3
goto Movewindow
:Window4titleclick
:Window4gradientbarclick
%%MDIWindowname = Window4
goto Movewindow
:Window5titleclick
:Window5gradientbarclick
%%MDIWindowname = Window5
goto Movewindow
:Movewindow
rem This moves the window, that must be named in %%MDIWindowname
%%beginx = @fadd(@dlgpos(%%MDIWindowname,L),@dlgpos(,L))
%%beginy = @fadd(@dlgpos(%%MDIWindowname,T),@dlgpos(,T))
repeat
dialog setpos,%%MDIWindowname,@diff(@mousepos(Y),%%beginy),@diff(@mousepos(X),%%beginx)
until @event()
goto evloop
:Createwindow
option fieldsep,|
parse "%%name;%%number;%%top;%%left;%%width;%%height;%%value;%%close;%%style1;%%style2;%%style3;%%style4;%%style5",%%MDISettings
DIALOG ADD,GROUP,%%name,%%top,%%left,%%width,%%height
DIALOG ADD,GRADIENT,%%name"GRADIENTBAR",%%top,@succ(%%left),@diff(%%width,2),20,404040,BLUE,,LEFTTORIGHT,CLICK
DIALOG ADD,EDIT,%%name"EDIT",@fadd(%%top,19),%%left,%%width,@diff(%%height,19),%%value,,%%style1,%%style2,%%style3,%%style4,%%style5
DIALOG ADD,STYLE,%%name"TOPSTYLE",Courier New,10,B,C
rem Next 2 lines don't work... Don't know why...
rem DIALOG ADD,STYLE,%%name"TITLESTYLE",Courier New,,B,,WHITE
rem DIALOG ADD,TEXT,%%name"TITLE",@fadd(%%top,3),@fadd(%%left,10),,,%%name,,%%name"TITLESTYLE",TRANSPARENT
rem That's why I made the next one...
DIALOG ADD,TEXT,%%name"TITLE",@fadd(%%top,3),@fadd(%%left,10),,,%%name,,TITLESTYLE,TRANSPARENT,CLICK
if @equal(%%close,close)
DIALOG ADD,BUTTON,%%name"CLOSE",@fadd(%%top,2),@fadd(%%left,@diff(%%width,20)),17,15,X,Close,%%name"TOPSTYLE"
end
exit |
|
|
Back to top |
|
|
Tommy Admin Team
Joined: 16 Nov 2002 Posts: 746 Location: The Netherlands
|
Posted: Sun Sep 22, 2002 6:39 pm Post subject: |
|
|
I must say that apart from the bugs this is an amazing piece of code! Good job, Skit. |
|
Back to top |
|
|
LiquidCode Moderator Team
Joined: 05 Dec 2000 Posts: 1751 Location: Space and Time
|
Posted: Tue Sep 24, 2002 12:25 pm Post subject: |
|
|
I need a MDI for my next program. I decided to
create one of my own. Skit did a great job and that is what made
me create this one. This allows an unlimited ammount of windows
and you click and drag the windows to move them. Maximize, restore
and close work as well. I am also going to be working on Minimize and
resizeable windows. This code only works with VDS 4.x but
could be altered to work with VDS 3.x.
Code: |
rem List 1 holds the window info
list create,1
dialog CREATE,MDI,-1,0,560,390,Class MDI,resizable
dialog ADD,STYLE,Title,,,,,WHITE
dialog ADD,STYLE,back_style1,,,,GRAY,
dialog ADD,MENU,File,New Window,Exit
dialog ADD,PROGRESS,back,0,0,560,390,0,,back_style1
dialog SHOW
gosub makewindow
:evloop
wait event
%e = @event()
option fieldsep,_
parse "%a;%b",%e
option fieldsep,|
if @equal(%a,WinTopMove)
goto Move
end
if @equal(%a,WinClose)
goto WinClose
end
if @equal(%a,WinMax)
goto WinMax
end
goto %e
:resize
parse "%c;%d",@winpos(#MDI,WH)
dialog SETPOS,back,0,0,@diff(%c,8),@diff(%d,46)
goto evloop
:ExitMenu
:close
stop
:WinClose
dialog remove,Window_%b_
%m = @match(1,Window_%b)
if %m
list delete,1
end
goto evloop
:WinMax
list seek,1,0
%m = @match(1,Window_%b)
if %m
parse "%u;%v;%w;%x;%y;%z",@item(1)
if %z
dialog remove,Window_%b_
dialog ADD,GROUP,window_%b_,@sysinfo(screenheight),@sysinfo(screenwidth),256,172
dialog ADD,GRADIENT,WinTop_%b_,@sum(@sysinfo(screenheight),2),@sum(@sysinfo(screenwidth),2),252,20,BLACK,BLUE,,LEFTTORIGHT
dialog add,text,WinTitle_%b_,@sum(@sysinfo(screenheight),6),@sum(@sysinfo(screenwidth),8),,,Window %b,,Title,transparent
dialog ADD,bitmap,WinTopMove_%b_,@sum(@sysinfo(screenheight),2),@sum(@sysinfo(screenwidth),2),252,20,,Click and Drag,click,
dialog ADD,BUTTON,Winclose_%b_,@sum(@sysinfo(screenheight),4),@sum(@sysinfo(screenwidth),@diff(@dlgpos(window_%b_,W),20)),16,16,X
dialog ADD,BUTTON,WinMax_%b_,@sum(@sysinfo(screenheight),4),@sum(@sysinfo(screenwidth),@diff(@dlgpos(window_%b_,W),37)),16,16,^
rem dialog ADD,BUTTON,WinMin_%w_,@sum(@sysinfo(screenheight),4),@sum(@sysinfo(screenwidth),@diff(@dlgpos(window_%w_,W),53)),16,16,_
dialog ADD,EDIT,WinEdit_%b_,@sum(@sysinfo(screenheight),24),@sum(@sysinfo(screenwidth),4),248,144,,,,Multi,Wrap,Scroll
dialog setpos,Window_%b_,%v,%w,%x,%y
list put,1,%u|%v|%w|%x|%y|
else
dialog setpos,Window_%b_,@dlgpos(back,T),@dlgpos(back,l),@dlgpos(back,w),@dlgpos(back,H)
parse "%c;%d",@dlgpos(Window_%b_,WH)
dialog setpos,WinTop_%b_,,,@diff(%c,4),
dialog setpos,WinTopMove_%b_,,,@diff(%c,4),
dialog setpos,WinClose_%b_,,@diff(%c,20)
dialog setpos,WinMax_%b_,,@diff(%c,37)
rem dialog setpos,WinMin_%b_,,@diff(%c,53)
dialog setpos,WinEdit_%b_,,,@diff(%c,8),@diff(%d,28)
list put,1,%u|%v|%w|%x|%y|1
end
end
goto evloop
:Move
list seek,1,0
%m = @match(1,Window_%b)
if %m
parse "%u;%v;%w;%x;%y;%z",@item(1)
if %z
goto evloop
end
dialog remove,Window_%b_
dialog ADD,GROUP,window_%b_,@sysinfo(screenheight),@sysinfo(screenwidth),256,172
dialog ADD,GRADIENT,WinTop_%b_,@sum(@sysinfo(screenheight),2),@sum(@sysinfo(screenwidth),2),252,20,BLACK,BLUE,,LEFTTORIGHT
dialog add,text,WinTitle_%b_,@sum(@sysinfo(screenheight),6),@sum(@sysinfo(screenwidth),8),,,Window %b,,Title,transparent
dialog ADD,bitmap,WinTopMove_%b_,@sum(@sysinfo(screenheight),2),@sum(@sysinfo(screenwidth),2),252,20,,Click and Drag,click,
dialog ADD,BUTTON,Winclose_%b_,@sum(@sysinfo(screenheight),4),@sum(@sysinfo(screenwidth),@diff(@dlgpos(window_%b_,W),20)),16,16,X
dialog ADD,BUTTON,WinMax_%b_,@sum(@sysinfo(screenheight),4),@sum(@sysinfo(screenwidth),@diff(@dlgpos(window_%b_,W),37)),16,16,^
rem dialog ADD,BUTTON,WinMin_%w_,@sum(@sysinfo(screenheight),4),@sum(@sysinfo(screenwidth),@diff(@dlgpos(window_%w_,W),53)),16,16,_
dialog ADD,EDIT,WinEdit_%b_,@sum(@sysinfo(screenheight),24),@sum(@sysinfo(screenwidth),4),248,144,,,,Multi,Wrap,Scroll
dialog setpos,Window_%b_,%v,%w,%x,%y
else
goto evloop
end
%%winy = @diff(@mousepos(Y),@dlgpos(window_%b_,T))
%%winx = @diff(@mousepos(X),@dlgpos(window_%b_,L))
repeat
dialog setpos,window_%b_,@diff(@mousepos(Y),%%WinY),@diff(@mousepos(X),%%WinX)
until @not(@mousedown(L))
list put,1,Window_%b|@diff(@mousepos(Y),%%WinY)|@diff(@mousepos(X),%%WinX)|@dlgpos(Window_%b_,W)|@dlgpos(Window_%b_,H)|%z
goto EVLOOP
:New WindowMenu
gosub MakeWindow
goto evloop
:MakeWindow
rem %w is the Window #
if @not(%w)
%w = 0
else
%w = @succ(%w)
end
rem Increase window number - Create off screen and move into place.
dialog ADD,GROUP,window_%w_,@sysinfo(screenheight),@sysinfo(screenwidth),256,172
dialog ADD,GRADIENT,WinTop_%w_,@sum(@sysinfo(screenheight),2),@sum(@sysinfo(screenwidth),2),252,20,BLACK,BLUE,,LEFTTORIGHT
dialog add,text,WinTitle_%w_,@sum(@sysinfo(screenheight),6),@sum(@sysinfo(screenwidth),8),,,Window %w,,Title,transparent
dialog ADD,bitmap,WinTopMove_%w_,@sum(@sysinfo(screenheight),2),@sum(@sysinfo(screenwidth),2),252,20,,Click and Drag,click,
dialog ADD,BUTTON,Winclose_%w_,@sum(@sysinfo(screenheight),4),@sum(@sysinfo(screenwidth),@diff(@dlgpos(window_%w_,W),20)),16,16,X
dialog ADD,BUTTON,WinMax_%w_,@sum(@sysinfo(screenheight),4),@sum(@sysinfo(screenwidth),@diff(@dlgpos(window_%w_,W),37)),16,16,^
rem dialog ADD,BUTTON,WinMin_%w_,@sum(@sysinfo(screenheight),4),@sum(@sysinfo(screenwidth),@diff(@dlgpos(window_%w_,W),53)),16,16,_
dialog ADD,EDIT,WinEdit_%w_,@sum(@sysinfo(screenheight),24),@sum(@sysinfo(screenwidth),4),248,144,,,Multi,Wrap,Scroll
rem Move window into place
dialog setpos,window_%w_,0,0
list add,1,Window_%w|0|0|256|172|
exit
|
_________________ Chris
Http://theblindhouse.com |
|
Back to top |
|
|
cnodnarb Professional Member
Joined: 11 Sep 2002 Posts: 762 Location: Rockeledge, GA
|
Posted: Wed Sep 25, 2002 2:21 am Post subject: |
|
|
Kind of off topic, kind of not.
The VDSWND.dll is great for MDI, but when moving a window with DragFullWindows on it shows the window from the top left corner of the screen, not of the window. Does anyone know how to dynamically refresh the windows appearance settings so when the vds app is active it will turn DragFullWindows off and turn it back on when the program becomes inactive?
NodNarb |
|
Back to top |
|
|
Skit3000 Admin Team
Joined: 11 May 2002 Posts: 2166 Location: The Netherlands
|
Posted: Wed Sep 25, 2002 1:19 pm Post subject: |
|
|
Hey Liquid,
If you want to know how to make your window resizeable, just add a button to the right, and one to the bottom. If pressed, there will be a BUTTON event, and then it's just the same as the drag-stuff...
Btw. Yours is cool 2!
Btw2. I think it's handy to make something that you can give up the new size of a window, like in my example... |
|
Back to top |
|
|
LiquidCode Moderator Team
Joined: 05 Dec 2000 Posts: 1751 Location: Space and Time
|
Posted: Wed Sep 25, 2002 1:25 pm Post subject: |
|
|
I am actually going to use empty bitmaps that are clickable
to be able to resize the windows. It is taking a little to get it
to work right. _________________ Chris
Http://theblindhouse.com |
|
Back to top |
|
|
Skit3000 Admin Team
Joined: 11 May 2002 Posts: 2166 Location: The Netherlands
|
Posted: Wed Sep 25, 2002 1:41 pm Post subject: |
|
|
I think you can better use an empty TEXT element.
Same effect, only then you don't need other files than your script... |
|
Back to top |
|
|
LiquidCode Moderator Team
Joined: 05 Dec 2000 Posts: 1751 Location: Space and Time
|
Posted: Wed Sep 25, 2002 2:22 pm Post subject: |
|
|
I wouldn't need another file. I can just use the bitmap dialog element
and not assign a file to it. It does the save thing. That is how I made
it so the windows can be clicked and draged. _________________ Chris
Http://theblindhouse.com |
|
Back to top |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You can attach files in this forum You can download files in this forum
|
|