Página 1 de 1

addControl - how to add control?

Publicado: Lun Ene 03, 2022 4:15 pm
por Hurricane
Hi,

I'm trying to create a plugin to insert controls on the Form. Where am I going wrong?

I added the control, but with problems... Control is in edit mode

Código: Seleccionar todo

   with object oObj:=TDbMaskEdit():New(::IInspector:oActiveForm) // Parent is TFormEditor
      :SetBounds( 50, 30, 80, 20 )
      :cVarname := "oTmp" + ToString(++nId)
      :Create()
   end with
   ::IInspector:AddControl( oObj, ::IInspector:oActiveForm, .t. )
   // doc: AddControl( <oCtrl>, <oParent>, <lSelect> ): add a new control.
xailer_addcontrol.png
xailer_addcontrol.png (17.16 KiB) Visto 1454 veces
different problem

Código: Seleccionar todo

   with object oObj:=TDbMaskEdit()
      :SetBounds( 50, 30, 80, 20 )
      :cVarname := "oTmp" + ToString(++nId)
   end with
   ::IInspector:AddControl( oObj, ::IInspector:oActiveForm, .t. ) // Parent is TFormEditor

Re: addControl - how to add control?

Publicado: Lun Ene 03, 2022 5:09 pm
por ignacio

Código: Seleccionar todo

local oControl
with object oControl:=TDbMaskEdit():New()
  :Create()
end with
::IInspector:oActiveForm:AddExistingControl( oControl )

Re: addControl - how to add control?

Publicado: Lun Ene 03, 2022 6:26 pm
por Hurricane
Thanks for your help.

It worked, but I needed to add Parent to avoid the error.

Código: Seleccionar todo

//   with object oObj:=TDbMaskEdit():New() // --> GETNEWID(0) Error BASE/1004  No exported method: GETNEWID   *** The object is NIL or doesn't exists ***
   with object oObj:=TDbMaskEdit():New(::IInspector:oActiveForm)
      :SetBounds( 50, 30, 80, 20 )
      :Create()
   end with
   ::IInspector:oActiveForm:AddExistingControl( oObj )
   return nil