Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Outsider Project - Generic Print for a Grid

Status
Not open for further replies.

benman

Programmer
May 3, 2006
35
HK
Hi All:

Currently I am developing a VFP system on my own from scratch, with a layout familiar to everyone.

What has been developed are:
1) selector
6 sections x 6 subsections, selecting 36 pages of view/filter combinations.
2) a grid control displaying database for browsing.
3) double click the grid record to display a form for database maintenance, with ColumnCount being -1, and memberclass pointing to predefined Column library in a prg. 4) Generic Find bar for the Grid

What I want to do now is Generic Print on what it is in the Grid.

I can write prg code: use current table, list according to the field, compare line number & line printed and so on.

Is it possible to use report form or any other generic methodogy to have it done ?

Any comment/advice to enlighten the project to move forward, inclusive design, beauty & code ...

Print.jpg
 
Hi Mike :

Probably I have to subscribe.

Any other recommendations ? :)

Benman
 
Hi Mike :

This is what I got now with assistance of your article.

For your information.

Benman

preview.jpg
 

Hi Benman,

Don't forget that you can always adjust the template to improve the appearance of the report. You can also change the code, of course.

Since this particular report only has five fields, and since these are fairly narrow, the report would benefit by widening the columns. That way, you would avoid the ugly wrapping of the phone numbers.

Mike


__________________________________
Mike Lewis (Edinburgh, Scotland)

My Visual FoxPro site: www.ml-consult.co.uk
 
Hi Mike :

Feels better, isn't it.

preview2.jpg

Benman
 
Hi Mike :

Any Idea to format numeric field into XXX,XXX.XX by code ?

Many thanks.

Benman

preview3.jpg
 

Hi Benman,

Any Idea to format numeric field into XXX,XXX.XX by code ?

You can store them as formatted strings in your cursor. To convert the numeric to a formatted string, do something like:

TRANSFORM(MyNumeric, "999,999.99")

Alternatively, open the template in the report designer, open the Format dialogue for the field in question, and insert the format 99,999,999.99.

Unfortunately, that won't be generic. It will only work for other reports if they use the same column for numeric fields.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

My Visual FoxPro site: www.ml-consult.co.uk
 
Hi Mike :


* Point the new record to the field in the cursor
REPLACE Expr WITH "TRANSFORM("+laWidths(lnI,1)+")"

* Insert the width and horizontal position into the field
REPLACE HPos WITH lnHpos, Width WITH lnWidth

* Insert the font size
REPLACE fontsize WITH laConv(lnConvPointer,2)

Following your code,

REPLACE picture WITH something Might serve well to extend the generic function

Anyway, it would be a good try...

Generic way of programming is more preferable than specific from my point of view.

Benman
 
HI Mike :

IF lnI > 1
* New record
APPEND BLANK
GATHER MEMO NAME loRecord
ELSE
* Re-use model record
LOCATE FOR "FIELD" $ UPPER(ALLTRIM(comment))
ENDIF

* Point the new record to the field in the cursor
m.cField = laWidths(lnI,1)
m.cField1 = &lcAlias..&cField
IF VARTYPE(cField1) = "N"
REPLACE Expr WITH laWidths(lnI,1)
REPLACE FillChar WITH "N"
REPLACE PICTURE WITH ["] + DBGETPROP(lcAlias + "." + laWidths(lnI,1), "FIELD","InputMask") + ["]
ELSE
REPLACE Expr WITH "TRANSFORM("+laWidths(lnI,1) +")" &&lnI
ENDIF

Above code was added there and it works well now.

preview4.jpg


Still look clumpsy on my coding.

hehe.

Benman
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top