Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Methods in formset's forms' controls in a .prg
Message
From
25/07/1998 16:51:42
Dragan Nedeljkovich (Online)
Now officially retired
Zrenjanin, Serbia
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Classes - VCX
Title:
Methods in formset's forms' controls in a .prg
Miscellaneous
Thread ID:
00121398
Message ID:
00121398
Views:
53
I have a formset class; initially it contains only a form1 and an ok/cancel cmdgroup. Now when I createobject() it, I add several objects to formset.form1 programmatically. So far so good - I can set the controls' properties as I like, but that's all. Can't do any method code for the controls. They either have to be subclassed right where they are, or I can save the formset into a .scx and add method code there. This roughly defeats the purpose of the whole thing, because the intention of this class was to be used for little dialogs, with just a couple of controls, like the kind one usually runs before reporting, asking for date range and such matters. Having the code right within the same .prg which later runs the report grossly reduces the number of files and other clutter.

Now to the funny thing. I've opened the saved form in the form designer, and added few lines in one of control's method. Saved. Opened in class browser and took a look at the source code, copied it into a .prg and found no way to run it. It was something like this:

Define Class someclass as formsetclass

add object form1 as form
add object form1.control1 as textbox

procedure control1.click
wait "you clicked, sir?" window nowait
endproc
enddefine

It showed " procedure control1.click" as if belonged to formset, and not to formset.form1. It compiled anyway, but refused to run, stating that object reference is wrong. So I changed it to procedure form1.control1.click", but wasn't any better. Tried a couple of other things, but none worked.

Does anyone know a way around this, or the thing is simply impossible. The only solution I've found so far is like this:


Define Class someclass as formsetclass

add object form1 as form
add object form1.control1 as MYtextbox
EndDefine

Define Class mytextbox as textbox
procedure click
wait "you clicked, sir?" window nowait
endproc
enddefine

...but it seems like an overkill, having to subclass every control which needs some method code.

back to same old

the first online autobiography, unfinished by design
What, me reckless? I'm full of recks!
Balkans, eh? Count them.
Next
Reply
Map
View

Click here to load this message in the networking platform