HELP : Resizing a Xbrowse into a dialog

HELP : Resizing a Xbrowse into a dialog

Postby Silvio » Wed Mar 18, 2009 2:13 am

When I large the Main Window not refresh and resize xbrowse and tpanel .
<how I can resolve it ?

Xbrowse and tpanel are on a Dialog with WS_CHILD style in a Main window.

this is the test source :
Code: Select all  Expand view
#include "fivewin.ch"
#include "xbrowse.ch"
#include "Splitter.ch"

static oWnd,nSplit,oDlg


Function Main()

 DEFINE WINDOW oWnd TITLE "Resize test with odlg and Xbrowse" ;
      MENU BuildMenu()

       DEFINE BUTTONBAR oBar OF oWnd SIZE 60, 60 2007

   DEFINE BUTTON OF oBar action  test(oWnd,oBar) ;
      RESOURCE "attach" PROMPT "Attach" TOOLTIP "Attach"
      SET MESSAGE OF oWnd TO "Resize test with odlg and Xbrowse" ;
      CENTERED CLOCK KEYBOARD 2007

      oWnd:bResized := {|| ResizeWndMain() }

 ACTIVATE WINDOW oWnd ;
      VALID MsgYesNo( "Do you want to end?" )

return nil


FUNCTION  ResizeWndMain()
    local aClient
 if oDlg != NIL
      aClient := GetClientRect (oWnd:hWnd )
      oDlg:SetSize( aClient[4], aClient[3] - oWnd:oBar:nHeight - oWnd:oMsgBar:nHeight )
      oDlg:Refresh()

       //XBROWSE
  IF  oGrid  != NIL
      oGrid:SetSize( aClient[4]-oGrid:nLeft, oDlg:nHeight - 26 )
      oGrid:Refresh()
   ENDIF
     // SPLIT
     IF  oSplit  != NIL
         oSplit:nheight:= oDlg:nbottom
         oSplit:Refresh()
   ENDIF
ENDIF
RETURN NIL








 FUNCTION  BuildMenu()

   local oMenu

   MENU oMenu 2007
      MENUITEM "&DataBases"
      MENU
         MENUITEM "&Clients..." FILENAME "..\bitmaps\16x16\favorite.bmp"
         MENUITEM "&Report..."
         MENU
            MENUITEM "&One..." DISABLED
            MENUITEM "&Two..." CHECKED
            MENUITEM "&Three..." WHEN .F.
         ENDMENU
         SEPARATOR
         MENUITEM "&End" ACTION oWnd:End()
      ENDMENU

      MENUITEM "Edit" WHEN .F.

      oMenu:AddHelp()

      MENUITEM "Another item"
   ENDMENU

   return oMenu



Function test(oWnd,oBar)
   Local oDlg,oGrid
   Local  aClient := GetClientRect (oWnd:hWnd )
   Local nSplit :=102
   Local oSplit
   Local oGrafico

   local aArray1 := {}
   local nI

   // define a dialog sin borders


   Define dialog oDlg
   oDlg:nTop    = oBar:nHeight-1
   oDlg:nLeft   = 0
   oDlg:nBottom = aClient[3] - 1
   oDlg:nRight  = aClient[4]
   oDlg:nStyle  = nOR( WS_CHILD, 4 )
   oDlg:SetColor(0,RGB(143,172,230))




  for nI = 1 to 20
   aadd( aArray1, { .f.,SPACE(20),;
                                "Row:"+StrZero(nI,2)+" Col:02",;
                                "Row:"+StrZero(nI,2)+" Col:03",;
                                "Row:"+StrZero(nI,2)+" Col:03",;
                                "Row:"+StrZero(nI,2)+" Col:03",;
                                "Row:"+StrZero(nI,2)+" Col:03",;
                                "Row:"+StrZero(nI,2)+" Col:03",;
                                "Row:"+StrZero(nI,2)+" Col:03" } )
   next


   // create a xbrowse
   oGrid := TXBrowse():New( oDlg )
   oGrid:nTop    := 00
   oGrid:nLeft   := 00
   oGrid:nBottom :=  (oDlg:nBottom / 2) - oBar:nHeight
   oGrid:nRight  :=  nSplit
   oGrid:lColDividerComplete := .T.
   oGrid:lRecordSelector := .F.

       oGrid:SetArray( aArray1 )

              oGrid:SetRDD()
              oGrid:CreateFromCode()
              oGrid:nRowHeight  := 24
              oGrid:nHeaderHeight  := 40

           oGrafico:=Tpanel():New(0,nsplit+2,oDlg:nBottom,oDlg:nright)

   @ 0,nSplit+1  SPLITTER oSplit  OF  oDlg ;
        VERTICAL ;
        PREVIOUS CONTROLS oGrid ;
        HINDS CONTROLS oGrafico ;
        LEFT MARGIN 50 ;
        RIGHT MARGIN 70 ;
        SIZE 1, 336 PIXEL




   ACTIVATE DIALOG oDlg NOWAIT;
   ON PAINT (oSplit:AdjClient())

return nil


 





Any Idea ?
Best Regards, Saludos

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

Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 88 guests