INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Jobs

NO parameter statement error - when creating OOP form

NO parameter statement error - when creating OOP form

(OP)
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
**************************************************

RE: NO parameter statement error - when creating OOP form

Change this in your code:

CODE --> VFP

PROCEDURE gridlist.afterrowcolchange
LPARAMETERS nColIndex
Thisform.ShowPDF()
ENDPROC 

(even if you don't use them, you need to declare the parameters the parent methods expect).

RE: NO parameter statement error - when creating OOP form

(OP)
That fixed it, I'll keep that in mind in future, thank you very much atlopes smile

RE: NO parameter statement error - when creating OOP form

Very simple. When you click on a row in the grid, the grid's AfterRowColChange event is fired. That events needs a parameter to contain the colunn number. If you look in the Help for AfterRowColChange, you wll see that the header should look this is:

PROCEDURE Grid.AfterRowColChange
LPARAMETERS nColIndex


So just add that second line to your AfterRowColChange code, and all should be well.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads

RE: NO parameter statement error - when creating OOP form

I see Atlopes beet me to it. That's fine.

For what it's worth, I just ran your code with the LPARAMETER statement, and it works perfectly.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads

RE: NO parameter statement error - when creating OOP form

(OP)
Thank you Mike, the quick response by yourself and atlopes is greatly appreciated.
Apologies for the simplicity of my question, it seems obvious now I know the answer smile

RE: NO parameter statement error - when creating OOP form

No need to apologise. The solution is not really that obvious.

By the way, don't get too hung up on your lack of OOP knowledge. An event-handler, such as AfterRowColChange, is not all that different from an ordinary procedure. And the passing of parameters is pretty much the same, regardless of whether they are being passed to a procedure, function, method or event.

Keep working at it, at the OOP will come naturally after a while.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads

RE: NO parameter statement error - when creating OOP form

(OP)
Thanks Mike 2thumbsup

RE: NO parameter statement error - when creating OOP form

Everything is said, except perhaps: This becomes much more apparent, if you develop your visual classes with the visual class designer, because it adds the native parameterizations of methods and events even to methods and events considered unchanged according to the property window.

I wonder whether you designed your code as prg or got it from a faq here. If the latter, you may let the FAQ writer know about an error.

Bye, Olaf.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Resources

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close