Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Passing params (correct content)
Message
From
01/03/1998 10:30:20
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00081635
Message ID:
00081961
Views:
26
>>>Sawadee,
>>>
>>> I've tried passing params to a form by the book but I'm losing my way somehow. I'm trying to open a form from a control on another form. By doing DO FORM <> WITH p1, p2 and trying to catch them in the recieving form's Init, as the developer's guide outlines. But I get the error 'No PARAM statement in ...Click etc' The recieving form was built with the form wizard, so it is based on Form and has the wizstyle picbuttons attached to it. I want to instantiate this form in either Edit or New mode by telling it via the PARA. Somehow, the PARA statement in the Init of the launched form is not seen by the calling object's click event. Where have I gone wrong?
>>>
>>>Eric K.
>>
>>I think "Sawadee" is something like "hello, greetings..". Same to you. The form gets the parameters in init event (or in Load event if the form is a FP 2.x converted screen and windowtype prop 2 or 3) and those parameters are seen only in init (if not public). To make them visible in all form events and methods either assign them to public vars or to added custom form props.
>>'No PARAM statement in ...Click etc' ?? Do you mean you call wizard buttons with params ? They don't have params.
>>To instantiate it either in edit or new just pass it ass a param and click the appropriate button. As :
>>
>>..
>>do form myForm with .t.  && ie: .t. for new
>>
>>* myForm.init         && Myform is built with wizard
>>parameters lNewRecord
>>if parameters() = 0
>> lNewRecord = .f.
>>endif
>>if lNewRecord
>>   thisform.picbtns1.cmdAdd.click
>>else
>>   thisform.picbtns1.cmdEdit.click
>>endif
>>
>>Cetin
>
>Sawadee Kaap, (How are you today?)
>
> Actually, the param statement is in the formB Init, like the book says,
>and in formA, the button ADD.Click contains DO FORM formB WITH p1, p2.
>
>By the way, how do you pass a logical data type?
>
>Eric Kleeman
Hi Eric,
The book ? Is it dev.guide ? Chapter 9, "passing parameters to a form" ? If so example is very short.
- A form can have new properties to hold values, arrays, objects etc by adding via menu "form\New property".
- These form properties could be seen by not only from any form PEM but also from another form's PEM that has a reference to this form (depending how the property is defined - public,prot. or hidden).
- So when you pass params to a form (formB), if you want these params available to any form PEM, you assign them to custom form properties.
- You could pass any type of params.
*formA.cmdCallAnother.click  - a command button calling another with params
*Pass object "thisform" reference, logical .t., char "New Caption"
do formB with thisform, .t., "New Caption"

* formB.init
* Form has 2 custom props to hold first 2 values passed as params 
lparameters oCallerForm, lStatus, cFormCaption
this.caption = cFormCaption
this.oCallerForm = oCallerForm
this.lStatus = lStatus

* FormB.command1.click
* If lStatus = .t. then change caller form's caption to "Yes" else "No"
thisform.oCallerForm.Caption = iif(thisform.lStatus,"Yes","No")

* Call another command button with params - in FormA
thisform.oCallerForm.cmdButtonWithParams.click("FormB clicked me")

*FormA.cmdButtonWithParams.click
lparameters cWhoClickedMe
wait window nowait cWhoClickedMe
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform