A problem in xBrowse to change from Row to Col-preview ???

A problem in xBrowse to change from Row to Col-preview ???

Postby ukoenig » Wed Aug 27, 2008 9:59 pm

Hello,
i noticed a problem from changing Row- to Col-preview.

Row-Colors

Image

Column-Colors

Image

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.

Code: Select all  Expand view

....
....
....    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 :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.
User avatar
ukoenig
 
Posts: 4043
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany

Problem with Row / Column-Change

Postby ukoenig » 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.
User avatar
ukoenig
 
Posts: 4043
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany

Postby demont frank » Thu Aug 28, 2008 2: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) :

Code: Select all  Expand view
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()

demont frank
 
Posts: 167
Joined: Thu Mar 22, 2007 11:24 am

Postby nageswaragunupudi » Thu Aug 28, 2008 3: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
User avatar
nageswaragunupudi
 
Posts: 10316
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Switch between ROW and COL

Postby ukoenig » Thu Aug 28, 2008 5: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.
User avatar
ukoenig
 
Posts: 4043
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany

Switch from Col-display to Row-display is not working.

Postby ukoenig » Fri Aug 29, 2008 1: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 !!!!

Code: Select all  Expand view

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 :lol:
Last edited by ukoenig on Fri Aug 29, 2008 9:30 pm, edited 2 times in total.
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.
User avatar
ukoenig
 
Posts: 4043
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany

Switching from Row-preview to Col-preview

Postby ukoenig » Fri Aug 29, 2008 7: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 :

Image

Col-display :

Image

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 :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.
User avatar
ukoenig
 
Posts: 4043
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany

Re: A problem in xBrowse to change from Row to Col-preview ???

Postby TimStone » Wed Aug 26, 2009 7: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
User avatar
TimStone
 
Posts: 2909
Joined: Fri Oct 07, 2005 1:45 pm
Location: Trabuco Canyon, CA USA

Re: A problem in xBrowse to change from Row to Col-preview ???

Postby ukoenig » Wed Aug 26, 2009 9: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
Image

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

Code: Select all  Expand view

...
...
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 :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.
User avatar
ukoenig
 
Posts: 4043
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany

Re:

Postby dutch » Thu Aug 27, 2009 6: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: Select all  Expand view
oTbw:bClrStd    := {|| { iif( GST->GST_GSTYPE='V' , CLR_HRED , CLR_BLACK ), iif(oTbw:Keyno()%2 == 0,15122321,16509392) } }

Image

Regards,
Dutch
Regards,
Dutch

FWH 19.01 / 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)
User avatar
dutch
 
Posts: 1535
Joined: Fri Oct 07, 2005 5:56 pm
Location: Thailand

Re: A problem in xBrowse to change from Row to Col-preview ???

Postby nageswaragunupudi » Thu Aug 27, 2009 8: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
User avatar
nageswaragunupudi
 
Posts: 10316
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: A problem in xBrowse to change from Row to Col-preview ???

Postby dutch » 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 19.01 / 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)
User avatar
dutch
 
Posts: 1535
Joined: Fri Oct 07, 2005 5:56 pm
Location: Thailand


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: cmsoft and 76 guests