Xbrowse < :nColSel > col-pos change at runtime rel. to index

Xbrowse < :nColSel > col-pos change at runtime rel. to index

Postby ukoenig » Sat Mar 03, 2018 1:12 pm

Hello,

I got a problem to change the Col-position at runtime
On startup it is OK

There is a RUNTIME-change of < FILE + INDEX >

ON INIT

:nRowSel := nGoRecord :D
:nColSel := nOrder :D
:SetGroupHeader( "Workarea ==> " + DBF() + " Index ==> " + (cFileName)->(INDEXKEY(nOrder)) + ;
" Order ==> " + ALLTRIM( STR( (cFileName)->(INDEXORD()) ) ) )

---------------------------------

The File-change and indexord at runtime on RADIO-selection
The file- and index-change works but impossible to adjust the column-position.

DBSELECTAREA(cFileName), ; // new file
(cFileName)->(DBSETORDER(nOrder)), ; // start-index
oBrw:SetGroupHeader( "Workarea ==> " + DBF() + " Index ==> " + (cFileName)->(INDEXKEY(nOrder)) + ;
" Order ==> " + ALLTRIM( STR( (cFileName)->(INDEXORD()) ) ) ), ;
oBrw:nColSel := nOrder, ; :(
oBrw:Refresh(), ;
...
...

Sample2 shows the col-position of sample1 needed to be moved to 5 like on INIT opening sample2 (works :D )

Image
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: Xbrowse < :nColSel > col-pos change at runtime rel. to index

Postby nageswaragunupudi » Sat Mar 03, 2018 8:41 pm

oBrw:nColSel := <newval>
oBrw:Refresh()
works and should work at runtime also.
Please recheck.
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10620
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: Xbrowse < :nColSel > col-pos change at runtime rel. to index

Postby ukoenig » Sun Mar 04, 2018 11:02 am

Mr. Rao,

Maybe it is possible to FORCE a column-headerclick after selecting a new file to activate the index in :

Code: Select all  Expand view

@ 518, 935  RADIO oFilename VAR nFilename PROMPT "Samples1", "Samples2", "Samples3", "Samples4", ;
                  "Samples5", "Samples6", "Samples7" _3D SIZE 80, 25 ;
HELPID 100, 101, 102, 103, 104, 105, 106 OF oDlg PIXEL UPDATE ;
ON CHANGE ( SAVE_SYS(nOFilename), ; // saves old values before reading the new ones.
      nOFilename := nFilename, ;
      READ_SYS(.T.), ; // reading the NEW values
      DBSELECTAREA(cFileName), ;
      oBrw:SetGroupHeader( "Workarea ==>  " + DBF() + "       Index ==>  " + (cFileName)->(INDEXKEY(nOrder)) + ;
      "       Order ==>  " + ALLTRIM( STR( (cFileName)->(INDEXORD()) ) ) ), ;  
      XBRW_COLOR( oBrw ), oDlg:UPDATE(), ;
      oBrw:aCols[nOrder]:bClrStd := {|| { 0, aVal[32] } } )
 


something like ( used on another situation to auto-move to the next cell ) :?:

:aCols[nOrder]:bGetChange := {| k, f, o, oCol | If( Len( RTrim( o:oGet:Buffer ) ) == Len( o:oGet:Buffer ),;
( o:SendMsg( WM_KEYDOWN, VK_RETURN ) ), ) }



I still noticed another problem
I added a new color to show the column with the active index different
Once a column is colored I cannot reset on index-change to the row-colors
The old column still shows the color.
On column-change I call the ROW-paining but the old COLUMN-color is not deleted.

Image

I added / tested :

I := 1
FOR I := 1 TO 8
oBrw :aCols[I]:bClrStd := {|| { NIL, NIL } }
NEXT

It clears the col-color but the row-colors are missing / not repainted

Code: Select all  Expand view

INDEX-change !!!

AEval( oBrw:aCols, { |o| o:bLClickHeader := {|r,c,f,o| XBRW_COLOR( oBrw ), ; // painting ROW-colors
     nOrder := o:nCreationOrder, ;
     (cFileName)->(DBSETORDER(nOrder)), ;
     o:bClrStd := {|| { 0, aVal[32] } }, ; // COLUMN-color for INDEX
     oBrw:SetGroupHeader( "Workarea ==>  " + DBF() + "       Index ==>  " + ; // header-title refreshed
     (cFileName)->(INDEXKEY(nOrder)) + "       Order ==>  " + ;
     ALLTRIM( STR( (cFileName)->(INDEXORD()) ) ) ) } } )

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

FUNCTION XBRW_COLOR( oBrw )

// to clear / reset the column-colors
//I := 1
//FOR I := 1 TO 8
//  oBrw    :aCols[I]:bClrStd := {|| { NIL, NIL } }
//NEXT

// ROW - colors
oBrw    :bClrRowFocus   := { || { aVal[31], aVal[29] } } // light red
oBrw    :bClrStd        := { || If( oBrw:KeyNo() % 2 == 0, ;
                    { If( ( oBrw:cAlias )->( Deleted() ), 255, aVal[31] ), aVal[27] }, ; // light blue
                    { If( ( oBrw:cAlias )->( Deleted() ), 255, aVal[31] ), aVal[28] } ) } // light blue
oBrw    :bClrSel        :=  ;
oBrw    :bClrSelFocus   := { || { If( ( oBrw:cAlias )->( Deleted() ), 255, aVal[31] ), aVal[30] } } // light green
oBrw    :nClrText       := aVal[31]

oBrw:Refresh()

RETURN NIL
 


regards
Uwe :?:
Last edited by ukoenig on Wed Mar 14, 2018 10:02 am, 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

Re: Xbrowse < :nColSel > col-pos change at runtime rel. to index

Postby nageswaragunupudi » Sun Mar 04, 2018 3:54 pm

For changing DBF, please try
Code: Select all  Expand view
@ 518, 935  RADIO oFilename VAR nFilename PROMPT "Samples1", "Samples2", "Samples3", "Samples4", ;
                  "Samples5", "Samples6", "Samples7" _3D SIZE 80, 25 ;
HELPID 100, 101, 102, 103, 104, 105, 106 OF oDlg PIXEL UPDATE ;
ON CHANGE ChangeDBF( oBrw, nFileName )


function ChangeDBF( oBrw, nFileName )

   local cAlias   := "Samples" + Str( nFileName, 1, 0 )
   local cTag     := ( cAlias )->( OrdName() )

   oBrw:cAlias := cAlias
   oBrw:aCols[ 1 ]:cGrpHdr := "WorkArea ==> " + oBrw:cAlias + ;
                  "   Index ==> " + ( oBrw:cAlias )->( OrdKey() ) + ;
                  "   Order ==> " + ( oBrw:cAlias )->( OrdNumber() )
                 
   AEval( oBrw:aCols, { |o| o:cOrder := If( o:cSortOrder == cTag, "A", "" ) } )
   oBrw:Refresh()              

return nil
 
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10620
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: Xbrowse < :nColSel > col-pos change at runtime rel. to index

Postby nageswaragunupudi » Sun Mar 04, 2018 4:04 pm

If you want to have a different color for indexed column, do like this:
Code: Select all  Expand view

// When creating the browse;
   AEval( oBrw:aCols, { |o| o:bClrStd := FnClrStdBlock( o ) } )
   
//
function FnClrStdBlock( oCol )
return { || If( Empty( oCol:cOrder ), If( oCol:oBrw:KeyNo() % 2 == 0, { nClr1, nClr2 }, { nClr3, nClr4 } ), { nIdxClr1, nIdxClr2 } ) }
 


You do not need to change the colors again when index is changed or when DBF is changed
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10620
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: Xbrowse < :nColSel > col-pos change at runtime rel. to index

Postby ukoenig » Sun Mar 04, 2018 6:29 pm

Mr. Rao,

thank You very much for the solutions
it works great and I got the needed results :D :D :D
Now colors can be a combination of changing a column-color related to the index on row ( zebra ) colors.
It seems setting the column-focus on filechange is working now with these changes.
Still some finetuning to do before publishing the new release.

Changing the index-order on headerclick

Image

regards
Uwe :D
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: Xbrowse < :nColSel > col-pos change at runtime rel. to index

Postby ukoenig » Wed Mar 14, 2018 10:03 am

Mr. Rao,

It works perfect with DBF's but
is it possible to change the column-color on headerclick as well using ARRAYS :?:

Image

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

Re: Xbrowse < :nColSel > col-pos change at runtime rel. to index

Postby nageswaragunupudi » Thu Mar 15, 2018 12:43 am

The logic I provided works with all.
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10620
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: Xbrowse < :nColSel > col-pos change at runtime rel. to index

Postby ukoenig » Thu Mar 15, 2018 11:03 am

I used sample xBcell.prg ( array-sample) and added the lines
doesn't work only the row-colors are ok :(

Code: Select all  Expand view

#include "fivewin.ch"
#include "xbrowse.ch"

function TestMain()

   local oWnd
   local oBrw
   local oBar
   local lEmpty := .f.
   
   local aArray := {}
   
   DEFINE WINDOW oWnd TITLE "Testing Autosave Data"
   
 
   if empty( aArray )                          
      aArray := {{"one","two","three","four"},;
        {"one","two","three","four"},;
        {"one","two","three","four"},;
        {"one","two","three","four"}}    
   endif
   
   @ 0,0 XBROWSE oBrw OF oWnd ;
      COLUMNS {1,2,3,4} ;
      HEADERS {"Activated-1","Activated-2","Deactivated-1","DeActivated-2"} ;
      array aArray LINES CELL fastedit
   
   oBrw:aCols[ 1 ]:lAutoSave := .t.
   oBrw:aCols[ 2 ]:lAutoSave := .t.
     
   aeval( oBrw:aCols, { |oCols| oCols:nEditType := EDIT_GET } )

// changing column-color !!!
   AEval( oBrw:aCols, { |o| o:bClrStd := FNCLRSTDBLOCK( o ) } )

   oWnd:oClient := oBrw
   
   oBrw:createfromcode()
   
   activate window oWnd
   
return nil

// ---------

FUNCTION FNCLRSTDBLOCK( oCol )

RETURN { || If( Empty( oCol:cOrder ), If( oCol:oBrw:KeyNo() % 2 == 0, ;
{ 0, 15263976 }, { 0, 16772055 } ), { 0, 255 } ) }

 


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

Re: Xbrowse < :nColSel > col-pos change at runtime rel. to index

Postby nageswaragunupudi » Thu Mar 15, 2018 12:23 pm

Please add the clause AUTOSORT to the XBROWSE command.
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10620
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: Xbrowse < :nColSel > col-pos change at runtime rel. to index

Postby ukoenig » Thu Mar 15, 2018 2:15 pm

Thank You very much
it is working now using arrays

Code: Select all  Expand view
Please add the clause AUTOSORT to the XBROWSE command.


regards
Uwe :D
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: Xbrowse < :nColSel > col-pos change at runtime rel. to index

Postby nageswaragunupudi » Thu Mar 15, 2018 2:50 pm

Uwe
Please suggest some good sites for downloading free icons for my applications.
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10620
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: Xbrowse < :nColSel > col-pos change at runtime rel. to index

Postby ukoenig » Thu Mar 15, 2018 3:01 pm

Simply the best 590,912 icons and 2,443 iconsets
includes everything You need

http://www.iconarchive.com/

regards
Uwe :D
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: Xbrowse < :nColSel > col-pos change at runtime rel. to index

Postby ukoenig » Fri Mar 16, 2018 7:06 pm

Rao,

I noticed the link above includes a mixture of free and commercial icons

from a german webside ( absolutely free )
99,454 icons

https://de.freepik.com/freie-ikonen

I will add some more links

regards
Uwe :D
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: Xbrowse < :nColSel > col-pos change at runtime rel. to index

Postby nageswaragunupudi » Fri Mar 16, 2018 7:09 pm

Thank you
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10620
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Next

Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 33 guests