DCBROWSE fit fields

This forum is for eXpress++ general support.
Post Reply
Message
Author
Victorio
Posts: 631
Joined: Sun Jan 18, 2015 11:43 am
Location: Slovakia

DCBROWSE fit fields

#1 Post 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))}

Victorio
Posts: 631
Joined: Sun Jan 18, 2015 11:43 am
Location: Slovakia

Re: DCBROWSE fit fields

#2 Post 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 ?

User avatar
rdonnay
Site Admin
Posts: 4734
Joined: Wed Jan 27, 2010 6:58 pm
Location: Boise, Idaho USA
Contact:

Re: DCBROWSE fit fields

#3 Post 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.
The eXpress train is coming - and it has more cars.

Victorio
Posts: 631
Joined: Sun Jan 18, 2015 11:43 am
Location: Slovakia

Re: DCBROWSE fit fields

#4 Post 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

Post Reply