MDI & Splitter Problem

MDI & Splitter Problem

Postby ask » Mon Nov 19, 2007 9:48 am

Hi,
When i try to use MDI Window with splitter does not work .See for example testspl1.prg use MDI .I found a previous forum witch shows the problem

http://fivetechsoft.com/forums/viewtopi ... r+mdichild

Is there any solution for this?
Thank you
A.S.K
ask
 
Posts: 99
Joined: Wed Nov 02, 2005 10:40 am

Postby Antonio Linares » Mon Nov 19, 2007 11:28 am

A.S.K.

You can do it this way. Anyhow when you try to create a Child window it GPFs and we need to find the reason
Code: Select all  Expand view
#include "FiveWin.ch"
#include "Splitter.ch"

static oWnd
static oLbx, oGet
static oSplit

function Main()

   local cTitle := "Testing the Splitter controls"
   local cText

   DEFINE WINDOW oWnd FROM 1, 1 TO 400, 600 PIXEL ;
      TITLE cTitle ;
      BORDER NONE MDI

   SELECT 1
   USE EJEMPLO1.DBF

   @ 20,20 LISTBOX oLbx FIELDS SIZE 200,300 PIXEL OF oWnd ;
      ON CHANGE cText := Ejemplo1->Sintax

   SetParent( oLbx:hWnd, oWnd:hWnd )

   @ 20,225 GET oGet VAR cText TEXT SIZE 300,300 PIXEL OF oWnd

   oLbx:bChange:={|| oGet:Refresh() }

   SetParent( oGet:hWnd, oWnd:hWnd )

   @ 20, 220  SPLITTER oSplit ;
              VERTICAL ;
              PREVIOUS CONTROLS oLbx ;
              HINDS CONTROLS oGet ;
              LEFT MARGIN 100 ;
              RIGHT MARGIN 140 ;
              SIZE 4, 300  PIXEL ;
              OF oWnd ;
              _3DLOOK ;
              UPDATE

  SetParent( oSplit:hWnd, oWnd:hWnd )

  ACTIVATE WINDOW oWnd

return nil
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42079
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby ask » Mon Nov 19, 2007 11:37 am

thank you Antonio.
ask
 
Posts: 99
Joined: Wed Nov 02, 2005 10:40 am

Postby Antonio Linares » Mon Nov 19, 2007 3:58 pm

It looks as a Windows MDI internal procedure GPF but we found a way to bypass it :-)

Image
Last edited by Antonio Linares on Mon Nov 19, 2007 4:11 pm, edited 1 time in total.
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42079
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby Antonio Linares » Mon Nov 19, 2007 3:59 pm

Here it is the source code:
Code: Select all  Expand view
// FWH Class TOutLook2003

#include "FiveWin.ch"
#include "Splitter.ch"

//----------------------------------------------------------------------------//

function Main()

   local oWnd, oOutLook2003, oStatusBar, oSplit, cCombo, oRad, nValue := 1
   local oFont

   DEFINE WINDOW oWnd TITLE "FWH new Class TOutLook2003" MDI // ;
      // MENU BuildMenu()

   DEFINE OUTLOOK2003 oOutLook2003 OF oWnd ;
      PROMPTS "Mail", "Calendar", "Contacts", "" ;
      BITMAPS "..\bitmaps\mail.bmp", "..\bitmaps\calendar.bmp", "..\bitmaps\notes.bmp"
     
   oWnd:oLeft = nil // Because the splitter is going to control the resize   
     
   @ 1, 2 BUTTON "New" OF oOutLook2003:aDialogs[ 1 ] SIZE 80, 22 ACTION BuildDlg()

   @ 3, 2 BUTTON "Edit" OF oOutLook2003:aDialogs[ 1 ] SIZE 80, 22 ACTION MsgInfo( "Edit" )   

   @ 5, 2 BUTTON "Search" OF oOutLook2003:aDialogs[ 1 ] SIZE 80, 22 ACTION MsgInfo( "Search" )   

   @ 1, 1 COMBOBOX cCombo ITEMS { "January", "February", "March", "April", "May" } ;
      OF oOutLook2003:aDialogs[ 2 ] SIZE 170, 100
   
   DEFINE FONT oFont NAME "Arial" SIZE 0, -10
   
   @ 12, 10 SAY Date() OF oOutLook2003:aDialogs[ 2 ] SIZE 80, 20 FONT oFont
   
   @ 3, 1 RADIO oRad VAR nValue OF oOutLook2003:aDialogs[ 2 ] ;
      ITEMS "&Day", "&Week", "&Month" SIZE 100, 20
     
   oRad:SetFont( oFont )   

   #ifndef __CLIPPER__
      DEFINE STATUSBAR oStatusBar PROMPT "  FWH Class TOutLook2003" OF oWnd
   #else   
      DEFINE MESSAGE oStatusBar PROMPT "  FWH Class TOutLook2003" OF oWnd
   #endif   

   SetParent( oOutLook2003:hWnd, oWnd:hWnd )
   
   oWnd:oClient = nil
   
   @ 0, 191 SPLITTER oSplit ;
      VERTICAL _3DLOOK ;
      PREVIOUS CONTROLS oOutLook2003 ;
      HINDS CONTROLS oWnd:oWndClient ;
      SIZE 4, oWnd:nHeight - 70 PIXEL ;
      OF oWnd

   SetParent( oSplit:hWnd, oWnd:hWnd )

   ACTIVATE WINDOW oWnd ;
      ON RESIZE oSplit:Adjust() ;
      VALID PostQuitMessage( 0 )

return nil

//----------------------------------------------------------------------------//

function BuildMenu()

   local oMenu
   
   MENU oMenu
      MENUITEM "&One"
      MENUITEM "&Two"
      MENUITEM "&Three"
   ENDMENU
   
return oMenu   

//----------------------------------------------------------------------------//

function BuildDlg()

   local oDlg, oOutL2003
   
   DEFINE DIALOG oDlg RESOURCE "Test"
   
   REDEFINE OUTLOOK2003 oOutL2003 ID 110 OF oDlg ;
      PROMPTS "One", "Two", "Three" ;
      BITMAPS "..\bitmaps\mail.bmp", "..\bitmaps\calendar.bmp", "..\bitmaps\notes.bmp" ;
      DIALOGS "Page1", "Page2", "Page3"

   REDEFINE BUTTON ID 110 OF oOutL2003:aDialogs[ 1 ] ACTION MsgInfo( "Click" )
     
   ACTIVATE DIALOG oDlg CENTERED
   
return nil     

//----------------------------------------------------------------------------//

function WinRun()

   while NoGPF()
   end
   
return nil         
               
//----------------------------------------------------------------------------//

#pragma BEGINDUMP

#include <windows.h>
#include <hbapi.h>

BOOL SysRefresh( void );

HB_FUNC( NOGPF )
{
   __try
   {
      hb_retl( SysRefresh() );
   }
   __except ( ( hb_retl( TRUE ), TRUE ) )
   {}
}

#pragma ENDDUMP   
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42079
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby Silvio » Tue Nov 20, 2007 12:51 am

Antonio,
when I run it run ok but when i close it xp professional make an error
Best Regards, Saludos

Falconi Silvio
User avatar
Silvio
 
Posts: 3107
Joined: Fri Oct 07, 2005 6:28 pm
Location: Teramo,Italy

Postby Antonio Linares » Tue Nov 20, 2007 7:32 am

Silvio,

What error ?

Probably the error get fixed with this code:

VALID ( PostQuitMessage( 0 ), .T. )
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42079
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby StefanHaupt » Tue Nov 20, 2007 8:41 am

Antonio,

this is the error:

Code: Select all  Expand view
Application
===========
   Path and name: D:\FWH\samples\testspl7.exe (32 bits)
   Size: 1,295,360 bytes
   Time from start: 0 hours 0 mins 36 secs
   Error occurred at: 11/20/07, 09:36:36
   Error description: Error BASE/1066  Argument error: conditional
   Args:
     [   1] = U   

Stack Calls
===========
   Called from: MDIFRAME.PRG => TMDIFRAME:END(0)
   Called from: MDIFRAME.PRG => (b)TMDIFRAME:NEW(0)
   Called from: MENU.PRG => TMENU:COMMAND(0)
   Called from: WINDOW.PRG => TWINDOW:COMMAND(0)
   Called from: MDIFRAME.PRG => TMDIFRAME:COMMAND(0)
   Called from:  => TMDIFRAME:HANDLEEVENT(0)
   Called from: WINDOW.PRG => _FWH(0)
   Called from: testspl7.prg => NOGPF(0)
   Called from: testspl7.prg => WINRUN(102)
   Called from: WINDOW.PRG => TMDIFRAME:ACTIVATE(0)
   Called from: testspl7.prg => MAIN(61)

kind regards
Stefan
StefanHaupt
 
Posts: 824
Joined: Thu Oct 13, 2005 7:39 am
Location: Germany

Postby StefanHaupt » Tue Nov 20, 2007 8:46 am

Antonio,

Antonio Linares wrote:Silvio,

What error ?

Probably the error get fixed with this code:

VALID ( PostQuitMessage( 0 ), .T. )


does not work, same error.

Another problem, if you maximize the mdi window, you can´t resize it nor select other open mdi windows
kind regards
Stefan
StefanHaupt
 
Posts: 824
Joined: Thu Oct 13, 2005 7:39 am
Location: Germany

Postby Antonio Linares » Tue Nov 20, 2007 9:24 am

This version fixes the exit error on XP (on Vista is ok):
Code: Select all  Expand view
// FWH Class TOutLook2003

#include "FiveWin.ch"
#include "Splitter.ch"

static lExit := .F.

//----------------------------------------------------------------------------//

function Main()

   local oWnd, oOutLook2003, oStatusBar, oSplit, cCombo, oRad, nValue := 1
   local oFont

   DEFINE WINDOW oWnd TITLE "FWH new Class TOutLook2003" MDI // ;
      // MENU BuildMenu()

   DEFINE OUTLOOK2003 oOutLook2003 OF oWnd ;
      PROMPTS "Mail", "Calendar", "Contacts", "" ;
      BITMAPS "..\bitmaps\mail.bmp", "..\bitmaps\calendar.bmp", "..\bitmaps\notes.bmp"
     
   oWnd:oLeft = nil // Because the splitter is going to control the resize   
     
   @ 1, 2 BUTTON "New" OF oOutLook2003:aDialogs[ 1 ] SIZE 80, 22 ACTION BuildDlg()

   @ 3, 2 BUTTON "Edit" OF oOutLook2003:aDialogs[ 1 ] SIZE 80, 22 ACTION MsgInfo( "Edit" )   

   @ 5, 2 BUTTON "Search" OF oOutLook2003:aDialogs[ 1 ] SIZE 80, 22 ACTION MsgInfo( "Search" )   

   @ 1, 1 COMBOBOX cCombo ITEMS { "January", "February", "March", "April", "May" } ;
      OF oOutLook2003:aDialogs[ 2 ] SIZE 170, 100
   
   DEFINE FONT oFont NAME "Arial" SIZE 0, -10
   
   @ 12, 10 SAY Date() OF oOutLook2003:aDialogs[ 2 ] SIZE 80, 20 FONT oFont
   
   @ 3, 1 RADIO oRad VAR nValue OF oOutLook2003:aDialogs[ 2 ] ;
      ITEMS "&Day", "&Week", "&Month" SIZE 100, 20
     
   oRad:SetFont( oFont )   

   #ifndef __CLIPPER__
      DEFINE STATUSBAR oStatusBar PROMPT "  FWH Class TOutLook2003" OF oWnd
   #else   
      DEFINE MESSAGE oStatusBar PROMPT "  FWH Class TOutLook2003" OF oWnd
   #endif   

   SetParent( oOutLook2003:hWnd, oWnd:hWnd )
   
   oWnd:oClient = nil
   
   @ 0, 191 SPLITTER oSplit ;
      VERTICAL _3DLOOK ;
      PREVIOUS CONTROLS oOutLook2003 ;
      HINDS CONTROLS oWnd:oWndClient ;
      SIZE 4, oWnd:nHeight - 70 PIXEL ;
      OF oWnd

   SetParent( oSplit:hWnd, oWnd:hWnd )

   ACTIVATE WINDOW oWnd ;
      ON RESIZE oSplit:Adjust() ;
      VALID lExit := .T.

return nil

//----------------------------------------------------------------------------//

function BuildMenu()

   local oMenu
   
   MENU oMenu
      MENUITEM "&One"
      MENUITEM "&Two"
      MENUITEM "&Three"
   ENDMENU
   
return oMenu   

//----------------------------------------------------------------------------//

function BuildDlg()

   local oDlg, oOutL2003
   
   DEFINE DIALOG oDlg RESOURCE "Test"
   
   REDEFINE OUTLOOK2003 oOutL2003 ID 110 OF oDlg ;
      PROMPTS "One", "Two", "Three" ;
      BITMAPS "..\bitmaps\mail.bmp", "..\bitmaps\calendar.bmp", "..\bitmaps\notes.bmp" ;
      DIALOGS "Page1", "Page2", "Page3"

   REDEFINE BUTTON ID 110 OF oOutL2003:aDialogs[ 1 ] ACTION MsgInfo( "Click" )
     
   ACTIVATE DIALOG oDlg CENTERED
   
return nil     

//----------------------------------------------------------------------------//

function WinRun()

   while NoGPF()
      if lExit
         PostQuitMessage( 0 )
      endif   
   end
   
return nil         
               
//----------------------------------------------------------------------------//

#pragma BEGINDUMP

#include <windows.h>
#include <hbapi.h>

BOOL SysRefresh( void );

HB_FUNC( NOGPF )
{
   __try
   {
      hb_retl( SysRefresh() );
   }
   __except ( ( hb_retl( TRUE ), TRUE ) )
   {}
}

#pragma ENDDUMP   
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42079
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby Antonio Linares » Tue Nov 20, 2007 9:27 am

Stefan,

> if you maximize the mdi window, you can´t resize it nor select other open mdi windows

Yes, we have noticed it.

The problem is that we are not using the FWH standard windows procedure as the MDI GPFs internally (even if we use a standard Windows procedure and not the FWH one).

Its a tricky code tu push MDI environment to its limits, but lets see if we can solve those problems
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42079
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby Antonio Linares » Tue Nov 20, 2007 9:31 am

Stefan,

> if you maximize the mdi window, you can´t resize it nor select other open mdi windows

As a temporary workaround, the "cascade" MDI menu option can be selected to restore the maximized mdichild.
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42079
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby Antonio Linares » Tue Nov 20, 2007 9:38 am

Also we can "restore" the mdichild:

@ 3, 2 BUTTON "Edit" OF oOutLook2003:aDialogs[ 1 ] SIZE 80, 22 ACTION oWnd:oWndClient:aWnd[ 1 ]:Restore()

Anyhow we need to find why the WM_SYSCOMMANDs are not properly being processed
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42079
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby StefanHaupt » Wed Nov 21, 2007 9:08 am

Antonio,

"restoring" the window as a work around is working fine.

Cascading the windows changes their sizes to their original size, is that standard behavior?
kind regards
Stefan
StefanHaupt
 
Posts: 824
Joined: Thu Oct 13, 2005 7:39 am
Location: Germany

Postby Antonio Linares » Wed Nov 21, 2007 9:21 am

Stefan,

> Cascading the windows changes their sizes to their original size, is that standard behavior?

Yes, I think so
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42079
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Next

Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot], nageswaragunupudi and 93 guests