Subject Re: Mervyn's Create_subForm
From Mervyn Bick <invalid@invalid.invalid>
Date Sun, 6 Apr 2025 15:50:01 +0200
Newsgroups dbase.getting-started
Attachment(s) sub_dele_launch.wfmsub_dele_test.sfmsub_dele_test.wfm

On 2025/04/06 14:14, trevor wrote:

> Thanks.
>
> .sfm doesn't appear in dbase so have opened it in notepad from explorer.

You will find .sfm files in the All tab of the Navigator.  These files
don't appear under the Forms tab but, to save having to find them in teh
All tab, you can open them by entering in the Command panel  MODI COMM
SUBwhatever.SFM


A sub form can only be opened by calling it from within a form.  As
dBASE doesn't have a designer one needed to change the class definition
of a standard form manually and remove the "bootstrap" code.  If the
subform had to be modified later it meant having to manually change the
class definition and replace the "bootstrap" code.  A real PITA.

I created create_subform.wfm and "invented" SUBwhatever.sfm files.  This
meant that the standard form was always available for modification and a
pass through create_subform.wfm updated the .sfm file. This was done
about 17 years ago and I must say that, having played with subforms for
I while, I never saw the need to use them.  They are confined to the
parent form boundaries.  I find it better to use standard forms which
can be parked anywhere on the screen.

Attached are sub_dele_test.wfm, sub_dele_test.sfm which was created by
create_subform.wfm and sub_dele_launch.wfm.

Mervyn.



** END HEADER -- do not remove this line
//
// Generated on 2025-04-06
//
parameter bModal
local f
f = new sub_dele_launchForm()
if (bModal)
   f.mdi = false // ensure not MDI
   f.readModal()
else
   f.open()
endif

class sub_dele_launchForm of FORM
   with (this)
      onOpen = class::FORM_ONOPEN
      onClose = class::FORM_ONCLOSE
      height = 23.6364
      left = 1.5714
      top = 0.0455
      width = 125.8571
      text = ""
   endwith

   this.PUSHBUTTON1 = new PUSHBUTTON(this)
   with (this.PUSHBUTTON1)
      onClick = class::PUSHBUTTON1_ONCLICK
      height = 1.0909
      left = 1.4286
      top = 0.5455
      width = 15.2857
      text = "Open sub-form"
   endwith


   function PUSHBUTTON1_onClick()
      form.oSub.open()
      return

   function form_onClose()
      close procedure sub_dele_test.sfm
      form.oSub := null
      return

   function form_onOpen()
      set procedure to sub_dele_test.sfm
      this.oSub = new sub_dele_testFormSub(this)
      this.oSub.text := 'Sub_dele_test'
      return

endclass



class sub_dele_testFormSub( oParent, cTitle ) of SUBFORM( oParent, cTitle )
   with (this)
      height = 18.7727
      left = 21.8571
      top = 1.6818
      width = 65.4286
      text = ""
   endwith

   this.TEMPTRANSFERS1 = new QUERY(this)
   with (this.TEMPTRANSFERS1)
      left = 9.0
      top = 1.0
      width = 12.0
      height = 1.0
      sql = 'select * from "temptransfers.DBF"'
      active = true
   endwith

   this.GRID1 = new GRID(this)
   with (this.GRID1)
      dataLink = form.temptransfers1.rowset
      height = 12.1818
      left = 8.2857
      top = 5.3182
      width = 43.7143
   endwith

   this.rowset = this.temptransfers1.rowset

endclass



** END HEADER -- do not remove this line
//
// Generated on 2025-04-06
//
parameter bModal
local f
f = new sub_dele_testForm()
if (bModal)
   f.mdi = false // ensure not MDI
   f.readModal()
else
   f.open()
endif

class sub_dele_testForm of FORM
   with (this)
      height = 18.7727
      left = 21.8571
      top = 1.6818
      width = 65.4286
      text = ""
   endwith

   this.TEMPTRANSFERS1 = new QUERY(this)
   with (this.TEMPTRANSFERS1)
      left = 9.0
      top = 1.0
      width = 12.0
      height = 1.0
      sql = 'select * from "temptransfers.DBF"'
      active = true
   endwith

   this.GRID1 = new GRID(this)
   with (this.GRID1)
      dataLink = form.temptransfers1.rowset
      height = 12.1818
      left = 8.2857
      top = 5.3182
      width = 43.7143
   endwith

   this.rowset = this.temptransfers1.rowset

endclass