Hi,
I am testing XBrowse to evaluate a migration from the standard TcBrowse FWH class.
The first (and most important difference - and problem -) I found is this:
if I make an array browse and I need to add another element I already added it nto the array to do then a symply oBrw:SetArray(aUpdatedArray).
There are no problem to do this with TCBrowse but XBrowse delete all the header and size informations.
I'm using the November 2007 Xbrowse class,
is this changed with this lastest xBrowse's updates or is there any turn-around ?
Thanks.
This is a sample code that show the problem:
#include "FiveWin.ch"
#include "tcbrowse.ch"
static oWnd
static oBrw,aArray
//----------------------------------------------------------------------------//
function Main()
DEFINE WINDOW oWnd TITLE "Testing Keys";
MENU BuildMenu();
MDI
ACTIVATE WINDOW oWnd
return nil
Function Test()
aArray:={}
aadd(aArray,{1,"Henry"})
oBrw := TXBrowse():New( oWnd:oWndClient )
oBrw:SetArray( aArray)
oBrw:aCols[1]:cHeader := "Num"
oBrw:aCols[2]:cHeader := "Name"
oBrw:lRecordSelector := .f.
oBrw:nLastEditCol:=3
oBrw:nFreeze:=1
oBrw:CreateFromCode()
oBrw:Move(5,5,200,200)
@ 14, 4 BUTTON "&Add row" SIZE 100,80 OF OWND:oWndClient;
ACTION AddRow()
return nil
function BuildMenu()
local oMenu
local cAction
MENU oMenu
MENUITEM "TEST";
ACTION TEST()
ENDMENU
RETURN(OMENU)
Function AddRow()
aadd(aArray,{len(aArray)+1,"Henry"})
oBrw:SetArray(aArray)
oBrw:Refresh()
return
oBrw:SetArray(), differences beetween TCBrwose and XBrowse
- Marco Turco
- Posts: 858
- Joined: Fri Oct 07, 2005 12:00 pm
- Location: London
- Contact:
oBrw:SetArray(), differences beetween TCBrwose and XBrowse
Best Regards,
Marco Turco
SOFTWARE XP LLP
Marco Turco
SOFTWARE XP LLP
Ad a Array-element at runtime to xBrowse
Hello Marco,
I'm just busy, to create a tool for xbrowse.
As i have seen your message, i added a function
for a array test.
There was no problem to add a element at runtime.
I try, to send you a sample today.
Regards
Uwe
I'm just busy, to create a tool for xbrowse.
As i have seen your message, i added a function
for a array test.
There was no problem to add a element at runtime.
I try, to send you a sample today.
Regards
Uwe
Since 1995 ( the first release of FW 1.9 )
i work with FW.
If you have any questions about special functions, maybe i can help.
i work with FW.
If you have any questions about special functions, maybe i can help.
- Marco Turco
- Posts: 858
- Joined: Fri Oct 07, 2005 12:00 pm
- Location: London
- Contact:
Arrays in xbrowse at runtime
Hello
Here is just a sample
In the xbrowse-tool, EVERYTHING !!! has to work at runtime.
Many things i had to do, are complete different to normal
programming.
I think. maybe at weekend, you can have a look at the xBrowse-tool.
It is a extra applicatión now.
It is complete new done with folders, to try different things
like color-, font, style-changes and much more.
Regards
Uwe
Here is just a sample
Code: Select all
...
...
Local oDlg, oLbx1, oBtn1, aFont
oFont1 := TFont():New("Arial", ,-12,.F.,.T. , , , ,.F.)
// The Array 9 Rows and 5 Cols
// ----------------------------------------
PRIVAT aTEST[9][5]
aTEST[1] := { " 1", "Test1", "Test1", "Test1", "Test1" }
aTEST[2] := { " 2", "Test2", "Test2", "Test2", "Test2" }
aTEST[3] := { " 3", "Test3", "Test3", "Test3", "Test3" }
aTEST[4] := { " 4", "Test4", "Test4", "Test4", "Test4" }
aTEST[5] := { " 5", "Test5", "Test5", "Test5", "Test5" }
aTEST[6] := { " 6", "Test6", "Test6", "Test6", "Test6" }
aTEST[7] := { " 7", "Test7", "Test7", "Test7", "Test7" }
aTEST[8] := { " 8", "Test8", "Test8", "Test8", "Test8" }
aTEST[9] := { " 9", "Test9", "Test9", "Test9", "Test9" }
// xBrowse
// COLOR1 and COLOR2 are two Colors for different Row-colors
// ----------------------------------------------------------------------------------
oLbx1 := TXBrowse():New( oDlg )
oLbx1:nMarqueeStyle := MARQSTYLE_HIGHLROW
oLbx1:nColDividerStyle := LINESTYLE_BLACK
oLbx1:nRowDividerStyle := LINESTYLE_BLACK
oLbx1:SetArray( aTEST )
oLbx1:lVScroll := .T.
oLbx1:lHScroll := .F.
oLbx1:lFooter := .T.
// Define alternating row colors
// -------------------------------------
oLbx1:bClrStd := {|| IF ( EVAL ( oLbx1:bKeyno, NIL, oLbx1 ) %2 == 0, ;
{ CLR_BLACK, COLOR1 }, { CLR_BLACK, COLOR2 } ) }
for nFor := 1 to Fcount()
oLbx1:aCols[ nFor ]:cHeader := Padr("Font 1", 11)
oLbx1:aCols[ nFor ]:oDataFont = oFont1
next
// From Resource ID-no 110
// -----------------------------------
oLbx1:CreateFromResource( 110 )
// Start No
// ----------
nNO := 9
// Send a new Array-element to oLbx1 with a button
// ---------------------------------------------------------
REDEFINE BUTTONBMP oBtn1 ID 270 OF oDlg1 ;
ACTION ( nNO++, cTest := "Test" + LTRIM( str(nNO) ), ;
AADD( aTEST, { LTRIM( STR(nNO) ), cTest, cTest, cTest, cTest } ), ;
oLbx1:Gobottom(), oLbx1:Refresh() ) ;
BITMAP "color_5" PROMPT " &Add Array" TEXTRIGHT
oBtn:cToolTip = { "Add 1 Array-Element to Browser 1", ;
"Add Array", 1, CLR_BLACK, 14089979 }
Many things i had to do, are complete different to normal
programming.
I think. maybe at weekend, you can have a look at the xBrowse-tool.
It is a extra applicatión now.
It is complete new done with folders, to try different things
like color-, font, style-changes and much more.
Regards
Uwe
Since 1995 ( the first release of FW 1.9 )
i work with FW.
If you have any questions about special functions, maybe i can help.
i work with FW.
If you have any questions about special functions, maybe i can help.
- nageswaragunupudi
- Posts: 8017
- Joined: Sun Nov 19, 2006 5:22 am
- Location: India
- Contact:
There have been lots of improvements in array browses in Xbrowse.
Simplest way is
@ 0,0 XBROWSE oBrw OF oWnd ARRAY aData [AUTOCOLS] [AUTOSORT]
AUTOCOLS adds all columns. AUTOSORT sets sort on columns.
If we want to add only selected columns, but not all columns :
@ 0,0 XBROWSE oBrw COLUMNS 5,4,3 HEADERS "Five","Four","Three" OF oWnd
The data can be any data type and we need not even convert them to character values.
After setting up the browse we can add any more columns either by command
ADD TO oBrw ARRAY ELEMENT 8 PICTURE "9999" HEADER "Eight"
[or ]
oCol := oBrw:AddCol()
oCol:nArrayCol := 8 // no need to define complex codeblocks
oCol:cEditPicture := "99999"
oCol:cHeader := "Eight"
The new command syntax enables reducing long complex coding to just a few lines. Also the command syntax is very similar to the well known LISTBOX syntax and TCColumn browse syntax making migration very fast and easy
Simplest way is
@ 0,0 XBROWSE oBrw OF oWnd ARRAY aData [AUTOCOLS] [AUTOSORT]
AUTOCOLS adds all columns. AUTOSORT sets sort on columns.
If we want to add only selected columns, but not all columns :
@ 0,0 XBROWSE oBrw COLUMNS 5,4,3 HEADERS "Five","Four","Three" OF oWnd
The data can be any data type and we need not even convert them to character values.
After setting up the browse we can add any more columns either by command
ADD TO oBrw ARRAY ELEMENT 8 PICTURE "9999" HEADER "Eight"
[or ]
oCol := oBrw:AddCol()
oCol:nArrayCol := 8 // no need to define complex codeblocks
oCol:cEditPicture := "99999"
oCol:cHeader := "Eight"
The new command syntax enables reducing long complex coding to just a few lines. Also the command syntax is very similar to the well known LISTBOX syntax and TCColumn browse syntax making migration very fast and easy
Regards
G. N. Rao.
Hyderabad, India
G. N. Rao.
Hyderabad, India
- Marco Turco
- Posts: 858
- Joined: Fri Oct 07, 2005 12:00 pm
- Location: London
- Contact:
- nageswaragunupudi
- Posts: 8017
- Joined: Sun Nov 19, 2006 5:22 am
- Location: India
- Contact: