FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour MDI & Splitter Problem
Posts: 99
Joined: Wed Nov 02, 2005 10:40 AM

MDI & Splitter Problem

Posted: Mon Nov 19, 2007 09: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

Posts: 44162
Joined: Thu Oct 06, 2005 05:47 PM

MDI & Splitter Problem

Posted: 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
#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
Posts: 99
Joined: Wed Nov 02, 2005 10:40 AM

MDI & Splitter Problem

Posted: Mon Nov 19, 2007 11:37 AM

thank you Antonio.

Posts: 44162
Joined: Thu Oct 06, 2005 05:47 PM

MDI & Splitter Problem

Posted: Mon Nov 19, 2007 03:58 PM
It looks as a Windows MDI internal procedure GPF but we found a way to bypass it :-)

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 44162
Joined: Thu Oct 06, 2005 05:47 PM

MDI & Splitter Problem

Posted: Mon Nov 19, 2007 03:59 PM
Here it is the source code:
// 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
Posts: 3107
Joined: Fri Oct 07, 2005 06:28 PM

MDI &amp; Splitter Problem

Posted: 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
Posts: 44162
Joined: Thu Oct 06, 2005 05:47 PM

MDI &amp; Splitter Problem

Posted: Tue Nov 20, 2007 07:32 AM

Silvio,

What error ?

Probably the error get fixed with this code:

VALID ( PostQuitMessage( 0 ), .T. )

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 824
Joined: Thu Oct 13, 2005 07:39 AM

MDI &amp; Splitter Problem

Posted: Tue Nov 20, 2007 08:41 AM
Antonio,

this is the error:

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
Posts: 824
Joined: Thu Oct 13, 2005 07:39 AM

MDI &amp; Splitter Problem

Posted: Tue Nov 20, 2007 08: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
Posts: 44162
Joined: Thu Oct 06, 2005 05:47 PM

MDI &amp; Splitter Problem

Posted: Tue Nov 20, 2007 09:24 AM
This version fixes the exit error on XP (on Vista is ok):
// 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
Posts: 44162
Joined: Thu Oct 06, 2005 05:47 PM

MDI &amp; Splitter Problem

Posted: Tue Nov 20, 2007 09: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
Posts: 44162
Joined: Thu Oct 06, 2005 05:47 PM

MDI &amp; Splitter Problem

Posted: Tue Nov 20, 2007 09: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
Posts: 44162
Joined: Thu Oct 06, 2005 05:47 PM

MDI &amp; Splitter Problem

Posted: Tue Nov 20, 2007 09: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
Posts: 824
Joined: Thu Oct 13, 2005 07:39 AM

MDI &amp; Splitter Problem

Posted: Wed Nov 21, 2007 09: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
Posts: 44162
Joined: Thu Oct 06, 2005 05:47 PM

MDI &amp; Splitter Problem

Posted: Wed Nov 21, 2007 09: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