TwBrowse - SaveColSize - SaveColOrder - header

TwBrowse - SaveColSize - SaveColOrder - header

Postby fp » Tue Mar 21, 2006 11:09 am

How can I save the size and the order of TwBrowse-columns (changed from the user) and restore it by the next call?

How to show a column-header with two or three lines - and centered?

Thanks
Frank-Peter
User avatar
fp
 
Posts: 76
Joined: Fri Dec 30, 2005 10:25 am
Location: Germany

Postby James Bott » Wed Mar 22, 2006 5:00 pm

I have had this on my To Do list for a long time. However, I am not sure it is possible with TWBrowse. The preprocessor converts the list of fields to a codeblock which is then passed to the new() method as bLine. There is no storage of the field list in the class and there is no way to parse the list back out of the codeblock that I know of. I could be wrong.

I think the class would have to be modified to use an array instead of a codeblock.

The workaround is probably to use a different browse, like TCBrowse which doesn't use a codeblock.

James
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Postby reinaldocrespo » Wed Mar 22, 2006 9:00 pm

fp;

Probably not the answer you're looking for; xbrowse already has it implemented:

METHOD SaveState() CLASS TXBrowse

Saves order, size, and other properties. And it works. You can even save/restore states per user.


Best,


Reinaldo.
User avatar
reinaldocrespo
 
Posts: 974
Joined: Thu Nov 17, 2005 5:49 pm
Location: Fort Lauderdale, FL

Postby DanielPuente » Sat Mar 25, 2006 5:16 am

Frank:

The columns, sizes and alignments can be arrays of codeblocks, so if you define your browses this way:

Code: Select all  Expand view
    LOCAL  VEC_FIELD:={{ || IF((cAlias)->ESTADO=='C','Cerrado','Abierto') } ,;
                                 { || (cAlias)->PUNTOVTA  } ,;
    LOCAL VEC_ENC  :=  { oemtoansi("Estado"),;
                                 "Punto"+CRLF+"Venta" ,;
LOCAL   aSizes:={80,50, ... }

          REDEFINE LISTBOX oBrwMov fields  ID 999  OF oDlg ;
          ALIAS (cALIAS) ;
         COLOR CLR_BLACK, CLR_WHITE UPDATE ;
          ON DBLCLICK EditaTurno( @fCantI,@fCantE,oBrwMov, oBrwMov:nColAct, EVAL(VEC_FIELD[oBrwMov:nColAct]), .T.,cAlias )

oBrwMov:SetCols( VEC_FIELD, VEC_ENC, aSizes )


You can read those values from an ini file or dbf perfectly.

And for example if the user changes the size of a column before closing the dialog you can ask the browse for the column sizes values, and save the new values of the array to a dbf or ini file (oBrwMov:aColsizes).

To use a multiline header you only need to use CRLF, like "Punto"+CRLF+"Venta" ,; that is a multiline header. And to jusfify you can use:

Code: Select all  Expand view
            oBrwMov:aHJustify    := {2, 2, 0, 1 }
            oBrwMov:aJustify     := {2, 2, 0, 1 }


0=Left, 1=right, 2=centered

Regards,
Daniel Puente
Mar del Plata, Argentina
danielpuente@speedy.com.ar
puenteda@hotmail.com
DanielPuente
 
Posts: 108
Joined: Sun Oct 09, 2005 6:12 pm
Location: Mar del Plata - Argentina

Postby fp » Sat Mar 25, 2006 6:58 am

Hello Daniel

thank you very much.

That is a super complete answer to my questions and the help, I need for my project.

Regards from Germany
Frank-Peter
User avatar
fp
 
Posts: 76
Joined: Fri Dec 30, 2005 10:25 am
Location: Germany


Return to FiveWin for Harbour/xHarbour

Who is online

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