to Nages:also for Vertical Xbrowse

to Nages:also for Vertical Xbrowse

Postby Silvio.Falconi » Tue Apr 30, 2013 3:30 pm

Dear Nages,
I explain you

I made this test :
On this test I open clienti.dbf and set array for the field I wish to show

I need to have this arrays (aCampi,aNomi,aSizes) to create the xbrowse Main

Function test()

aCampi := { "CODCF", "RAGSOC", "RAGSOC1", "INDIR" }
aNomi:= {"Codice","Ragione Sociale","Ragione Sociale2","Indirizzo Legale"}
aSizes:= {50,250 ,200,100 }

USE CLIENTI ALIAS CLIENTI NEW

LookUp("Clienti",aCampi,aNomi,aSizes,35.7,105,"Anagrafica clienti")

RETURN NIL



ON lookup function there is a xbrowse and a buttonbar


@ 15.6, 0 XBROWSE oBrw OF oDlgLook SIZE -1,-20 PIXEL ;
DATASOURCE cdbf ;
COLUMNS aCampi HEADERS aNomi COLSIZES aSizes



as you can see omn this picture

Image


When I click a button on Button Bar I call a function . this function read the xbrowse columns to create an array ( aarray) and then I cal the Ut_BrwColVert( aArray ) function

But I see only the fields and not the values


Function testsilvio(cDbf, oBrowse)
LOCAL nLen := Len( oBrowse:aCols )
LOCAL aHeader [ nLen ]
LOCAL aShow [ nlen ]

LOCAL aArray [ nLen ]

FOR n := 1 TO nLen
aHeader [ n ] := oBrowse:aCols[ n ]:cHeader
aShow [ n ] := oBrowse:aCols[ n ]:value
aArray [ n ] := {aHeader[n],aShow[n]}
NEXT

Ut_BrwColVert( aArray )
RETUR NIL


function Ut_BrwColVert( aCols )

local oDlg, oBrw, cAlias

cAlias := Alias()

DEFINE DIALOG oDlg SIZE 300,200 PIXEL TITLE cAlias
@ 10,10 XBROWSE oBrw SIZE -10,-10 PIXEL OF oDlg ;
DATASOURCE aCols ;
COLUMNS 1, { || ( cAlias )->&( oBrw:aRow[ 2 ] ) } ;
HEADERS "ColumnName", "ColumnValue" ;
CELL LINES NOBORDER

WITH OBJECT oBrw
:nStretchCol := 2
:CreateFromCode()
END

ACTIVATE DIALOG oDlg CENTERED ON INIT ( oBrw:SetFocus(), .f. )

return nil
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
User avatar
Silvio.Falconi
 
Posts: 7056
Joined: Thu Oct 18, 2012 7:17 pm

Re: to Nages:also for Vertical Xbrowse

Postby nageswaragunupudi » Wed May 01, 2013 3:54 am

If you want to use Ut_BrwColVert( aCols )
Instead of
Code: Select all  Expand view
FOR n := 1 TO nLen
aHeader [ n ] := oBrowse:aCols[ n ]:cHeader
aShow [ n ] := oBrowse:aCols[ n ]:value
aArray [ n ] := {aHeader[n],aShow[n]}
NEXT
 

Use the same arrays aNomi, aCampi
[code]FOR n := 1 TO nLen
aArray [ n ] := {aNomi[n],aCampi[n]}
NEXT

But to view Browse columns in a vertical form, there is another better alternate way.
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10632
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: to Nages:also for Vertical Xbrowse

Postby nageswaragunupudi » Wed May 01, 2013 5:07 am

Viewing a browse in a vertical form
Code: Select all  Expand view
//----------------------------------------------------------------------------//
#include "FiveWin.Ch"
#include "ord.ch"
#include "xbrowse.ch"

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

REQUEST DBFCDX

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

function Test2

   local oDlg, oBrw, oFont

   USE CUSTOMER NEW ALIAS CUST SHARED VIA "DBFCDX"
   GO TOP

   DEFINE FONT oFont NAME "TAHOMA" SIZE 0,-14
   DEFINE DIALOG oDlg SIZE 600,400 PIXEL FONT oFont
   @ 10,10 XBROWSE oBrw SIZE -10,-30 PIXEL OF oDlg ;
      DATASOURCE "CUST" ;
      COLUMNS "First", "Last", "State", "Salary" ;
      HEADERS "Name", "SurName", "State", "Salary" ;
      CELL LINES FASTEDIT NOBORDER

   oBrw:CreateFromCode()

   @ 180, 10 BUTTON "VertBrw" SIZE 40,12 PIXEL OF oDlg ACTION XbrVert( oBrw )

   ACTIVATE DIALOG oDlg CENTERED
   RELEASE FONT oFont

   CLOSE CUST

return nil

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

function XBrVert( oMain )

   local oDlg, oBrw, oFont

   DEFINE FONT oFont NAME "TAHOMA" SIZE 0,-14
   DEFINE DIALOG oDlg SIZE 600,600 PIXEL FONT oFont

   @ 10, 10 XBROWSE oBrw SIZE 280,280 PIXEL OF oDlg ;
      DATASOURCE oMain:aCols ;
      COLUMNS { || oBrw:aRow:cHeader }, { || oBrw:aRow:Value } ;
      HEADERS  "Column", "ColumnValue" ;
      CELL LINES NOBORDER FASTEDIT UPDATE

   WITH OBJECT oBrw
      :lHScroll       := .f.
      oBrw:aCols[ 1 ]:bClrStd := { || { CLR_BLACK, oBrw:nRecSelColor } }

      WITH OBJECT oBrw:aCols[ 2 ]
         :nEditType     := EDIT_GET
         :bOnPostEdit   := { |o,x,n| If( n != VK_ESCAPE, oBrw:aRow:VarPut( x ), nil ) }
         :bOnChange     := { || oMain:RefreshCurrent() }
      END
      //
      :CreateFromCode()
   END

   ACTIVATE DIALOG oDlg CENTERED ON INIT DlgInit( oBrw )
   RELEASE FONT oFont
   oMain:Refresh()
   oMain:SetFocus()

return nil

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

static function DlgInit( oBrw )

   local oDlg     := oBrw:oWnd
   local aDim     := { oBrw:nWidth, oBrw:nHeight }

   // ----- RESIZE DIALOG TO FIT THE CONTENTS OF BROWSE -------//

   oBrw:BrwFitSize( .t. )
   if oBrw:nWidth < 284
      oBrw:nWidth := 284
      oBrw:nStretchCol  := 2
   endif
   oDlg:nWidth    += ( oBrw:nWidth  - aDim[ 1 ] )
   oDlg:nHeight   += ( oBrw:nHeight - aDim[ 2 ] )

   WITH OBJECT oBrw
      :ColStretch()
      :oWnd:Center()
      :SetFocus()
   END

return .f.

//----------------------------------------------------------------------------//
 
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10632
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: to Nages:also for Vertical Xbrowse

Postby Silvio.Falconi » Wed May 01, 2013 4:05 pm

thanks Now I think I understood
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
User avatar
Silvio.Falconi
 
Posts: 7056
Joined: Thu Oct 18, 2012 7:17 pm

Re: to Nages:also for Vertical Xbrowse

Postby Silvio.Falconi » Thu May 02, 2013 11:23 am

Mr Nages,
I add on XBrVert if there is a field memo

for n := 1 to Len( oBrw:aCols )
if oBrw:aCols[ n ]:cDataType == 'M'
oBrw:aCols[ n ]:bStrData = GenLocalBlock( oBrw:aCols, n )
endif
next

function GenLocalBlock( aCols, n )
return { || If( Empty( Eval( aCols[ n ]:bEditValue ) ), "<memo>", "<Memo>" ) }


BUT I see the text [b]<binary> instead of <memo>[/b]

I wish to edit this field memo with a dialogbox as xrbwmemo.prg
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
User avatar
Silvio.Falconi
 
Posts: 7056
Joined: Thu Oct 18, 2012 7:17 pm

Re: to Nages:also for Vertical Xbrowse

Postby nageswaragunupudi » Thu May 02, 2013 11:26 am

Dear Friend Silvio

Till you forget bStrData you can never use XBrowse's real capacities.
I have been requesting you about this so many times.
Kindly observe my code.
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10632
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: to Nages:also for Vertical Xbrowse

Postby Silvio.Falconi » Thu May 02, 2013 11:42 am

opps sorry you're right
Isaw these lines on fwdbu ...sorry

and How I must make to show <memo> instead of <binary>

Image
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
User avatar
Silvio.Falconi
 
Posts: 7056
Joined: Thu Oct 18, 2012 7:17 pm


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 95 guests