Hello,
Thank you for taking to the time to look at my question\problem.
In my code below, I pass a list of PDF files as a cursor, the form displays the first field of the Cursor within a grid and also displays the selected PDF in a olecontrol, this works ok, except when I click on the second PDF within the grid, I get a "No PARAMETER statement is found" error. After multiple attempts to try and fix this error myself, I now accept I'm stuck and need help.
I'm fairly new to the world of oop so, I suspect it is something simple I'm doing wrong, but if someone could kindly point me in the right direction that would be greatly appreciated.
I've adapted my code so anyone can simply copy and paste the code below into a PRG and the error will hopefully be reproduced.
If there is anything else I can provide that might help resolve this please let me know?
********************* Copy and paste from here, save as prg and run code
CLOSE DATABASES
SELECT 0
CREATE CURSOR CurPrePDFs (file C(100), fullpath C(250))
insert into CurPrePDFS (file, fullpath) VALUES ("file1.pdf","c:\fox\file1.pdf")
insert into CurPrePDFS (file, fullpath) VALUES ("file2.pdf","c:\fox\file2.pdf")
SELECT CurPrePDFs
GO top
cRetVal = PreViewMultiplePDFs()
WAIT WINDOW cRetVal
use in CurPrePDFs
RETURN
******************************************************
FUNCTION PreViewMultiplePDFs()
******************************************************
Private pcReturnValue
pcReturnValue = ""
Local oPDFView
oPDFView = Createobject("rbPDFView")
oPDFView.Show()
Return pcReturnValue
Define Class rbPDFView As Form
Height = SYSMETRIC(2)-200
Width = SYSMETRIC(1)-310
Left = 102
Top = 5
Caption = "Preview PDF"
ControlBox = .F.
WindowType = 1
Name = "frmPDFView"
Add Object ActxBrowser As olecontrol With ;
oleclass="shell.explorer.2", ;
Height = SYSMETRIC(2)-270, ;
Left = 160, ;
Top = 2, ;
Width = SYSMETRIC(1)-280, ;
Name = "oBrowser"
Add Object gridlist As grid With ;
Height = SYSMETRIC(2)-270, ;
Left = 2, ;
Top = 2, ;
Width = 150, ;
columncount = 1, ;
Name = "Gridlist"
Add Object cmdok As commandbutton With ;
Top = SYSMETRIC(2)-260, ;
Left = SYSMETRIC(1)-580, ;
Height = 50, ;
Width = 92, ;
Caption = "Confirm All OK", ;
Default = .T., ;
TabIndex = 3, ;
BackColor = Rgb(128,255,128), ;
Name = "cmdOK"
Add Object cmdcancel As commandbutton With ;
Top = SYSMETRIC(2)-260, ;
Left = SYSMETRIC(1)-450, ;
Height = 50, ;
Width = 72, ;
Cancel = .T., ;
Caption = "Cancel", ;
TabIndex = 4, ;
BackColor = Rgb(225,0,0), ;
Name = "cmdCancel"
PROCEDURE Load
SELECT CurPrePDFS
GO Top
ENDPROC
Procedure Init
This.Gridlist.Column1.Header1.Caption = "Filename"
This.Gridlist.AutoFit()
Thisform.ShowPDF()
ENDPROC
PROCEDURE ShowPDF
LPARAMETERS uPara1
LCNAVIGATE=ALLTRIM(CurPrePDFs.FullPath)
IF !EMPTY(LCNAVIGATE)
THIS.OBROWSER.NAVIGATE(LCNAVIGATE)
ENDIF
ENDPROC
Procedure Unload
pcReturnValue = Thisform.tag
Endproc
PROCEDURE gridlist.afterrowcolchange
Thisform.ShowPDF()
ENDPROC
Procedure cmdok.Click
Thisform.Tag="YES"
Thisform.Release()
Endproc
Procedure cmdcancel.Click
Thisform.Tag="NO"
Thisform.Release()
Endproc
Enddefine
*
*-- EndDefine: rbPDFView
**************************************************
Thank you for taking to the time to look at my question\problem.
In my code below, I pass a list of PDF files as a cursor, the form displays the first field of the Cursor within a grid and also displays the selected PDF in a olecontrol, this works ok, except when I click on the second PDF within the grid, I get a "No PARAMETER statement is found" error. After multiple attempts to try and fix this error myself, I now accept I'm stuck and need help.
I'm fairly new to the world of oop so, I suspect it is something simple I'm doing wrong, but if someone could kindly point me in the right direction that would be greatly appreciated.
I've adapted my code so anyone can simply copy and paste the code below into a PRG and the error will hopefully be reproduced.
If there is anything else I can provide that might help resolve this please let me know?
********************* Copy and paste from here, save as prg and run code
CLOSE DATABASES
SELECT 0
CREATE CURSOR CurPrePDFs (file C(100), fullpath C(250))
insert into CurPrePDFS (file, fullpath) VALUES ("file1.pdf","c:\fox\file1.pdf")
insert into CurPrePDFS (file, fullpath) VALUES ("file2.pdf","c:\fox\file2.pdf")
SELECT CurPrePDFs
GO top
cRetVal = PreViewMultiplePDFs()
WAIT WINDOW cRetVal
use in CurPrePDFs
RETURN
******************************************************
FUNCTION PreViewMultiplePDFs()
******************************************************
Private pcReturnValue
pcReturnValue = ""
Local oPDFView
oPDFView = Createobject("rbPDFView")
oPDFView.Show()
Return pcReturnValue
Define Class rbPDFView As Form
Height = SYSMETRIC(2)-200
Width = SYSMETRIC(1)-310
Left = 102
Top = 5
Caption = "Preview PDF"
ControlBox = .F.
WindowType = 1
Name = "frmPDFView"
Add Object ActxBrowser As olecontrol With ;
oleclass="shell.explorer.2", ;
Height = SYSMETRIC(2)-270, ;
Left = 160, ;
Top = 2, ;
Width = SYSMETRIC(1)-280, ;
Name = "oBrowser"
Add Object gridlist As grid With ;
Height = SYSMETRIC(2)-270, ;
Left = 2, ;
Top = 2, ;
Width = 150, ;
columncount = 1, ;
Name = "Gridlist"
Add Object cmdok As commandbutton With ;
Top = SYSMETRIC(2)-260, ;
Left = SYSMETRIC(1)-580, ;
Height = 50, ;
Width = 92, ;
Caption = "Confirm All OK", ;
Default = .T., ;
TabIndex = 3, ;
BackColor = Rgb(128,255,128), ;
Name = "cmdOK"
Add Object cmdcancel As commandbutton With ;
Top = SYSMETRIC(2)-260, ;
Left = SYSMETRIC(1)-450, ;
Height = 50, ;
Width = 72, ;
Cancel = .T., ;
Caption = "Cancel", ;
TabIndex = 4, ;
BackColor = Rgb(225,0,0), ;
Name = "cmdCancel"
PROCEDURE Load
SELECT CurPrePDFS
GO Top
ENDPROC
Procedure Init
This.Gridlist.Column1.Header1.Caption = "Filename"
This.Gridlist.AutoFit()
Thisform.ShowPDF()
ENDPROC
PROCEDURE ShowPDF
LPARAMETERS uPara1
LCNAVIGATE=ALLTRIM(CurPrePDFs.FullPath)
IF !EMPTY(LCNAVIGATE)
THIS.OBROWSER.NAVIGATE(LCNAVIGATE)
ENDIF
ENDPROC
Procedure Unload
pcReturnValue = Thisform.tag
Endproc
PROCEDURE gridlist.afterrowcolchange
Thisform.ShowPDF()
ENDPROC
Procedure cmdok.Click
Thisform.Tag="YES"
Thisform.Release()
Endproc
Procedure cmdcancel.Click
Thisform.Tag="NO"
Thisform.Release()
Endproc
Enddefine
*
*-- EndDefine: rbPDFView
**************************************************