I see how that works.  What tripped me up initially was discovering what looked 
like an exception.

Run the app "LBPrint" and you'll see the listbox populates in the printout.
Then run "Host" which has no forms or methods.  It uses LBPrint as a component. 
 The the listbox does not populate.
In both cases run "aLBPTest" to insure a new process.

I have learned that something about the scope of its variables changes *within* 
an app when it is run as a component.  I was not aware of this at first.

Here is the latest I tested with in the method printLB:

SET PRINT PREVIEW(True)
If (OK=1)

        OPEN PRINTING JOB
        FORM LOAD("Form1")

        ARRAY LONGINT(aA;0)
        ARRAY TEXT(aB;0)
        For ($i;1;10)
                APPEND TO ARRAY(aA;$i)
                APPEND TO ARRAY(aB;"Text"+String($i))
        End for 

        v1:="Test String"

        $all:=Print object(*;"ListBox")
        $all:=Print object(*;"v1")
        CLOSE PRINTING JOB
End if 

Thanks,
Keith - CDI

> On Aug 14, 2017, at 5:51 PM, Keisuke Miyako via 4D_Tech 
> <4d_tech@lists.4d.com> wrote:
> 
> FORM LOAD simply loads the form definition.
> the data source (variables and arrays) are not bound automatically in print.
> you need to populate the objects by their names:
> 
> SET PRINT PREVIEW(True)
> 
> If (OK=1)
> 
> OPEN PRINTING JOB
> 
> FORM LOAD("Form1")
> 
> $aA:=OBJECT Get pointer(Object named;"Column1")
> $aB:=OBJECT Get pointer(Object named;"Column2")
> 
> ARRAY LONGINT($aA->;0)
> ARRAY TEXT($aB->;0)
> 
> For ($i;1;10)
> APPEND TO ARRAY($aA->;$i)
> APPEND TO ARRAY($aB->;"Text"+String($i))
> End for
> 
> $printed:=Print object(*;"ListBox")
> 
> $v1:=OBJECT Get pointer(Object named;"v1")
> $v1->:="Test String"
> 
> $printed:=Print object(*;"v1")
> 
> CLOSE PRINTING JOB
> 
> End if
> 
>> 2017/08/15 3:14、Keith Culotta via 4D_Tech <4d_tech@lists.4d.com> のメール:
>> 
>> I did not mean to miss your point, but the following does not work when 
>> called from within the component either.  The code I uploaded has it outside 
>> the print job.  All variations have worked when used in the matrix structure.
> 

**********************************************************************
4D Internet Users Group (4D iNUG)
FAQ:  http://lists.4d.com/faqnug.html
Archive:  http://lists.4d.com/archives.html
Options: http://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**********************************************************************

Reply via email to