Subject Re: Mervyn's Create_subForm
From trevor <bob@bob.com>
Date Sun, 06 Apr 2025 07:06:43 -0400
Newsgroups dbase.getting-started

Mervyn Bick wrote:

> > function form_onOpen
> >    set procedure to sub_dele.sfm
> >    this.oSub = new sub_deleForm(this)
> >       return
> >
> >  function PUSHBUTTON1_onClick
> >       form.oSub.open()
> >       return
> >
> > On clicking pushbutton I get:
> > Error: class does not exist
> > AMAINFORM:PUSHBUTTON!_ONCLICK
> >
> > Any Ideas appreciated
>
> I assume the ! in the error message is a transcription typo.  If it
> isn't a typo then there's the problem.  A typo in the assignment of
> the event handler to the event in the constructor code.
>
> If that was a transcriptio typo then it sounds as if the event
> handler, function PUSHBUTTON1_ONCLICK, has not been assigned to the
> pushbutton's onClick event in the pushbutton's constructor code.
>
> Mervyn.

Yes a typo Shift 1 (!)

The pb constructor code looks OK

this.PUSHBUTTON1 = new PUSHBUTTON(this)
   with (this.PUSHBUTTON1)
      onClick = class::PUSHBUTTON1_ONCLICK
      height = 1.0909
      left = 9.0
      top = 2.5
      width = 15.2857
      text = "Pushbutton1"
   endwith

and is present in the inspector.

I have tried with a substitute form with just a push button and get
same error message. Also tried oSub.open() in the amain.wfm onopen
event and nothing happens no sub form or error message.
Tried with just sub_dele.wfm substituting header  but same results.

This is the first time I've tried using subforms and using  simply code
(Ken's book examples)in main form additional class have not got father
than blank sub forms which don't appear to be contained in the main
forms.

Thanks for taking a look.

Trevor

[although xananews shows -4.00 I'm actually GMT (can't find setting)]