forum.vdsworld.com Forum Index forum.vdsworld.com
Visit VDSWORLD.com
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


True MDI

 
Post new topic   Reply to topic    forum.vdsworld.com Forum Index -> Wish List
View previous topic :: View next topic  
Author Message
jwfv
Valued Contributor
Valued Contributor


Joined: 19 Mar 2002
Posts: 422
Location: Beaufort, SC

PostPosted: Fri Feb 25, 2005 1:47 pm    Post subject: True MDI Reply with quote

Is it possible to add true MDI capability into VDS? I have read the threads that attempt to accomplish it with workarounds.

MDI - for those that aren't familiar:

http://en.wikipedia.org/wiki/Multiple_Document_Interface

_________________
Joe Floyd
Back to top
View user's profile Send private message
Skit3000
Admin Team


Joined: 11 May 2002
Posts: 2166
Location: The Netherlands

PostPosted: Fri Feb 25, 2005 3:57 pm    Post subject: Reply with quote

I know this isn't a real MDI window, but it comes close... Smile

Code:
#define command,mdi-dialog
#define function,mdi-dialog
option decimalsep,.

  DIALOG CREATE,MyEditorWindow,-1,0,554,413
REM *** Gewijzigd door de Dialoog Ontwerper op 25-2-2005 - 16:30 ***
  DIALOG ADD,MENU,File
  DIALOG ADD,MENU,Edit
  DIALOG ADD,MENU,Help
  DIALOG ADD,STATUS,STATUS1,STATUS1
  DIALOG ADD,LINE,LINE1,0,0,554,40
  DIALOG ADD,COMBO,COMBO1,10,7,180,21,,,LIST
  DIALOG ADD,BUTTON,bMAX,11,191,64,20,Max
  DIALOG ADD,BUTTON,bMIN,11,259,64,20,Min
  DIALOG ADD,BUTTON,bNORMAL,11,327,64,20,Normal
  DIALOG ADD,BUTTON,bACTIVATE,11,395,64,20,Activate
  DIALOG ADD,BUTTON,bDETACH,11,395,64,20,Detach
  DIALOG SHOW

# Create the MDI parent window by specifying the x and y positions. The second
# parameter is the name of the window in which it should create the MDI window.
# By using the @dlgtext() function to get the name of the last created window.
%%MdiParent = @mdi-dialog(create,@dlgtext(),40,0,554,354,COLOR 80FF00)

# Create a list to keep track of all windows added.
list create,1

  # Just create a window.
  DIALOG CREATE,Unnamed1.txt,0,0,240,160,RESIZABLE,COLOR FF8000
  # With the @mdi-dialog() function you can add the window to the MDI
  # parent window. Be sure to save the output to a list, so you can
  # keep track on it...
  list add,1,@dlgtext()|@mdi-dialog(attach,%%MdiParent,@dlgtext())
  DIALOG SHOW
 
  DIALOG CREATE,Unnamed2.txt,20,20,240,160,RESIZABLE,COLOR F8F000
  list add,1,@dlgtext()|@mdi-dialog(attach,%%MdiParent,@dlgtext())
  DIALOG SHOW

  DIALOG CREATE,Unnamed3.txt,40,40,240,160,RESIZABLE,COLOR 8800FF
  list add,1,@dlgtext()|@mdi-dialog(attach,%%MdiParent,@dlgtext())
  DIALOG SHOW

# Select the first dialog again and put the names/ID's of the child
# windows into COMBO1.
dialog select,0
list assign,COMBO1,1
list seek,COMBO1,0

:Evloop
wait event,0.1
parse "%%Event;%%EventDialog",@event(d)
goto %%Event

:Timer
# Look if the current window is a child of the main window. If so,
# update the COMBO1 element.
if @greater(@pos(@winactive(),@text(COMBO1)),0)
  list seek,COMBO1,0
  %%Temp = @match(COMBO1,@winactive())
end
goto Evloop

:Resize
goto Evloop

:bMaxBUTTON
# Maximize the selected window.
parse "%%DialogName;%%DialogID",@dlgtext(combo1)
window maximize,%%DialogID
goto Evloop

:bMinBUTTON
# Minimize (iconize) the selected window.
parse "%%DialogName;%%DialogID",@dlgtext(combo1)
window iconize,%%DialogID
goto Evloop

:bNormalBUTTON
# Restore the selected window.
parse "%%DialogName;%%DialogID",@dlgtext(combo1)
window normal,%%DialogID
goto Evloop

:bActivateBUTTON
# Put the selected window on top.
parse "%%DialogName;%%DialogID",@dlgtext(combo1)
window activate,%%DialogID
goto Evloop

:bDetachBUTTON
parse "%%DialogName;%%DialogID",@dlgtext(combo1)
  loadlib user32
  %3 = @strdel(@winexists(%%DialogID),1,1)
  %z = @lib(user32,SetParent,INT:,INT:%3,0)
  freelib user32
goto Evloop

:Close
if @greater(%%EventDialog,0)
  # Only close this child window.
  dialog select,%%EventDialog
  dialog close
  # Filter out all unwanted CLOSE events.
  while @event()
  wend
  goto Evloop
else
  # Close the whole program.
  stop
end

:mdi-dialog
if @equal(%1,CREATE)
  # @mdi-dialog(create, <parentname>, <top>, <left>, <width>, <height>, <styles>, <...>)
  dialog create,%2CLIENTAREA,%3,%4,%5,%6,NOTITLE,%7,%8,%9
  %9 = @strdel(@winexists(%2CLIENTAREA),1,1)
  loadlib user32
  %z = @lib(user32,SetParent,INT:,INT:@strdel(@winexists(%2CLIENTAREA),1,1),INT:@strdel(@winexists(%2),1,1))
  freelib user32
  dialog show
  exit %9
end
if @equal(%1,ATTACH)
  # @mdi-dialog(attach, <parentname>, <childname>)
  loadlib user32
  %3 = @strdel(@winexists(%3),1,1)
  %z = @lib(user32,SetParent,INT:,INT:%3,INT:%2)
  freelib user32
  exit "%"%3
end
if @equal(%1,DETACH)
  # @mdi-dialog(detach, <windowname>)
  loadlib user32
  %z = @lib(user32,SetParent,INT:,INT:@strdel(%2,1,1),0)
  freelib user32
end
exit

_________________
[ Add autocomplete functionality to your VDS IDE windows! ]
Voor Nederlandse beginners met VDS: bekijk ook eens deze tutorial!
Back to top
View user's profile Send private message
jules
Professional Member
Professional Member


Joined: 14 Sep 2001
Posts: 1043
Location: Cumbria, UK

PostPosted: Fri Feb 25, 2005 4:25 pm    Post subject: Reply with quote

I thought MDI was deprecated by Microsoft a long time ago in favour of separate windows. Personally I loathe it.

I don't think the structure of the VDS language itself would be capable of handling the complexity of an MDI application. But the real killer is that MDI in Delphi starts from a different base from the plain window/dialog that VDS uses. The only way it could be done would be to develop a completely new MDI runtime.

_________________
The Tech Pro
www.tech-pro.net
Back to top
View user's profile Send private message Visit poster's website
bbelcher
Contributor
Contributor


Joined: 30 Jul 2002
Posts: 172

PostPosted: Fri Feb 25, 2005 4:30 pm    Post subject: Reply with quote

Nice, I like the possibilities
Back to top
View user's profile Send private message
jwfv
Valued Contributor
Valued Contributor


Joined: 19 Mar 2002
Posts: 422
Location: Beaufort, SC

PostPosted: Fri Feb 25, 2005 5:24 pm    Post subject: Reply with quote

Jules: that's what I was afraid of - that MDI required a different ground-up approach.

Skit: Nice code! It is awfully close to what I was talking about. I plan to study it a little bit to follow what exactly is going on.

_________________
Joe Floyd
Back to top
View user's profile Send private message
ShinobiSoft
Professional Member
Professional Member


Joined: 06 Nov 2002
Posts: 790
Location: Knoxville, Tn

PostPosted: Fri Feb 25, 2005 10:46 pm    Post subject: Reply with quote

jules wrote:
I thought MDI was deprecated by Microsoft a long time ago in favour of separate windows. Personally I loathe it.

I don't think the structure of the VDS language itself would be capable of handling the complexity of an MDI application. But the real killer is that MDI in Delphi starts from a different base from the plain window/dialog that VDS uses. The only way it could be done would be to develop a completely new MDI runtime.


I've tinkered around with writing an extension for adding MDI support to
VDS and found, as Jules mentioned, that the way that VDS handles
messages is not appropriate for the MDI. I did come up with a work
around that I use personally, but I must also create a normal window
and manually process the appropriate messages myself, along with also
providing code for for dealing with menus, capturing events, etc. We then
venture into another small problem, adding controls to a mdi child window.
And then there's debugging the script. VDS will debug the script, but some
of the messages that the MDI frame window is supposed to reveive are
sent to the VDS IDE instead. Mostly WM_SYSCOMMAND messages I've
noticed.

_________________
Bill Weckel
ShinobiSoft Software

"The way is known to all, but not all know it."
Back to top
View user's profile Send private message Send e-mail Visit poster's website Yahoo Messenger
jwfv
Valued Contributor
Valued Contributor


Joined: 19 Mar 2002
Posts: 422
Location: Beaufort, SC

PostPosted: Mon Feb 28, 2005 5:01 pm    Post subject: Reply with quote

Skit - is it possible, using your example, to place an outside program's window into the VDS dialog? I tried a couple of things to change which open window your example "attached" to the dialog, but had no luck. For instance, if I am running a program with a window that is called "test.exe", is it possible to attach it to the dialog like you did with the VDS-created windows?
_________________
Joe Floyd
Back to top
View user's profile Send private message
Skit3000
Admin Team


Joined: 11 May 2002
Posts: 2166
Location: The Netherlands

PostPosted: Mon Feb 28, 2005 6:33 pm    Post subject: Reply with quote

It should work by doing this:

Code:
%%Temp = @mdi-dialog(attach,%%MdiParent,"Test.exe")

_________________
[ Add autocomplete functionality to your VDS IDE windows! ]
Voor Nederlandse beginners met VDS: bekijk ook eens deze tutorial!
Back to top
View user's profile Send private message
jwfv
Valued Contributor
Valued Contributor


Joined: 19 Mar 2002
Posts: 422
Location: Beaufort, SC

PostPosted: Mon Feb 28, 2005 7:35 pm    Post subject: Reply with quote

It worked! Really Cool!
_________________
Joe Floyd
Back to top
View user's profile Send private message
bbelcher
Contributor
Contributor


Joined: 30 Jul 2002
Posts: 172

PostPosted: Mon Feb 28, 2005 8:36 pm    Post subject: Reply with quote

jwfv, could you post where you added the new code.

%%Temp = @mdi-dialog(attach,%%MdiParent,"test.exe")


Thanks.
Back to top
View user's profile Send private message
jwfv
Valued Contributor
Valued Contributor


Joined: 19 Mar 2002
Posts: 422
Location: Beaufort, SC

PostPosted: Tue Mar 01, 2005 12:45 am    Post subject: Reply with quote

For a quick test, I just replaced the code that created the third dialog window:

Code:
rem DIALOG CREATE,Unnamed3.txt,40,40,240,160,RESIZABLE,COLOR 8800FF
  rem list add,1,@dlgtext()|@mdi-dialog(attach,%%MdiParent,@dlgtext())
  rem DIALOG SHOW
  list add,1,@dlgtext()|@mdi-dialog(attach,%%MdiParent,Test)


Where

test is what is shown in the window of the program i want to include.

It didn't show up for me until I selected the third window in the combo list and told it to maximize. Then it worked well.

_________________
Joe Floyd
Back to top
View user's profile Send private message
jwfv
Valued Contributor
Valued Contributor


Joined: 19 Mar 2002
Posts: 422
Location: Beaufort, SC

PostPosted: Tue Mar 01, 2005 12:47 am    Post subject: Reply with quote

Skit - is it possible to resize the MDI parent window? Like in the event of a dialog Resize event.
_________________
Joe Floyd
Back to top
View user's profile Send private message
Skit3000
Admin Team


Joined: 11 May 2002
Posts: 2166
Location: The Netherlands

PostPosted: Tue Mar 01, 2005 8:28 am    Post subject: Reply with quote

I guess you have to put something like this into the code:

Code:
:Resize
if @equal(%%EventDialog,0)
  dialog select,0
  window position,"%"%%MdiParent,,,@dlgpos(,w),@dlgpos(,h)
end
goto Evloop


You should do some maths to calculate the exact width and height of the window... Smile

_________________
[ Add autocomplete functionality to your VDS IDE windows! ]
Voor Nederlandse beginners met VDS: bekijk ook eens deze tutorial!
Back to top
View user's profile Send private message
Estas
Contributor
Contributor


Joined: 31 Jan 2004
Posts: 66
Location: Germany

PostPosted: Sun Apr 30, 2006 8:07 pm    Post subject: Reply with quote

Hi,
I just came along this post, by accident. Wow - this really comes very close to real MDI. Very good workaround !!!

_________________
Greetings to all the folks back home in the States. A friendly "hola -como estas" to all my friends from Spain and Greece.
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    forum.vdsworld.com Forum Index -> Wish List All times are GMT
Page 1 of 1

 
Jump to:  
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

Twitter@vdsworld       RSS

Powered by phpBB © 2001, 2005 phpBB Group