Page 1 of 2

Dialog, xbrowse,splitter,folder and ttitle

PostPosted: Mon Feb 05, 2018 4:25 pm
by Silvio.Falconi
Dear Friend ,
I wish create this window
Image

it is a dialog on main window with ttitle on top , xbrowse at left a vertical splitter and a folder at right
on bottom a buttonbar
how i can make it ?
Inot wish use tlayout class but on a Windows and a tfsdi dialog
a tfsdi dialog is a dialog with the style nOR( WS_CHILD, 4 )

i made a test but not run ok there is someone can help me please . i insert the tfsdi class on bottom

Code: Select all  Expand view

// a Windows with a Dialog with ttitle xbrowse and buttonbar

#include "fivewin.ch"

 REQUEST DBFCDX
 REQUEST DBFFPT

static oWndMain,oBar,oBartitle
Static oDlgNew,oGrid,oPanelRight,oSplit
Static cIniFile

Function Main()


cIniFile    := cFilePath( GetModuleFileName( GetInstance() ) ) + "test.ini"

DEFINE WINDOW oWndMain Title "Test with ttitle and xbrowse,splitter,"

DEFINE BUTTONBAR oBar _3D SIZE 44, 46 OF oWndMain

SET MESSAGE OF oWndMain TO "fivewin power" CENTER NOINSET

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

 ACTIVATE WINDOW oWndMain;
      on init test()
 return nil

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

Function Test()
   Local oCol,i,aBrowse
   Local nSplit :=VAL(GetPvProfString("Browse", "CuSplit","302", cIniFile))

   oDlgNew := TFsdi():New(oWndMain)
   oWndMain:oClient := oDlgNew
    oBarTitle:=TTitle():New( oDlgNew,0, 0,oDlgNew:nGridRight, 40)

USE CUSTOMER ALIAS CU

oDlgNew:NewGrid( nSplit )

oGrid:cAlias := "CU"

   aBrowse   := { { { || CU->FIRST }, i18n("First"), 150, 0 },;
                  { { || CU->LAST  }, i18n("Last"), 150, 0 },;
                  { { || CU->STREET}, i18n("Street"), 150, 0 },;
                  { { || CU->CITY } , i18n("City"), 150, 0 } }



   FOR i := 1 TO Len(aBrowse)
      oCol := oGrid:AddCol()
      oCol:bStrData := aBrowse[ i, 1 ]
      oCol:cHeader  := aBrowse[ i, 2 ]
      oCol:nWidth   := aBrowse[ i, 3 ]
      oCol:nDataStrAlign := aBrowse[ i, 4 ]
      oCol:nHeadStrAlign := aBrowse[ i, 4 ]
   NEXT


   oGrid:CreateFromCode()

    //---------------------------------------------------------------------------//
   oPanelRight:=TPanel():New(oBarTitle:nBottom+1,nSplit+2,;
               oDlgNew:nGridRight,;
               oDlgNew:nGridBottom-26,;
               oDlgNew)
    //---------------------------------------------------------------------------//

       oSplit := TSplitter():New(oBarTitle:nBottom+1,nSplit,(.not..F.) .or. .T.,{oGrid},.not..F.,;
                                    {oPanelRight},.not..F.,,,;
                                   oDlgNew,,1,oDlgNew:nGridBottom ,;
                                    .T.,.T.,,.F.,.T.,.T. )


       ACTIVATE DIALOG oDlgNew NOWAIT ;
           ON PAINT (oSplit:AdjClient()) ;
           ON INIT ( Load_dialog(),oGrid:SetFocus(),ResizeWndMain()) ;
            VALID ( oGrid:nLen := 0 ,;
                DbCloseAll(), oDlgNew := NIL, .t. )


       return nil

Function Load_dialog()
     Local oFld

      @ 30,0  FOLDER oFld  ITEMS  "Anagrafica","Rapporti Commerciali","Varie";
      SIZE oPanelRight:nRight,oPanelRight:nBottom-26 PIXEL;
      OF oPanelRight ;
      OPTION 1
   oPanelRight:oClient:=  oFld
   return nil











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

Function ResizeWndMain()
   local aClient
    IF oDlgNew != NIL
       aClient := GetClientRect ( oWndMain:hWnd )
         oDlgNew:SetSize( aClient[4], aClient[3] - oBar:nHeight - oWndMain:oMsgBar:nHeight+1 - oBartitle:nBottom)

          IF  oSplit  != NIL
               oSplit:Refresh()
      ENDIF


         IF oBarTitle != nil
            oBarTitle:SetSize(aClient[ 2 ],40)
            oBarTitle:Refresh()
         ENDIF

     IF oGrid  != NIL
         oGrid:SetSize( aClient[ 3 ]- oGrid:nLeft, oDlgNew:nHeight -oBartitle:nBottom)
         oGrid:Refresh()
       ENDIF

       if oPanelRight != nil
        oPanelRight:SetSize( aClient[ 4 ]- oPanelRight:nLEFT,oDlgNew:nHeight- oBartitle:nBottom)
        oPanelRight:Refresh()
     endif

     oWndMain:oMsgBar:Refresh()
         SysRefresh()
   ENDIF
 return nil

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

CLASS TFsdi FROM TDialog
   DATA nGridBottom, nGridRight
   CLASSDATA lRegistered AS LOGICAL

   METHOD New( oWnd, lPixels ) CONSTRUCTOR
   METHOD AdjClient() // INLINE oApp():oWndMain:AdjClient()
   METHOD NewGrid( nSplit )
ENDCLASS


METHOD New( oWnd ) CLASS TFsdi
   local   aClient
   default oWnd    := oWndMain // GetWndDefault()
   aClient := GetClientRect (oWnd:hWnd )
   ::oWnd = oWnd
   ::nTop    = oBar:nHeight
   ::nLeft   = 0
   ::nBottom = aClient[3] - 1
   ::nRight  = aClient[4]
   ::nStyle  := nOR( WS_CHILD, 4 )
   ::lHelpIcon    := .f.
   ::lTransparent := .f.

   DEFINE FONT ::oFont NAME 'Tahoma' SIZE 0, -12

   ::nGridBottom  := (::nBottom / 2) - oBar:nHeight
   ::nGridRight   := (::nRight / 2 )
   ::aControls    := {}
   ::SetColor( CLR_WHITE, GetSysColor(15) )
   ::Register( nOr( CS_VREDRAW, CS_HREDRAW ) )
     SetWndDefault( Self )
     return Self

  METHOD NewGrid( nSplit ) CLASS TFsdi
   oGrid := TXBrowse():New( oDlgNew )
   oGrid:nTop    := oBarTitle:nBottom
   oGrid:nLeft   := 00
   oGrid:nBottom := oDlgNew:nGridBottom
   oGrid:nRight  := oDlgNew:nGridRight
return nil

METHOD AdjClient() CLASS TFsdi
   return nil
 

Re: Dialog, xbrowse,splitter,folder and ttitle

PostPosted: Mon Feb 05, 2018 5:12 pm
by TimStone
Silvio,

That is really quite simple to do in an .RC. You define the dialog, add the two button bar controls, and the browse. The right section is a folder control, each with it's own sub-dialog. The Title is a value fed to the browse.

I have multiple screens with folders, browse control, multiple button bars, edit controls. In fact, as you scroll the browse rows, the data in the edit boxes changes to reflect the highlighted record.

Because it is your application, only you know exactly how each control is to work. It will take some effort, but you can build this. Just start with a layout on the .RC. If you use @ positioning, you can likely do it, but I find .RC files to be far easier to get everything correct.

Tim

Re: Dialog, xbrowse,splitter,folder and ttitle

PostPosted: Tue Feb 06, 2018 9:43 am
by Silvio.Falconi
Timm,
I knew you or anyone would answer this way. I do not use Rc if not for bitmaps files.

I have already built this window with the xbrowse on the left and the panel on the right and I have used it for a long time successfully.

Everything is in the source using the Tfsdi class by Josè di Alanit.

as you can see here

Image

The problem with this type of window is that the end customer sees the list and does not see the data of each record and a customer now wants that when he scrolls a record from the list he must view the data of that record on video without loading the input dialog or change every time.

That's why I thought to create the same window with xbrose on the left and the panel with unfolder on the right so that the end user could scroll the laista from the xbrowse and show the data for that record on the screen.

Doing so in this way it is no longer possible to insert an explorer type menu and I am forced to insert a buttonbar at the bottom with the buttons new edit delete and search

Re: Dialog, xbrowse,splitter,folder and ttitle

PostPosted: Tue Feb 06, 2018 5:40 pm
by TimStone
Silvio,

Yes, I use .RC files for everything and the results are very precise. That is the only type of help I can provide.

I understand what your client wants. It can be done, but it does take a lot of work. It is more complex than just the controls. It also means updating the data properly.

I display a browse on the lower part of a dialog, and data fields in the top half. Browse the data records, and the edits for the highlighted appear above. I have multiple folders displayed, and switching between them shows browses and data edit screens on each. Everything is open, and I use tData and tRecord to insure that nothing gets corrupted. Of course there is extensive code underneath to make decisions and process data properly.

My point is that it can be done, but the method might need to be different than what you have done in the past. You can go to my website,http://www.autoshopwriter.com, and view the manual or videos to get an idea of what I do. It is a bit easier than posting screen shots here.

Tim

Re: Dialog, xbrowse,splitter,folder and ttitle

PostPosted: Tue Feb 06, 2018 10:25 pm
by Silvio.Falconi
ok
Timm, I wish create it
That screen of that application is an Italian company that with a simple program made with beautiful graphics has depopulated throughout the Italian trogatory making millions of euro: it will be a case?
I not use Rc, tdata or trecord I use symply the dbf this is not important
I wish create that structure I explain on top
if you not Know How make it ok not important I Know there is someone is able to create it
like every dream I have to give it up because with fivewin I can not do it until it only interests me

Re: Dialog, xbrowse,splitter,folder and ttitle

PostPosted: Wed Feb 07, 2018 3:14 pm
by cnavarro
Try with this, but..
1) Why fsdi ( dialog )?
2) Why Panel?

Not finished
Code: Select all  Expand view

// a Windows with a Dialog with ttitle xbrowse and buttonbar

#include "fivewin.ch"
#include "splitter.ch"

REQUEST DBFCDX
REQUEST DBFFPT

static oWndMain, oBartitle
Static oDlgNew, oGrid, oPanelRight, oSplit, oBarMain, oFld
Static cIniFile

Function Main()

   cIniFile    := cFilePath( GetModuleFileName( GetInstance() ) ) + "test.ini"

   DEFINE WINDOW oWndMain Title "Test with ttitle and xbrowse,splitter,"
      DEFINE BUTTONBAR oBarMain SIZE 48, 48 OF oWndMain BOTTOM 2010
      oWndMain:oBottom  := oBarMain
      DEFINE BUTTON OF oBarMain FILE "..\bitmaps\exit.bmp" GROUP
      //SET MESSAGE OF oWndMain TO "fivewin power" CENTER NOINSET
      oWndMain:bResized := {|| ResizeWndMain() }
   ACTIVATE WINDOW oWndMain MAXIMIZED ON INIT test()
     
return nil

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

Function Test()

   Local oCol,i,aBrowse
   Local nSplit := Val( GetPvProfString( "Browse", "CuSplit", "302", cIniFile) )

   oDlgNew       := TFsdi():New( oWndMain )
   oWndMain:oTop := oDlgNew

   oBarTitle := TTitle():New( oDlgNew, 0, 0, oWndMain:nWidth - 2, 20 )  //oDlgNew:nGridRight
   oBarTitle:AddText( 20, 100, "Text Title", , , , , , CLR_WHITE, )

   USE CUSTOMER ALIAS CU

   oDlgNew:NewGrid( nSplit )
   oGrid:cAlias := "CU"
   aBrowse   := { { { || CU->FIRST }, i18n("First"), 150, 0 },;
                  { { || CU->LAST  }, i18n("Last"), 150, 0 },;
                  { { || CU->STREET}, i18n("Street"), 150, 0 },;
                  { { || CU->CITY } , i18n("City"), 150, 0 } }

   FOR i := 1 TO Len(aBrowse)
      oCol := oGrid:AddCol()
      oCol:bStrData := aBrowse[ i, 1 ]
      oCol:cHeader  := aBrowse[ i, 2 ]
      oCol:nWidth   := aBrowse[ i, 3 ]
      oCol:nDataStrAlign := aBrowse[ i, 4 ]
      oCol:nHeadStrAlign := aBrowse[ i, 4 ]
   NEXT

   oPanelRight:= TPanel():New( oBarTitle:nBottom + 2, nSplit + 2, oBarMain:nTop - 2, oDlgNew:nWidth - nSplit - 20, oDlgNew )
   oPanelRight:SetColor( CLR_WHITE, CLR_YELLOW )
   //oPanelRight := Load_Dialog( nSplit )

   @ oBarTitle:nBottom + 1, nSplit SPLITTER oSplit ;
        VERTICAL ;
        PREVIOUS CONTROLS oGrid ; //, oBarTitle ;
        HINDS CONTROLS oPanelRight ;
        LEFT MARGIN  2 ;
        RIGHT MARGIN 2 ;
        SIZE 1, Int( ( oDlgNew:nHeight - oBarTitle:nBottom ) / 2 ) - 12 ;
        COLOR CLR_GRAY PIXEL ;
        OF oDlgNew ;
        ON CHANGE ( oPanelRight:SetSize( oDlgNew:nWidth - oSplit:nRight - 4, oBarMain:nTop - 2 ), ;
                    oFld:SetSize( oPanelRight:nWidth - 4, oPanelRight:nHeight - oBarMain:nHeight + 8 ) )

   //oSplit := TSplitter():New( oBarTitle:nBottom+1, nSplit, (.not..F.) .or. .T.,{oGrid},.not..F.,;
   //                           { oPanelRight, oBarTitle },.not..F.,,,;
   //                                 oDlgNew,,1,oDlgNew:nGridBottom ,;
   //                                 .T.,.T.,,.F.,.T.,.T. )

   ACTIVATE DIALOG oDlgNew NOWAIT ; //      ON PAINT ( oSplit:AdjClient() ) ;
      ON INIT ( Load_Dialog( nSplit ), oGrid:SetFocus(), ResizeWndMain() ) ;
      VALID ( oGrid:nLen := 0, DbCloseAll(), oDlgNew := NIL, .t. )


return nil

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

Function Load_Dialog( nSplit )
   
   @ 2, 2 FOLDER oFld ITEMS  "Anagrafica","Rapporti Commerciali","Varie";
      SIZE oPanelRight:nWidth / 2 + 12, oPanelRight:nHeight / 2 - 22  PIXEL;
      OF oPanelRight ;
      OPTION 1
   
   //oPanelRight:oClient:=  oFld

return oFld

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

Function ResizeWndMain()
   /*
   local aClient
   IF oDlgNew != NIL
      aClient := GetClientRect ( oWndMain:hWnd )
      oDlgNew:SetSize( aClient[4], aClient[3] - oBar:nHeight - oWndMain:oMsgBar:nHeight+1 - oBartitle:nBottom)
      IF oSplit  != NIL
         oSplit:Refresh()
      ENDIF
      IF oBarTitle != nil
         oBarTitle:SetSize(aClient[ 2 ],40)
         oBarTitle:Refresh()
      ENDIF
      IF oGrid  != NIL
         oGrid:SetSize( aClient[ 3 ]- oGrid:nLeft, oDlgNew:nHeight -oBartitle:nBottom)
         oGrid:Refresh()
      ENDIF
      if oPanelRight != nil
         oPanelRight:SetSize( aClient[ 4 ]- oPanelRight:nLEFT,oDlgNew:nHeight- oBartitle:nBottom)
         oPanelRight:Refresh()
      endif
      oWndMain:oMsgBar:Refresh()
      SysRefresh()
   ENDIF
   */

return nil

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

CLASS TFsdi FROM TDialog
   
   DATA nGridBottom, nGridRight
   CLASSDATA lRegistered AS LOGICAL

   METHOD New( oWnd, lPixels ) CONSTRUCTOR
   METHOD AdjClient() // INLINE oApp():oWndMain:AdjClient()
   METHOD NewGrid( nSplit )
ENDCLASS


METHOD New( oWnd ) CLASS TFsdi
   
   local   aClient
   DEFAULT oWnd   := oWndMain // GetWndDefault()
   aClient        := GetClientRect ( oWnd:hWnd )
   ::oWnd         := oWnd
   ::nTop         := 0
   ::nLeft        := 0
   ::nBottom      := oBarMain:nTop //aClient[ 3 ] - 1
   ::nRight       := aClient[ 4 ]
   ::nStyle       := nOR( WS_CHILD, 4 )
   ::lHelpIcon    := .f.
   ::lTransparent := .f.

   DEFINE FONT ::oFont NAME 'Tahoma' SIZE 0, -12

   ::nGridBottom  := (::nBottom / 2) - oBarMain:nHeight
   ::nGridRight   := (::nRight / 2 )
   ::aControls    := {}
   ::SetColor( CLR_WHITE, GetSysColor(15) )
   ::Register( nOr( CS_VREDRAW, CS_HREDRAW ) )
     SetWndDefault( Self )
     return Self

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

METHOD NewGrid( nSplit ) CLASS TFsdi
   
   WITH OBJECT ( oGrid := TXBrowse():New( oDlgNew ) )
      :nTop    := oBarTitle:nBottom
      :nLeft   := 02
      :nBottom := Int( ( oBarMain:nTop - :nTop ) / 2 ) + 12 //oDlgNew:nGridBottom
      :nRight  := nSplit - 2 // oDlgNew:nGridRight
      :CreateFromCode()
   END

return nil

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

METHOD AdjClient() CLASS TFsdi
return nil

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

 

Re: Dialog, xbrowse,splitter,folder and ttitle

PostPosted: Wed Feb 07, 2018 3:47 pm
by Silvio.Falconi
>tfsdi
if you use a child window or tlayout it
I had m with !Alias dont't Exist" and others problems i never I understood why

>panel
to insert folder

your test run ok but

if you resize the main window you have this error

Image

but I wish this

Image

I made a function called ResizeWndMain() where I try to resize all

Re: Dialog, xbrowse,splitter,folder and ttitle

PostPosted: Wed Feb 07, 2018 4:24 pm
by cnavarro
Silvio.Falconi wrote:>

your test run ok but

if you resize the main window you have this error

I made a function called ResizeWndMain() where I try to resize all


That error?
I have commented on its function ResizeWndMain() because it is not possible to resize the xbrowse if you define a static position of the splitter
You have to define the position of the splitter proportionally to the width of the window

In my code, put this and look

Code: Select all  Expand view


   .../...
   oWndMain:bResized := oSplit:bChange      // Add this

   ACTIVATE DIALOG oDlgNew NOWAIT ;

   .../...
 

Re: Dialog, xbrowse,splitter,folder and ttitle

PostPosted: Wed Feb 07, 2018 5:45 pm
by Silvio.Falconi
cnavarro wrote:
Silvio.Falconi wrote:>

your test run ok but

if you resize the main window you have this error

I made a function called ResizeWndMain() where I try to resize all


That error?
I have commented on its function ResizeWndMain() because it is not possible to resize the xbrowse if you define a static position of the splitter
You have to define the position of the splitter proportionally to the width of the window

In my code, put this and look

Code: Select all  Expand view


   .../...
   oWndMain:bResized := oSplit:bChange      // Add this

   ACTIVATE DIALOG oDlgNew NOWAIT ;

   .../...
 

5


Is not possible resize the xbrowse???????
Strange ...i resize the xbrowse
Do you want see how?

Re: Dialog, xbrowse,splitter,folder and ttitle

PostPosted: Wed Feb 07, 2018 6:01 pm
by cnavarro
without changing position of splitter?

Re: Dialog, xbrowse,splitter,folder and ttitle

PostPosted: Wed Feb 07, 2018 9:39 pm
by Silvio.Falconi
cnavarro wrote:without changing position of splitter?


Yes see Alanit's applications

Re: Dialog, xbrowse,splitter,folder and ttitle

PostPosted: Wed Feb 07, 2018 11:25 pm
by cnavarro
Silvio.Falconi wrote:
cnavarro wrote:without changing position of splitter?


Yes see Alanit's applications


Not is possible
If position of splitter is 360 and not change position, xbrowse width is 360

Re: Dialog, xbrowse,splitter,folder and ttitle

PostPosted: Thu Feb 08, 2018 12:29 am
by Silvio.Falconi
Try with osplit:nleft;=arclient[4]/on resize

Re: Dialog, xbrowse,splitter,folder and ttitle

PostPosted: Thu Feb 08, 2018 1:23 am
by cnavarro
I think we do not talk about the same topic
If it works for you, perfect

Re: Dialog, xbrowse,splitter,folder and ttitle

PostPosted: Thu Feb 08, 2018 8:52 am
by Silvio.Falconi
Sorry I explain you bad
the project here run but I have only the explorerbar at left and xbrowse at right. on this project I use a splitter beetewen explorerbar and xbrowse
Now I wish modify this project add a TTitle on top, a xbrowse at left , a folder/explorerbar at right and a buttonbar at bottom . I wish crecreate the interface of an italian commercial application . I download this application and I saw there is not any splitter . the folder is near to scrollbar of the xbrowse as you can ssee here:
Image
Image
Image

I think the splitter is not necessary

When I try to resize my project all It not run well

I hope you understood my problem