> On Jan 7, 2017, at 7:43 PM, Douglas von Roeder <[email protected]> wrote:
> 
> Thank you for passing that along. Per my reply to David, I hit an issue
> with a child/sibling/asterisked form last year that had just those symptoms
> and I"m wondering if what you've described was the underlying issue.
> Something to check out, no question.

Maybe. I filed a bug through tech support last month (ACI0096154). When there 
is an object type variable on a form, even if hidden, it must be a certain size 
or 4D will crash when the c_object itself gets to a certain size. It was macOS, 
64-bit 4D only. I think I said it caused a slow down in my last email. Sorry 
about that. It actually crashes 4D.


> Heh, just one more thing…
> 
> If it's kosher to plop a "data" dynamic variable on a form (vs a dynamic
> variable that's part of the UI), perhaps a good practice is to add an extra
> page to a form? Just a thought.


I’m not quite following you on the extra page. However, I’ll paste in a method 
below my signature which I use in the context of a form to “create” variables 
on the fly. It assume there is a hidden variable on the form named 
“__AnyVariable” with the variable  type set to “None”. (I have one on my 
UIMasterForm which I inherit in all forms). When you need an extra variable, 
call the method like this:

C_POINTER($pVar)
$pVar:=UIVariable_Create ("MyVariable";Object array) //Creates an object array. 
Returning a pointer is optional.

When you need to access this variable, just do this:

$pVar:=OBJECT Get pointer(Object named;"MyVariable”)

Everything from simple long variables to blob arrays is supported and it works 
compiled just fine. Handy when you need to dynamically create form variables 
that aren’t tied to any UI in any way.

--
Cannon Smith
Synergy Farm Solutions Inc.
Hill Spring, AB Canada
403-626-3236
<[email protected]>
<www.synergyfarmsolutions.com>


  //If you need to create an extra variable (including arrays) while a form is
  //running, you can use this method to safely to do. UIMasterForm must have 
been
  //inherited by the form.

  //Pass in the name of the object (must be unique on the form) that will be
  //associated with the variable and the type andthis method will create it and
  //return a pointer to it.

  //When you need to manipulate it in the future, just use:

  //$pVar:=OBJECT Get pointer(Object named;"MyVariable")

  //The following types are allowed:

  // - Is text
  // - Is longint
  // - Is real
  // - Is date
  // - Is time
  // - Is Boolean
  // - Is picture
  // - Is object
  // - Is BLOB

  // - Text array
  // - LongInt array
  // - Real array
  // - Date array
  // - Time array
  // - Boolean array
  // - Picture array
  // - Object array
  // - Blob array


C_TEXT($1;$tVariableContainerName)
C_LONGINT($2;$lType)
C_POINTER($0;$pVariable)

$tVariableContainerName:=$1
$lType:=$2

OBJECT DUPLICATE(*;"__AnyVariable";$tVariableContainerName)
$pVariable:=OBJECT Get pointer(Object named;$tVariableContainerName)

Case of 
        : ($lType=Is text)
                C_TEXT($pVariable->)
                
        : ($lType=Is longint)
                C_LONGINT($pVariable->)
                
        : ($lType=Is real)
                C_REAL($pVariable->)
                
        : ($lType=Is date)
                C_DATE($pVariable->)
                
        : ($lType=Is time)
                C_TIME($pVariable->)
                
        : ($lType=Is Boolean)
                C_BOOLEAN($pVariable->)
                
        : ($lType=Is picture)
                C_PICTURE($pVariable->)
                
        : ($lType=Is object)
                C_OBJECT($pVariable->)
                
        : ($lType=Is BLOB)
                C_BLOB($pVariable->)
                
                
        : ($lType=Text array)
                ARRAY TEXT($pVariable->;0)
                
        : ($lType=LongInt array)
                ARRAY LONGINT($pVariable->;0)
                
        : ($lType=Real array)
                ARRAY REAL($pVariable->;0)
                
        : ($lType=Date array)
                ARRAY DATE($pVariable->;0)
                
        : ($lType=Time array)
                ARRAY TIME($pVariable->;0)
                
        : ($lType=Picture array)
                ARRAY PICTURE($pVariable->;0)
                
        : ($lType=Object array)
                ARRAY OBJECT($pVariable->;0)
                
End case 

$0:=$pVariable

**********************************************************************
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:[email protected]
**********************************************************************

Reply via email to