Page 1 of 1

Some xBrowse-Tests ( with Version 8.03 )

Posted: Sun Mar 16, 2008 10:02 pm
by ukoenig
Hello,

I did some tests with the new xbrowse-options
The cell-formating is working fine now.

Something else i noticed :
At first, i didn't see any color squares.
I had to draw a black frame around the color-box.
After that, it was ok.

Image

PRIVATE aCOLTWAHL[9][2]

aCOLTWAHL[1] := { "1", "White" }
aCOLTWAHL[2] := { "2", "Black" }
aCOLTWAHL[3] := { "3", "Blue" }
aCOLTWAHL[4] := { "4", "Green" }
aCOLTWAHL[5] := { "5", "Red" }
aCOLTWAHL[6] := { "6", "Yellow" }
aCOLTWAHL[7] := { "7", "Magenta" }
aCOLTWAHL[8] := { "8", "Cyan" }
aCOLTWAHL[9] := { "9", "SELECT" }


// Text-Color
s_COLTWAHL := e_COLTWAHL // Default value

oBrw2 := TXBrowse():New( oDlg5 )
oBrw2:nMarqueeStyle := MARQSTYLE_HIGHLROW
oBrw2:nColDividerStyle := LINESTYLE_BLACK
oBrw2:nRowDividerStyle := LINESTYLE_BLACK
oBrw2:SetArray( aCOLTWAHL )
oBrw2:aCols[ 1 ]:cHeader = Padr("No.", 3)
oBrw2:aCols[ 2 ]:cHeader = Padr("Select", 16)
oBrw2:lHScroll := .F.
oBrw2:lVScroll := .F.
oBrw2:aCols[ 1 ]:bClrStd := {|| {CLR_BLACK, ;
IIF( oBrw2:nArrayAt = s_COLTWAHL, CLR_YELLOW, CLR_WHITE ) } }
oBrw2:bLClicked := { | nRow, nCol | e_COLTWAHL := oBrw2:nRowSel }
oBrw2:aCols[ 2 ]:AddResource("White")
oBrw2:aCols[ 2 ]:AddResource("Black")
oBrw2:aCols[ 2 ]:AddResource("Blue")
oBrw2:aCols[ 2 ]:AddResource("Green")
oBrw2:aCols[ 2 ]:AddResource("Red")
oBrw2:aCols[ 2 ]:AddResource("Yellow")
oBrw2:aCols[ 2 ]:AddResource("Magenta")
oBrw2:aCols[ 2 ]:AddResource("Cyan")

// This is new !!!
// METHOD aRow INLINE ( ::aArrayData[ ::nArrayAt ] ) // to make the coding easy

oBrw2:aCols[ 2 ]:bBmpData := {|| oBrw2:nArrayAt }
oBrw2:aCols[ 2 ]:bStrData := {|| aCOLTWAHL[oBrw2:nArrayAt][2] }

oBrw2:CreateFromResource( 600 )

I wanted to change nArrayAt with aRow.
I got a Error.
( oBrw2:nArrayAt works perfect )
for me it doesn't matter, to carry on, using oBrw:nArrayAt

ERROR !!! If using => oBrw2:aRow

Application
==========
Path and name : D:\_VDESIGN\Designer.exe (32 bits)
Größe : 1,951,232 bytes
Time from start : 0 hours 0 mins 0 secs
Error occurred at : 16.03.08, 21:44:57
Error description : Error BASE/1068 Argument error: array access
Args:
[ 1] = A { ... }
[ 2] = A { ... }

Stack Calls
===========
Called from : designer.PRG => (b)INIT_BAR(606)
Called from : XBROWSE.PRG => TXBRWCOLUMN:DATAWIDTH(0)
Called from : XBROWSE.PRG => TXBRWCOLUMN:ADJUST(0)
Called from : XBROWSE.PRG => TXBROWSE:ADJUST(0)
Called from : XBROWSE.PRG => TXBROWSE:INITIATE(0)
Called from : => __OBJSENDMSG(0)
Called from : HARBOUR.PRG => OSEND(0)
Called from : HARBOUR.PRG => ASEND(0)
Called from : DIALOG.PRG => TDIALOG:INITIATE(0)
Called from : DIALOG.PRG => TDIALOG:HANDLEEVENT(0)
Called from : => DIALOGBOX(0)
Called from : DIALOG.PRG => TDIALOG:ACTIVATE(0)
Called from : designer.PRG => INIT_BAR(922)
Called from : designer.PRG => (b)MAIN(358)
Called from : WINDOW.PRG => TWINDOW:ACTIVATE(0)
Called from : designer.PRG => MAIN(358)

Regards
Uwe :lol:
[/img]

Posted: Sun Mar 16, 2008 10:27 pm
by James Bott
Uwe,

>At first, i didn't see any color squares.
I had to draw a black frame around the color-box.
After that, it was ok.

This is probably because the upper left pixel of a bitmap is used to determine the transparent color. In your case the pixel was the same as the rest of the bitmap so it was all drawn transparent. When you added a black border, the upper left pixel was black so all the black border was transparent.

James

Posted: Sun Mar 16, 2008 10:47 pm
by nageswaragunupudi
oBrw:aRow is working for me. That is to be used in the place of oBrw:aArrayAt[ oBrw:nArrayAt ].

For example,
oBrw2:aCols[ 2 ]:bStrData := {|| aCOLTWAHL[oBrw2:nArrayAt][2] }
can be written as :
oBrw2:aCols[ 2 ]:bStrData := {|| oBrw:aRow[ 2 ] }

Also now, there is even a simpler way:

oBrw:aCols[2]:nArrayCol := 2
Browse does rest of the work.

This can even be written as

Code: Select all

REDEFINE XBROWSE oBrw2 ID <ID> ;
HEADERS "No.", "Select          " ;
OF oDlg5 ;
ARRAY aCOLTWAHL AUTOCOLS
It is also necessary that all the column values be character data only. Browse is formatting and aligning the data appropriately.



Now we have to handle the bmpdata only

XBrowse - Tests

Posted: Sun Mar 16, 2008 10:59 pm
by ukoenig
Thank you very much everybody for the Informations.

To show the black frame, i used a darkblue pixel for the left corner.
Now the boxes are ok.

Image

( I see, the black square has to get a blue pixel as well )

Regards
Uwe :lol: [/img]

Posted: Sun Mar 16, 2008 11:13 pm
by nageswaragunupudi
Very nice Mr. Ukoenig

Posted: Mon Mar 17, 2008 3:45 pm
by James Bott
Uwe,

>To show the black frame, i used a darkblue pixel for the left corner.

I notice that you can see the missing darkblue pixel. For a better display leave the black border upper left pixel as black and add a darkblue border. This way the entire darkblue border will be transparent and all of the black border will show.

For the black color, I would make it one pixel higher and wider, then add the darkblue border.

James