Page 1 of 1

DCBROWSE fit fields

Posted: Sat Feb 28, 2015 9:31 am
by Victorio
Hi,
How can I set automatic width of columns to view all contents ?
I do not want set it with parameter WIDTH, because I use PIXEL and counting width if I do not know type of font is a little problem.
In browser I see contents of field btw 123... and not 1234567

In my source is some like this
@pozypa,pozxpa DCBROWSE oBrowsepa ALIAS "CPARCELY" ;
SIZE rozxpa,rozypa PIXEL ;
NOSOFTTRACK ;
SCOPE ;
OPTIMIZE ;
CURSORMODE XBPBRW_CURSOR_ROW

DCBROWSECOL FIELD CPARCELY->CPAU WIDTH 80;
HEADER "Parcela "

DCGETOPTIONS PIXEL ;
WINDOWCOL aPos[1]+10 ;
WINDOWROW aPos[2]+10 ;
WINDOWWIDTH aSize[1]*0.95 ;
WINDOWHEIGHT aSize[2]*0.95 ;
TABSTOP AUTORESIZE

DCREAD GUI ;
OPTIONS GetOptions ;
MODAL ;
FIT ;
EVAL {|o|SetAppFocus(oBrowsepa:GetColumn(1))}

Re: DCBROWSE fit fields

Posted: Sat Feb 28, 2015 11:36 am
by Victorio
I found here this :
"Use the OPTIMIZE clause of @ .. DCBROWSE.
This will optimize a column when double-clicked in the header.
To force a column to optimize on startup:
DCBROWSECOL EVAL {|o|PostAppEvent(xbeM_DblClick,{0,0},,o:heading)}" autod rdonnay.

Is possible some other way ? I mean automatic for all fields, without putting this to every DCBROWSECOL ?

Re: DCBROWSE fit fields

Posted: Sun Mar 01, 2015 6:33 pm
by rdonnay
There are 2 ways you can do this:

1. Set the browse column width to the field width.

DCBROWSECOL FIELD CPARCELY->CPAU WIDTH Len(CPARCELY->CPAU) HEADER "Parcela "

This will only work well if you have a fixed font such as Lucida Console or Courier New.

2. Optimize the columns after building the browse.

DCREAD GUI ... EVAL {|o|oBrowsepa:optimize(), SetAppFocus(oBrowsepa:GetColumn(1))}

This will only work well if it is not a large database. It requires stepping through all the columns and every database record.

Re: DCBROWSE fit fields

Posted: Mon Mar 02, 2015 1:52 am
by Victorio
ThankĀ“s,
I will try both tips.

btw: I found parameter SAYWIDTH , and if I use this with zero :
DCGETOPTIONS AUTORESIZE SAYFONT "10.Arial CE" SAYWIDTH 0

it works fine but I must test every situations.


Large database : I am using database about 30 to 100MB, sometimes also 500MB