Print Object error #6

2019-11-13 Thread Piotr Chabot Stadhouders via 4D_Tech
Hi,

In some occasion we are getting an error when using the command Print Object
The message is “The form cannot be printed. Error #6”

Does anybody know what this error number means?

Gr,
Piotr

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

Re: Determining if a 4D Write Object has been changed since load.

2019-11-13 Thread Bernd Fröhlich via 4D_Tech
Eric Naujock:

> Initially I tried to add an attribute to the WP object, but wasn’t successful.

What was the problem? It´s as easy as

$oMyWriteProObject.MyNewProperty:="Something".

I find that very useful.

You have to keep in mind that object properties are case sensitive, so 
MyNewProperty and mynewproperty are different.

Greetings from Germany,
Bernd Fröhlich
**
4D Internet Users Group (4D iNUG)
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**

Re: Selection Based ListBox - How do I extract and apply values to a single cell?

2019-11-13 Thread Kirk Brooks via 4D_Tech
Hi Bob,

On Wed, Nov 13, 2019 at 9:59 AM Bob Miller via 4D_Tech <4d_tech@lists.4d.com>
wrote:

> The example in the docs doesn't help me understand what you mean about
> using Form with a listbox.
> Can you step through a little example of how Form would help in this case,
> to control a listbox?
>
Happy to try to help.
I recently posted a suggestion for replacing a pretty complex list form,
not a listbox, with a listbox and detail subform. It even has a picture.
https://forums.4d.com/Post/FR/32395457/1/32403208#32403208

I got a lot of useful ideas from the blog:
https://blog.4d.com/display-an-entity-selection-in-a-list-box/
https://blog.4d.com/display-a-collection-in-a-listbox/

A couple of tips I'll pass along that have emerged as being really helpful
for me:

- Think about whatever is in the listbox in terms of the actual data - not
in terms of rows and columns. When you want to select or edit something you
do it in the data and the listbox displays the results. This is almost
completely opposite the way you have done it for years.

- Whatever you are going to display in the listbox if you want to query,
hide, select some of the elements create two references to the data
(collection or entity selection). Something like:

Form.sourceCollection  //  this is the actual data

Form.listboxDisplay//  this is what's displayed in the listbox

You set it up initially by assigning the source to the display:

Form.listboxDisplay:=Form.sourceCollection


Why is this a useful? Let's say I have a big list of names and I include a
search widget. I want to have the listbox show only the elements that match
the search condition. The collection.query() is wonderfully easy. It
returns either a collection (if you query a collection) or an entity
selection (if you query that). So
Form.listboxDisplay:=Form.sourceCollection.query(" name = :1 "; Get edited
text)
puts the result of the query in the listbox.

But this is memory inefficient - you may think. It's not because
Form.sourceCollection and Form.listboxDisplay are references to the data.
Totally different from arrays or selections. Creating multiple references
doesn't significantly increase the memory usage.

BTW - if you allow the user to make changes in the listbox using this
scheme because you are using a reference the changes in the listbox 'flow'
through to the sourceCollection. If you using an entity selection the
changes are made to the entity.


The bottom line is Form and ORDA represent a fundamentally different
approach to presenting data to the user. It's worth spending the time to
learn it. I can do things now with a few lines of code that used to require
multiple methods and dozens (hundreds) of lines of code to accomplish the
same effect.

-- 
Kirk Brooks
San Francisco, CA
===

What can be said, can be said clearly,
and what you can’t say, you should shut up about

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

Re: Selection Based ListBox - How do I extract and apply values to a single cell?

2019-11-13 Thread Chip Scheide via 4D_Tech
also - formatting of the displayed data in the listbox (including 
column widths and titles)


Thanks
Chip
On Wed, 13 Nov 2019 17:59:41 +, Bob Miller via 4D_Tech wrote:
> 
> Can you step through a little example of how Form would help in this 
> case, to control a listbox?
We have done so much, with so little, for so long;
We are now qualified to anything with nothing 
  - unknown
**
4D Internet Users Group (4D iNUG)
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**

Re: Determining if a 4D Write Object has been changed since load.

2019-11-13 Thread Eric Naujock via 4D_Tech
Just for reference I am adding an  (Form event=On After Edit) to my Write Pro 
object. This way any edit to the file will trigger a dirty event. Then I will 
probably need to reset the dirty flag upon saving. Otherwise I will wind up 
with hundreds of copies of the same document.

> On Nov 12, 2019, at 5:40 PM, Tom Benedict  wrote:
> 
> That’s correct. It’s not part of the Write Pro object. 
> 
> Initially I tried to add an attribute to the WP object, but wasn’t 
> successful. I’m a ‘baby programmer’ with objects so I don’t know whether its 
> possible to add attributes to a Write Pro object. My limited efforts failed.
> 
> Tom
> 
>> On Nov 12, 2019, at 14:29, Eric Naujock > > wrote:
>> 
>> Reading in deeper. The WP_Information is a session variable object that 
>> keeps track of the WP Pro object is not the actual WP Pro object. Just 
>> asking to clarify.
>> 
>>> On Nov 12, 2019, at 5:20 PM, Tom Benedict >> > wrote:
>>> 
>>> Hi Eric,
>>> 
>>> If I understand your question correctly, I think you’re looking for a 
>>> “dirty” flag. As far as I know there is no built in function that track 
>>> this, so you’ll need to create your own.
>>> 
>>> Below are the three methods I use to track the state of a Write Pro object. 
>>> It was inspired by help I received on forums.4d.fr .
>>> 
>>> — Create an object in the On Load event of a Write Pro object call:
>>> 
>>>   // Method: WP_InitInformation
>>>   // 
>>>   // User name (OS): Tom Benedict
>>>   // Date and time: 9/5/2019, 10:28:45
>>>   // 
>>>   // Description
>>>   // bld277005
>>>   // 
>>> 
>>> C_OBJECT(WP_Information)
>>> 
>>> If (OB Is defined(WP_Information))  // already exists
>>> WP_Information.IsNewDocument:=False
>>> Else 
>>> WP_Information:=New object("IsNewDocument";False)
>>> End if 
>>> 
>>> If (OB Get type(WP_Information;"DocumentInfo")=Is undefined)  // doesn't 
>>> already exists
>>> WP_Information.DocumentInfo:=New 
>>> object("FilePath";"";"Modification";False)
>>> Else 
>>>   // do nothing
>>> End if 
>>> 
>>> — Update the object whenever the Write Pro document is modified (like in 
>>> the On Data Change event of a Write Pro object):
>>> 
>>>   // Method: WP_Information_SetModified([isModified])
>>>   // 
>>>   // User name (OS): Tom Benedict
>>>   // Date and time: 9/5/2019, 11:07:29
>>>   // 
>>>   // Description
>>>   // Set the Modification Property of WP_Information object
>>>   // See WP_Information_Init
>>>   // bld277005
>>>   // 
>>> 
>>> C_BOOLEAN($1)
>>> 
>>> C_OBJECT(WP_Information)  // this object is initialized in 
>>> WP_Information_Init
>>> 
>>> If (Count parameters>0)
>>> $isModified:=$1
>>> Else 
>>> $isModified:=True  // default
>>> End if 
>>> 
>>> WP_Information.DocumentInfo.Modification:=$isModified
>>> 
>>> — Test the state wherever/whenever you wish with:
>>> 
>>>   // Method: WP_Information_isModified -> isModified
>>>   // 
>>>   // User name (OS): Tom Benedict
>>>   // Date and time: 9/5/2019, 11:07:29
>>>   // 
>>>   // Description
>>>   // Get the Modification Property of WP_Information object
>>>   // See WP_Information_Init
>>>   // bld277005
>>>   // 
>>> 
>>> C_OBJECT(WP_Information)
>>> C_BOOLEAN($0)
>>> 
>>> $0:=(WP_Information.DocumentInfo.Modification=True)
>>> 
>>> HTH,
>>> 
>>> Tom Benedict
>>> 
 On Nov 12, 2019, at 14:07, Eric Naujock via 4D_Tech <4d_tech@lists.4d.com 
 > wrote:
 
 I have a series of records and want to detect whether the 4D Write Pro 
 object has been changed since it was loaded. This way I can keep a version 
 archive of older versions of a document available. Is there an easy way 
 I’m not seeing to know if the Write pro object has been changed since it 
 was created or loaded. Right now I al creating a Write Pro object since 
 17R4 had an issues with saving rite Pro objects to a record in a 
 client-server situation. Though I think it may have been fixed in R5 or 
 R6. 
 
 The Write pro object is created when the case is loaded as a free standing 
 object since the object odes not reside in the main record table. Its 
 lives in a large object table nearby since not all records have the Write 
 Pro object in it.
 
 Or is there a way to have an object change detecting in an event that 
 would tell me there was a change in the object and that it needs to have 
 the old object saved to the History table.
 *
>>> 
>> 
> 

**
4D Internet Users Group (4D iNUG)
Archive: