FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour A problem in xBrowse to change from Row to Col-preview ???
Posts: 4043
Joined: Wed Dec 19, 2007 06:40 PM
A problem in xBrowse to change from Row to Col-preview ???
Posted: Wed Aug 27, 2008 09:59 PM
Hello,
i noticed a problem from changing Row- to Col-preview.

Row-Colors



Column-Colors



The switching works only once. I can switch from Row-colors to Col-colors.
To switch back from Cols to Rows, doesn't work.
The Browser shows still the Col-colors after switching.

....
....
....    THE SWITCH SELECTION ------

oLbx14 := TXBrowse():New( oFld:aDialogs[3] )
oLbx14:nMarqueeStyle := MARQSTYLE_HIGHLROW
oLbx14:nColDividerStyle	 := LINESTYLE_BLACK
oLbx14:nRowDividerStyle := LINESTYLE_BLACK
oLbx14:SetArray( aBRSTYLE1 )
oLbx14:aCols[ 1 ]:cHeader = Padr("No.", 3)
oLbx14:aCols[ 2 ]:cHeader = Padr("Style", 20)
oLbx14:nRecSelColor = 15512898 
oLbx14:bClrSelFocus = { || { 16777215, 15512898 } } 
oLbx14:bClrSel = { || { 16777215, 15512898 } } 
oLbx14:lHScroll := .F.
oLbx14:lVScroll := .F.
oLbx14:lFooter := .T.
oLbx14:nFooterHeight := 15

oLbx14:bLClicked := { | nRow, nCol | ( BR_STYLE1 := oLbx14:nRowSel, ;
   IIF( BR_STYLE1 = 1, BRW_ROWS(oLbx0), BRW_COLS(oLbx0) ) ) }

oLbx14:aCols[ 2 ]:AddResource("Horizont")
oLbx14:aCols[ 2 ]:AddResource("Vertikal")
oLbx14:aCols[ 2 ]:bBmpData := {|| oLbx14:nArrayAt }
oLbx14:aCols[ 2 ]:bStrData := {|| oLbx14:aRow[2] }   

oLbx14:nArrayAt := 1
oLbx14:nRowSel := 1

oLbx14:CreateFromResource( 140 )

....
....
....

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

FUNCTION BRW_ROWS(oLbx0)

oLbx0:bClrStd := {|| IF ( EVAL ( oLbx0:bKeyno, NIL, oLbx0 ) %2 == 0, ;
    { ROW_TEXT, ROW_COL1 }, { ROW_TEXT, ROW_COL2 } ) }

oLbx0:Refresh()

MsgAlert( "Row-Colors","Attention" )

RETURN( NIL )

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

FUNCTION BRW_COLS(oLbx0)

oLbx0:aCols[ 1 ]:bClrStd := {|| { ROW_TEXT, ROW_COL1 } }
oLbx0:aCols[ 2 ]:bClrStd := {|| { ROW_TEXT, ROW_COL2 } }
oLbx0:aCols[ 3 ]:bClrStd := {|| { ROW_TEXT, ROW_COL1 } }

oLbx0:Refresh()

MsgAlert( "Column-Colors","Attention" )

RETURN( NIL )


// --------  a TEST-FUNCTION --------------------------------

FUNCTION SWITCHTEST(oLbx0)

oLbx0:bClrStd := {|| IF ( EVAL ( oLbx0:bKeyno, NIL, oLbx0 ) %2 == 0, ;
                                    { ROW_TEXT, ROW_COL1 }, { ROW_TEXT, ROW_COL2 } ) }

oLbx0:Refresh()

MsgAlert( "ROW" )

oLbx0:aCols[ 1 ]:bClrStd := {|| { ROW_TEXT, ROW_COL1 } }
oLbx0:aCols[ 2 ]:bClrStd := {|| { ROW_TEXT, ROW_COL2 } }
oLbx0:aCols[ 3 ]:bClrStd := {|| { ROW_TEXT, ROW_COL1 } }

oLbx0:Refresh()

MsgAlert( "COL" )

// -----   From this point no change  !!!!  --------------

oLbx0:bClrStd := {|| IF ( EVAL ( oLbx0:bKeyno, NIL, oLbx0 ) %2 == 0, ;
                                    { ROW_TEXT, ROW_COL1 }, { ROW_TEXT, ROW_COL2 } ) }

oLbx0:Refresh()

MsgAlert( "ROW" )

oLbx0:aCols[ 1 ]:bClrStd := {|| { ROW_TEXT, ROW_COL1 } }
oLbx0:aCols[ 2 ]:bClrStd := {|| { ROW_TEXT, ROW_COL2 } }
oLbx0:aCols[ 3 ]:bClrStd := {|| { ROW_TEXT, ROW_COL1 } }

oLbx0:Refresh()

MsgAlert( "COL" )

RETURN( NIL )


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.
Posts: 4043
Joined: Wed Dec 19, 2007 06:40 PM
Problem with Row / Column-Change
Posted: Thu Aug 28, 2008 12:59 PM

Hello,

After some more tests, i found the situation for the problem :

I start a browser with col-display like this :

oLbx0:aCols[ 1 ]:bClrStd := {|| { ROW_TEXT, ROW_COL1 } }
oLbx0:aCols[ 2 ]:bClrStd := {|| { ROW_TEXT, ROW_COL2 } }
oLbx0:aCols[ 3 ]:bClrStd := {|| { ROW_TEXT, ROW_COL1 } }
oLbx0:Refresh()

After showing the col-display, i change to row-display.

oLbx0:bClrStd := {|| IF ( EVAL ( oLbx0:bKeyno, NIL, oLbx0 ) %2 == 0, ;
{ ROW_TEXT, ROW_COL1 }, { ROW_TEXT, ROW_COL2 } ) }
oLbx0:Refresh()

Nothing happens.

If i do it the other way : changing from Row-display to Col-display,
it works.

What can be wrong ?

Regards
Uwe :lol:

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.
Posts: 167
Joined: Thu Mar 22, 2007 11:24 AM
A problem in xBrowse to change from Row to Col-preview ???
Posted: Thu Aug 28, 2008 02:49 PM
I think that after oCol:bClrStd is set it has preference on oBrw:bClrStd.

When a column is created the default value from oCol:bClrStd is oBrw:bClrStd , this means that oCol:bClrStd is only set when it is nil

Maybe you have always to set oCol:bClrStd (for each column) :

FOR EACH oCol IN oLbx0:aCols
  oCol:bClrStd := {|| IF ( EVAL ( oLbx0:bKeyno, NIL, oLbx0 ) %2 == 0, { ROW_TEXT, ROW_COL1 }, { ROW_TEXT, ROW_COL2 } ) } 
NEXT
oLbx0:Refresh()
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
A problem in xBrowse to change from Row to Col-preview ???
Posted: Thu Aug 28, 2008 03:22 PM

>
I think that after oCol:bClrStd is set it has preference on oBrw:bClrStd.

When a column is created the default value from oCol:bClrStd is oBrw:bClrStd , this means that oCol:bClrStd is only set when it is nil
>
Yes. For obvious reasons.

>
IF ( EVAL ( oLbx0:bKeyno, NIL, oLbx0 ) %2 == 0,
>
Simpler way to write this is " If( oLbx0:KeyNo() % 2 == 0 ), ....... "

>
Maybe you have always to set oCol:bClrStd (for each column) :
>
That is one way of doing it.
But more elegant way is something like this:

nClr1 := .... , nClr2 := .... , nClr3 := ... , nClr4 := ....

oCol:bClrStd := { || If( oLbx:KeyNo() % 2 == 0, { nCrl1, nClr2 }, {nClr3,nClr4} }

After this we do not have to change the code blocks.
Simply assign whatever new colors we want to nClr1, nClr2, etc.
Browse will automatically paint with whatever colors the variables nClr1, nClr2, ... etc. represent.

This would be the simplest way and code also is much more clear.

Note:
I have a slightly different way of programming.

local aClrCol := { { clr1, clr2 }, { clr3, clr4 } }

oCol:bClrStd := { || aClrCol[ oBrw:KeyNo % 2 + 1 ] }

Now whenever I need, I just change the value of the relevant element in the array aClrCol. Example: aClrCol[ 2 ][ 2 ] := CLR_YELLOW

Now next refresh will use this color

Regards



G. N. Rao.

Hyderabad, India
Posts: 4043
Joined: Wed Dec 19, 2007 06:40 PM
Switch between ROW and COL
Posted: Thu Aug 28, 2008 05:04 PM

Thank you very much for all the help.

The work on the tools i can finish with this solution.
Nearly all possible xBrowse-settings are tested and can
be changed at runtime.

This weekend, i create a download-link in the forum,
hoping, the tools will be a help for the users.

The final release will come after FWH-version 8.09 is out,
because Antonio want's to fix the brush-problem :
adjustment to data-area-size.

Best Regards
Uwe :lol:

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.
Posts: 4043
Joined: Wed Dec 19, 2007 06:40 PM
Switch from Col-display to Row-display is not working.
Posted: Fri Aug 29, 2008 01:08 PM
Hello,

I changed the function BRW_HORIZ( oLbx0 ).
The row-color-changes working fine.

But there is still the problem :
After switching to => BRW_VERTIC(oLbx0)
the Row-display changes to Col-display.
Calling BRW_HORIZ(oLbx0) again,
the browser is not repainted.

A download of the tools
( nearly finished, the final-version comes this weekend ).
If you like to view the problem on Folderpage 3 :

This Version is for testing at runtime !!
http://www.pflegeplus.com/fw_download/testbrw.zip

A version with dialog-preview :
http://www.pflegeplus.com/fw_download/Browsetest1.zip

BRW_HORIZ(oLbx0) ==> display is ok
BRW_VERTIC(oLbx0) ==> display is ok
BRW_HORIZ(oLbx0) ==> doesn't work anymore !!!!

FUNCTION BRW_HORIZ(oLbx0)
LOCAL hDC

aClrCol := { { ROW_TEXT, ROW_COL1 }, { ROW_TEXT, ROW_COL2 } } 
oLbx0:bClrStd := { || aClrCol[ oLbx0:KeyNo % 2 + 1 ] } 

oLbx0:Refresh()

RETURN( NIL )

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

FUNCTION BRW_VERTIC(oLbx0)

Maybe to have something like in BRW_HORIZ(oLbx0)
for Col-color-changing ???

// --------- CHANGES every 2. Column -------------------------------

FUNCTION BRW_VERTIC(oLbx0)
LOCAL nFOR

aClrCol := { { ROW_TEXT, ROW_COL1 }, { ROW_TEXT, ROW_COL2 } } 
lSELECT := .T.
FOR nFOR := 1 TO LEN( oLbx0:aCols )
   IF lSELECT = .T. 
      oLbx0:aCols[nFOR]:bClrStd := { || aClrCol[ nFOR % 2 + 1 ] }
      lSELECT := .F.
   ELSE
      oLbx0:aCols[nFOR]:bClrStd := { || aClrCol[ nFOR % 2 + 2 ] }
      lSELECT := .T.
   ENDIF
NEXT

oLbx0:Refresh()

RETURN( NIL )


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.
Posts: 4043
Joined: Wed Dec 19, 2007 06:40 PM
Switching from Row-preview to Col-preview
Posted: Fri Aug 29, 2008 07:17 PM
Hello,

It seems, there is another runtime problem like the left record-bar :

I changed the display from runtime to a extra dialog ( same like for the Rec-bar ).
There it works.
You can test this version, if you like :

Download :
http://www.pflegeplus.com/fw_downloads/Browsetest1.zip

Row-display :



Col-display :



With this solution, i can switch as often as i like.

When it isn't possible, to do this with the main-browser,
that wouldn't be nice, because it can be,
i want to show special values in a colored Column and
switch back to row-display.

Maybe any solution ?

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.
Posts: 3022
Joined: Fri Oct 07, 2005 01:45 PM
Re: A problem in xBrowse to change from Row to Col-preview ???
Posted: Wed Aug 26, 2009 07:11 PM

In the example above, you use

oLbx0:bClrStd := { || aClrCol[ oLbx0:KeyNo % 2 + 1 ] }

I don't see KeyNo as a data holder in xBrowse. There is a function. Can you explain this to me, or is there a change necessary for xbrowse ?

I also noticed that the alternating color bars for xbrowse using this method don't always alternate. I assume that is the result of non-displayed, but deleted, records in the database.

Tim Stone
http://www.MasterLinkSoftware.com
http://www.autoshopwriter.com
timstone@masterlinksoftware.com
Using: FWH 23.10 with Harbour 3.2.0 / Microsoft Visual Studio Community 2022-24 32/64 bit
Posts: 4043
Joined: Wed Dec 19, 2007 06:40 PM
Re: A problem in xBrowse to change from Row to Col-preview ???
Posted: Wed Aug 26, 2009 09:01 PM
Hello Tim,

there is nothing to add or to change.
You can use the sample testxbr2.prg for a Test and add some lines.

Row-Color-Change


Column-Color-Change
( Add the Line for < Lost-Focus-Color > from Your other Question )


Code (fw): Select all Collapse
...
...
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 

// Choose the Color-Display You need.
// Add these Lines :
// --------------------
// BRW_VERTIC(oBrw)
BRW_HORIZ(oBrw)

oBrw:CreateFromCode() 
...
...
// --------------------------------------------

FUNCTION BRW_HORIZ(oBrw)
LOCAL hDC
LOCAL aClrCol := { { 0, 15122321 }, { 0, 16509392 } } 

oBrw:bClrStd := { || aClrCol[ oBrw:KeyNo % 2 + 1 ] } 

oBrw:Refresh()

RETURN( NIL )

// --------- CHANGES every 2. Column -------------------------------

FUNCTION BRW_VERTIC(oBrw)
LOCAL nFOR
LOCAL aClrCol := { { 0, 15122321 }, { 0, 16509392 } } 

lSELECT := .T.
FOR nFOR := 1 TO LEN( oBrw:aCols )
   IF lSELECT = .T. 
      oBrw:aCols[nFOR]:bClrStd := { || aClrCol[ nFOR % 2 + 1 ] }
      lSELECT := .F.
   ELSE
      oBrw:aCols[nFOR]:bClrStd := { || aClrCol[ nFOR % 2 + 2 ] }
      lSELECT := .T.
   ENDIF
NEXT

oBrw:Refresh()

RETURN( NIL )


Best 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.
Posts: 1598
Joined: Fri Oct 07, 2005 05:56 PM
Re:
Posted: Thu Aug 27, 2009 06:58 AM
Dear Rao,

nageswaragunupudi wrote:>
oCol:bClrStd := { || If( oLbx:KeyNo() % 2 == 0, { nCrl1, nClr2 }, {nClr3,nClr4} }


I've used this following but it shows below image. What's wrong? oTbw:KeyNo() is show on the most right column.
Code (fw): Select all Collapse
oTbw:bClrStd    := {|| { iif( GST->GST_GSTYPE='V' , CLR_HRED , CLR_BLACK ), iif(oTbw:Keyno()%2 == 0,15122321,16509392) } }



Regards,
Dutch
Regards,

Dutch



FWH 2304 / xHarbour Simplex 1.2.3 / BCC73 / Pelles C / UEStudio

FWPPC 10.02 / Harbour for PPC (FTDN)

ADS V.9 / MySql / MariaDB

R&R 12 Infinity / Crystal Report XI R2

(Thailand)
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: A problem in xBrowse to change from Row to Col-preview ???
Posted: Thu Aug 27, 2009 08:12 AM

Mr Dutch

If you are using ADSCDX of RDDADS, you experience this problem. In that case, replace "obrw:keyno" in your expression as "(oBrw:cAlias)->( OrdKeyNo() )"
This gives correct count for the color block

Regards



G. N. Rao.

Hyderabad, India
Posts: 1598
Joined: Fri Oct 07, 2005 05:56 PM
Re: A problem in xBrowse to change from Row to Col-preview ???
Posted: Thu Aug 27, 2009 11:45 AM

Dear Rao,

Yes, master. You are absolutely right. I used "ADSCDX" and your comment is correctly.

Thanks master,
Dutch

Regards,

Dutch



FWH 2304 / xHarbour Simplex 1.2.3 / BCC73 / Pelles C / UEStudio

FWPPC 10.02 / Harbour for PPC (FTDN)

ADS V.9 / MySql / MariaDB

R&R 12 Infinity / Crystal Report XI R2

(Thailand)

Continue the discussion