XBrowse creation – a small helptool

XBrowse creation – a small helptool

Postby Otto » Wed Oct 31, 2007 10:08 pm

1) Create a xBrowse with all the fields from your database

FWH-sample testxbr2.prg
Modified:

prg-file->http://www.atzwanger.com/fw/testxbr.prg
prg- + exe-file ->http://www.atzwanger.com/fw/samples.zip

oBrw:SetRDD()

for nFor := 1 to len( oBrw:aCols )
oCol := oBrw:aCols[ nFor ]
oCol:nEditType := 1
oCol:bOnPostEdit := {|o, v, n| iif( n != VK_ESCAPE, FieldPut( o:nCreationOrder, v ), ) }
next

2) Start your xBrowser. Right click to the header and select the columns you will show in your final program. Drag & drop the columns to the order you would like them to display and resize the columns and rows.

Image

3) Call the the function: f_SaveState(oBrw) which you have to insert into the program which copies a prototype for your xbrowse to the clipboard.

oBrw:nRowHeight := 18
// 2
oCol := oBrw:AddCol()
oCol:cHeader := "LAST"
oCol:bStrData := { || _FIELD->LAST}
oCol:nWidth := 146
// 1
oCol := oBrw:AddCol()
oCol:cHeader := "FIRST"
oCol:bStrData := { || _FIELD->FIRST}
oCol:nWidth := 146
...


****************************************************
func f_SaveState(oBrw)
****************************************************
local oCol
local cState
local nFor, nLen
local cdata
local oClp

nLen := Len( oBrw:aCols )
cState := "oBrw:nRowHeight := " + Ltrim( Str( oBrw:nRowHeight ) ) +CRLF
cState += CRLF

for nFor := 1 to nLen
oCol := oBrw:aCols[ nFor ]

if oCol:lHide = .F. // show only the visible ones

cState = cState+ " // " + Ltrim( Str( oCol:nCreationOrder ) ) + CRLF

cState += 'oCol := oBrw:AddCol()' + CRLF
cState += 'oCol:cHeader := "' + oCol:cHeader +'"'+ CRLF
//Todo Check the Field Valuetype
cState += "oCol:bStrData := { || _FIELD->" + oCol:cHeader +"}" + CRLF
cState += "oCol:nWidth := " + Ltrim( str( oCol:nWidth ) ) + CRLF
cState += CRLF
else
cState += "// " + Ltrim( Str( oCol:nCreationOrder ) ) + CRLF
cState += "// H " + oCol:cHeader

cState += CRLF
endif
if nFor < nLen
cState += CRLF
endif

next
DEFINE CLIPBOARD oClp OF oWnd
oClp:Clear()
oClp:SetText( cState )

msginfo("Structure to Clipboard")



return cState
User avatar
Otto
 
Posts: 6327
Joined: Fri Oct 07, 2005 7:07 pm

Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: nageswaragunupudi and 93 guests