Subject |
Re: form to form |
From |
Mervyn Bick <invalid@invalid.invalid> |
Date |
Sat, 19 Apr 2025 15:22:14 +0200 |
Newsgroups |
dbase.getting-started |
On 2025/04/19 13:29, trevor wrote:
> Hi,
>
> Dbase plus 2.21 win10
>
> I'm opening a form from another form with PB onclick.
> I've tried 2nd form modal and non modal which works to call from2.
>
> However when I close form2 and then click PB on form1(aamain) to reopen
> form2(sub_dele) get the following error
>
> Error: Class does not exist:
> AAMAINFORM::PUSHBUTTON1_ONCLICK
>
> This occurs both with readmodal() with midi set false and open() with
> midi true on form2.
.......
> function PUSHBUTTON1_onClick
> set procedure to sub_dele.wfm
> oSub = new Sub_deleForm()
> oSub.readmodal()
>
> oSub.release()
> close procedure sub_dele.wfm
> return
The code looks OK and should work but I don't have dBASE 2.21 so I can't
test it. The fact that a function in the main form disappears points to
something in the second form doing something nasty. :-(
If there's something nasty in the second form this may not solve the
problem but, instead of creating and destroying an instance of
sub_dele.wfm every time the pushbutton is clicked, try creating the
instance of sub_dele.wfm once in the form's onOpen event handler.
Release the instance and close the procedure in the form's onClose event
handler.
function form_onClose()
form.oSub.release()
close procedure sub_dele.wfm
return
function form_onOpen()
set procedure to sub_dele.wfm
form.oSub = new sub_deleForm()
return
function PUSHBUTTON1_onClick
form.oSub.readmodal()
return
Mervyn.
|
|