Page 3 of 10

Re: Grid2Print - Suggestions

Posted: Fri Aug 22, 2008 7:17 pm
by luisvasquezcl
Hi,
very good job.
the memo field will be supported.
regards,
Luis Vasquez

Re: Grid2Print - Suggestions

Posted: Fri Aug 22, 2008 7:49 pm
by esgici
Hi Rathi
You wrote:I take everything as entered in Grid and that too only string item grids.
Sorry, according to column headers I think that "digit only" cell are numeric in type.
By formatting you mean, formatting the numbers as given by the user as parameter for the function? Please give me syntax, so that I can proceed.
I mean by "formatting", converting a numeric value to a character string into more readable format. As you know, most easy way is using TRANSFORM() function. f.e:

TRANSFORM(123456, "$999,999") // Result: $123,456

or

nValue := 123456.789
TRANSFORM( nValue , "999,999.999") // Result: 123,456.789

Certainly, you can use any formatting method into gird. My suggestion is about formatting while building print/report.

BTW some random sights:

- Converting numeric value to "verbal" is a big task. But it is not related directly with printing, it made larger the program and get hard to understanding.

- Using very little ( even single letter ) variable names also get difficult to understanding.

- Since return always "True" , "iif(.t.,"True","False")" expression ( Sample.prg, line 27) is (sorry) meaningless.

Regards

--

esgici

Re: Grid2Print - Suggestions

Posted: Fri Aug 22, 2008 7:54 pm
by Roberto Lopez
rathinagiri wrote:Thank you Roberto. It is just a beginning. Long way to go.
Oh yes... nothing is ever finished :)

Regards,

Roberto.

Re: Grid2Print - Suggestions

Posted: Sat Aug 23, 2008 3:05 am
by Rathinagiri
Hi Esgici,

Thanks for your nice and exhaustive review.
esgici wrote:
I mean by "formatting", converting a numeric value to a character string into more readable format. As you know, most easy way is using TRANSFORM() function. f.e:

TRANSFORM(123456, "$999,999") // Result: $123,456

or

nValue := 123456.789
TRANSFORM( nValue , "999,999.999") // Result: 123,456.789

Certainly, you can use any formatting method into gird. My suggestion is about formatting while building print/report.
Yes. I am just working on that. :)
esgici wrote: BTW some random sights:

- Converting numeric value to "verbal" is a big task. But it is not related directly with printing, it made larger the program and get hard to understanding.

- Using very little ( even single letter ) variable names also get difficult to understanding.
Next version solves this. :)
esgici wrote: - Since return always "True" , "iif(.t.,"True","False")" expression ( Sample.prg, line 27) is (sorry) meaningless.
Yes. I will change.

Re: Grid2Print - Suggestions

Posted: Sat Aug 23, 2008 9:02 pm
by Roberto Lopez
rathinagiri wrote:
Thanks for your nice and exhaustive review.
Here is a modified grid2print for User Components Interface (UCI) demostration.

The sample assume that the method has only two user parametrs (Currently, Domethod function supports until four user parameters but grid2print requires seven).

The file 'i_UsrSOOP.ch' must be copied to c:\hmg\include.

So, you'll have a new method for grid control called 'Print'.

Regards,

Roberto.

Re: Grid2Print - Suggestions

Posted: Sat Aug 23, 2008 10:13 pm
by esgici
Roberto Lopez wrote: So, you'll have a new method for grid control called 'Print'.
Wonderful !.. :!: :D

Our new method work fine on official HMG Sample\Grid_1. Here sligthly modified version:

Code: Select all

/*

   Grid Test with GridPrint (UCI) Method 
   
   ( Based Upon official HMG Sample\Grid_1 )
   
*/

#include "minigui.ch"

Set Procedure To GridPrint.Prg

Function Main

Local aRows [20] [3]

    DEFINE WINDOW Form_1 ;
        AT 0,0 ;
        WIDTH 450 ;
        HEIGHT 420 ;
        TITLE 'Grid Test with GridPrint (UCI) Method ' ;
        MAIN 

        aRows [1]   := {'Simpson','Homer','555-5555'}
        aRows [2]   := {'Mulder','Fox','324-6432'} 
        aRows [3]   := {'Smart','Max','432-5892'} 
        aRows [4]   := {'Grillo','Pepe','894-2332'} 
        aRows [5]   := {'Kirk','James','346-9873'} 
        aRows [6]   := {'Barriga','Carlos','394-9654'} 
        aRows [7]   := {'Flanders','Ned','435-3211'} 
        aRows [8]   := {'Smith','John','123-1234'} 
        aRows [9]   := {'Pedemonti','Flavio','000-0000'} 
        aRows [10]  := {'Gomez','Juan','583-4832'} 
        aRows [11]  := {'Fernandez','Raul','321-4332'} 
        aRows [12]  := {'Borges','Javier','326-9430'} 
        aRows [13]  := {'Alvarez','Alberto','543-7898'} 
        aRows [14]  := {'Gonzalez','Ambo','437-8473'} 
        aRows [15]  := {'Batistuta','Gol','485-2843'} 
        aRows [16]  := {'Vinazzi','Amigo','394-5983'} 
        aRows [17]  := {'Pedemonti','Flavio','534-7984'} 
        aRows [18]  := {'Samarbide','Armando','854-7873'} 
        aRows [19]  := {'Pradon','Alejandra','???-????'} 
        aRows [20]  := {'Reyes','Monica','432-5836'} 
        
        aHeadArry := {'Last Name','First Name','Phone'}

        @ 10,10 GRID Grid_1 ;
        WIDTH 430 ;
        HEIGHT 330 ;
        HEADERS  aHeadArry;
        WIDTHS {140,140,140};
        ITEMS aRows ;
        VALUE 1 
        
        define button print
           row 345
           col 200
           caption "Print"
           action printsamplegrid()
        end button

    END WINDOW

    CENTER WINDOW Form_1

    ACTIVATE WINDOW Form_1

Return

function printsamplegrid

    Form_1.Grid_1.Print ( aHeadArry,{"C","C","C"} )

return nil

Thanks Roberto, thanks Rathinagiri

--

esgici

Re: Grid2Print - Suggestions

Posted: Sat Aug 23, 2008 10:36 pm
by Roberto Lopez
esgici wrote: I mean by "formatting", converting a numeric value to a character string into more readable format. As you know, most easy way is using TRANSFORM() function. f.e:

TRANSFORM(123456, "$999,999") // Result: $123,456

or

nValue := 123456.789
TRANSFORM( nValue , "999,999.999") // Result: 123,456.789
I'm afraid that I'm disagree with you....

IMHO a 'Print' method for a grid, must print grid data 'as is', in the same way that the data is being shown in the screen, with (perhaps) the exception, of some 'off grid' optional things like headers, footers, etc.

So, adding formating to 'Print' method could be redundant and/or unnecessary.

Again... "IMHO" :)

Regards,

Roberto.

Re: Grid2Print - Suggestions

Posted: Sat Aug 23, 2008 10:43 pm
by Roberto Lopez
rathinagiri wrote:Hi Friends,

Here comes the latest version of GridPrint with some bug fixes and changes:
A little bug.

When you select a big font size, causes preview problems:

Regards,

Roberto.

Re: Grid2Print - Suggestions

Posted: Sat Aug 23, 2008 10:50 pm
by esgici
Roberto Lopez wrote:...a 'Print' method for a grid, must print grid data 'as is', in the same way that the data is being shown in the screen,
ABSOLUTELY you are right ...

Moreover, everyone ( in our case every 'rutin' ) must know and realize its OWN duty. Formatting the data isn't one of printing "duty".

Regards

--

esgici

Re: Grid2Print - Suggestions

Posted: Sat Aug 23, 2008 10:55 pm
by esgici
Roberto Lopez wrote:
When you select a big font size, causes preview problems:
esgici wrote: ( At 13 Aug 2008 )
We ( Rathinagiri ) need a function such as

LenStrInPixel( <cString>, <aFont> ) --> <nLengthInPixel> (*)

(*) <aFont> : Font properties array: name, size, bold, italic ...
Regards

--

esgici