PlanetSquires Forums

Support Forums => Other Software and Code => Topic started by: Anonymous on November 02, 2004, 11:44:51 PM

Title: DDOC
Post by: Anonymous on November 02, 2004, 11:44:51 PM
Does someone have an example for using Don's DDOC with Firefly.

I am just not sure were to begin. Does it need a libray?

Thanks in advance.

Blair
Title: DDOC
Post by: Anonymous on November 03, 2004, 05:27:43 AM
Have you tried contacting the author, Don Dickinson?

http://home.greatwebdivide.com/current/

I know Don is a member of these forums, but he might miss your post. Best to contact him direct with any questions.

I use DDOC with FireFly but I don't feel I have enough expertise to be able to speak authoritatively on the subject.

Andrew
Title: DDOC
Post by: John Messingham on November 03, 2004, 08:20:01 AM
There is an include file that comes with the dll.
Title: Simple Example Would Work.
Post by: Anonymous on November 03, 2004, 11:24:39 AM
Just a simple example would work for me.

In the Doc's there is an example to open a blank print preview screen.

That would be all I need, I could figure out the rest..

I did not even know that you needed a inc file.

Thanks

Blair.
Title: DDOC
Post by: Don Dickinson on November 03, 2004, 12:00:51 PM
hi,
to compile an app with ddoc, add ddoc_p32.inc to your project.  if there are #if's in it that say ...

%DDOC_P32_INC = 1

'- the declarations


remove the conditional compilation per paul's firefly instructions. i can't recall if all versions of ddoc have this or not.
when you distibute ddoc, put ddoc.exe and ddoc32.dll in your application's directory. on the development machine you might just want to put both in your windows\system32 directory.

i use ddoc with firefly all the time. it works just fine.

best regards,
dno
Title: One Button & Form
Post by: Anonymous on November 03, 2004, 11:06:30 PM
Ok,

What would a guy do to make DDOC work if, you had 1 form with one button.

When the button is pushed the ddoc preview screen pops up with the
word "Hello World"

On the system drive I have placed ddoc.exe, ddoc32.dll and ddoc_p32.inc in a folder called DDOC.

thanks

Blair
Title: DDOC
Post by: Don Dickinson on November 04, 2004, 12:24:10 PM
copy ddoc.exe and ddoc32.dll to either your application directory or windows\system32
include ddoc_p32.inc in your project (after removing the conditional compiles as specified above).

in the button press code do this ...

dim hPrev as integer

hPrev = dpStartDoc(0, "Hello", "", %DDOC_INCH, %DDOC_PAPER_LETTER, %DDOC_PORTRAIT, %DDOC_SYSTEM_DEFAULT, 0)

dpText hPrev, 1, 1, %DDOC_LEFT, "Hello world"
dpEndDoc hPrev, %DDOC_END_DELETE + %DDOC_END_VIEW


best regards,
don
Title: Thanks
Post by: Anonymous on November 04, 2004, 10:52:50 PM
Don,

Thanks for the example, it will go far in helping me and others using
DDOC with Firefly.

Thanks so much

Blair
Title: Ok, I got it working But,
Post by: Anonymous on November 06, 2004, 01:38:27 PM
Ok I got it work on a simple example however I am trying to expand
it to pull it all the records of a database.

I know all the database code works, when I change the variable cl to 1 I get the last record in the database on the print preview screen.

However, when I try to using the simple loop of adding 0.1667 to cl I get a blank preview screen why?

I have included my code below.

Function FRMLABOUR_COMMAND6_BN_CLICKED (ControlIndex As Long, hWndForm As Dword, hWndControl As Dword, idButtonControl As Long) As Long  

Dim hPrev As Integer
 
Dim cl  As Single

cl = 1

FF_Adorecordset_MoveFirst lpRecordset

While Not FF_AdoRecordset_EOF(lpRecordset)    


           
FF_AdoRecordset_GetCollect lpRecordset,"Code:", vCode
FF_AdoRecordset_GetCollect lpRecordset,"For Rate:", vFor
FF_AdoRecordset_GetCollect lpRecordset,"Bud Rate:", vBud
FF_AdoRecordset_GetCollect lpRecordset,"Description:", vDescription

hPrev = dpStartDoc(0, "Labour", "", %DDOC_INCH, %DDOC_PAPER_LETTER, %DDOC_PORTRAIT, %DDOC_SYSTEM_DEFAULT, 0)
                                     
dpSetTabs hPrev, "L1W2 L2W1 L3W1 L4W3"                                  
 
dpTabText hPrev, cl, Variant$(vCode) + Chr$(9) + Variant$(vFor) + Chr$(9) + Variant$(vBud)+Chr$(9) + Variant$(vDescription) +Chr$(9)

cl = cl + 0.16667

FF_Adorecordset_MoveNext lpRecordset

Wend  

dpEndDoc hPrev, %DDOC_END_DELETE + %DDOC_END_VIEW                  
End Function

What I am doing wrong, I also have change the display to show me the value of cl at the end and, I get 6.66678 which represents 34 records. The number of records in the datasbase.

Thanks

Blair
Title: Some more information.
Post by: Anonymous on November 06, 2004, 01:41:57 PM
What I get is the last record of the database printed
at the 6.6 inch mark.

Blair
Title: DDOC
Post by: Anonymous on November 06, 2004, 02:44:37 PM
Blair,
This is clearly a problem which doesn't involve FireFly or other PlanetSquires product. Would it not be sensible to discuss the issue with the author of DDOC to get further assistance?

People come to the PlanetSquires forum to seek assistance on products products by Paul Squires, and it is somewhat disingeneous to use the forums for supporting other products.

Andrew
Title: No
Post by: Anonymous on November 06, 2004, 03:03:59 PM
No, I disagree with you.

People come here to learn how to make Firefly work with other programs.

People that are just learning would not be able to see and learn from other
people's code mistakes if I contacted the author directly.

When I was trying to get DDOC to work the first place I came was here, seeing no information I created the post.

People who come behind me will learn a great deal from this post.

I could have posted it on Powerbasic site and I still might but I started here.
Title: Re: No
Post by: Anonymous on November 06, 2004, 11:13:54 PM
Quote from: BlairNo, I disagree with you

Then we will have to agree to disagree.

You asked a very relevant question to begin with, and received great advice about using DDOC which would certainly be of use to others. I have no problem with that at all. However you then extended the question to say "okay, got it working, now can you tell me how to do all these more difficult things please?".

Your problem is not with FireFly at all. The problem you are having is with a 3rd party library which you have chosen to add to your project files. I think it is a bit rich for you to be attempting to use the forums for non-trivial questions about using a 3rd party product. Paul Squires has to pay to support these forums, and many developers around the world have to pay to download the content.

You may not think my comments are relevant, which is your privilege. However please remember that when people come to these forums, the forum list shows a different coloured icon where new messages exist in that forum. You then have to click on that forum to see what the new messages are about. Here in the UK (and in many other countries) people who access the Internet via dial-up modems are paying for connection time by the minute, so requiring them to spend time and money to follow links about non-relevant material is quite bad mannered towards others.

Let's not fall out about it, I simply state that if you have a problem understanding how to use a 3rd party product then it would seem reasonable to me that you discuss that further with the author of that product. YMMV.

Andrew
Title: DDOC
Post by: Haakon Birkeland on November 07, 2004, 02:26:49 PM
I might be wrong I am not in front of my dev computer but I have some code sampleyou have put StartDoc in a loop. this should be before the loop. then print your data and when the loop is completed close the doc.
bert
QuotehFile% = DPSTARTDOC(0, "Sheet Metal Estimate", zTemp, %DDOC_INCH, 0, %DDOC_LANDSCAPE, 0, %DDOC_ZOOMFIT )

IF hFile% < 1 THEN
   MSGBOX "Error:" + STR$(hFile%)
ELSE
   
    'Load Variables from record information
   CALL XDBMOVEFIRST(db1&, idxH6&)
     'First System Name (used for multiple system names to include multiple summaries)
   System_Name(Ctr) = TRIM$(XDBFIELDVALUE$(db1&, "", 8))
   Page_Number = 1
   GOSUB Print_Page_Header
   GOSUB Print_One_Liners
   SELECT CASE PreviewMode%
       CASE %FALSE       'Print to default printer with no dialog
           DPENDDOC hFile%, %DDOC_END_PRINT_NODIALOG + %DDOC_END_DELETE
       CASE %TRUE        'Preview First
           DPENDDOC hFile%, %DDOC_END_VIEW + %DDOC_END_DELETE
       CASE 3            'Save Preview file for later use
           DPENDDOC hFile%, %DDOC_END_VIEW  
   END SELECT            
END IF
EZ_SETSBTEXT "METAL", 395, 3, SPACE$(5) + "Un-Sorted", ""
EXIT SUB
Title: Working example
Post by: Anonymous on November 07, 2004, 07:06:42 PM
OK attached is a example that reads a database and prints the contents to DDOC.

It does not and I am sure that there are better ways that I will look at.

But this does work, I hope it helps others that come behind me.

Function FRMLABOUR_COMMAND5_BN_CLICKED (ControlIndex As Long, hWndForm As Dword, hWndControl As Dword, idButtonControl As Long) As Long
Local nRow As Dword   ' Holds the number of Records
Local x As Integer        ' Set up loop
Dim hPrev As Integer     'Sets up DDOC
Dim cl As Double     'Current Line Space

FF_Adorecordset_MoveFirst lpRecordset  ' Moves first record
nRow = FF_AdoRecordset_GetRecordCount(lpRecordset)   'Reads number of records
   cl = 1    ' start @ 1 inch on paper
   hPrev = dpStartDoc(0, "Labour", "", %DDOC_INCH, %DDOC_PAPER_LETTER, %DDOC_PORTRAIT, %DDOC_SYSTEM_DEFAULT, 0)    'Start setting of DDOC
   If hPrev% < 1 Then
   MsgBox "Unable to init document"
   Else  
   dpSetTabs hPrev, "L1W2 L2W1 L3W1 L4W3.5"   'set up tabs
   dpTabText hPrev, 0.75, "Code:" + Chr$(9) + "For Rate" + Chr$(9) + "Bud Rate"+Chr$(9) + "Description" +Chr$(9) 'Prints heading
   For x = 1 To nRow  'Sets the number of row's
   FF_Adorecordset_Move(lpRecordset,1)  
   FF_AdoRecordset_GetCollect lpRecordset,"Code:", vCode    'gets record set information
FF_AdoRecordset_GetCollect lpRecordset,"For Rate:", vFor
FF_AdoRecordset_GetCollect lpRecordset,"Bud Rate:", vBud
FF_AdoRecordset_GetCollect lpRecordset,"Description:", vDescription

                                     
                                 
 
dpTabText hPrev, cl, Variant$(vCode) + Chr$(9) + Variant$(vFor) + Chr$(9) + Variant$(vBud)+Chr$(9) + Variant$(vDescription) +Chr$(9)     'Print database info
cl = cl + 0.1667     'loop one line space

   Next x
   dpEndDoc hPrev, %DDOC_END_DELETE + %DDOC_END_VIEW  'opens DDOC
   End If
End Function

Blair
Title: DDOC
Post by: Don Dickinson on November 08, 2004, 02:48:52 PM
you may have discovered this already, but in your first example, you had the dpStartDoc call inside the loop. every iteration of the loop caused a new document to be started. when the loop exits, it closes the last of these documents and shows it on the screen. the last document has the last line in it and nothing else. the solution is to move the dpStartDoc call before the loop start.

for faster service you might want to just email me as i visit these forums only every day or two.

http://www.greatwebdivide.com/emailme.htm

best regards,
don
Title: DDOC and FireFly
Post by: Jeff Cranford on November 12, 2004, 11:54:58 PM
For what it's worth, I have been using an application that I coded with FireFly querying an Access database across a network and then printing the results with DDOC for about a month now at my office.  The two products (FireFly and DDOC) seem to work perfectly together.  The application was straightforward to code and I am really impressed with the combination of the two tools.

Jeff Cranford