Re: 4D Write PRO: editing a table / collections

2018-07-12 Thread Two Way Communications via 4D_Tech
Achim, have you tried this yourself? 

I think it is not possible in 4D Write PRO v17 to select 1 or more cells in a 
table and then be able to get the cells reference by code.

Just follow this scenario:

- the user creates a table in 4D Write PRO (by clicking a button containing the 
code WP Insert Table)
- Basically, the developer provides a dialog to ask for the number of columns 
and rows, and eventually column width, background color etc.
- the table will be created in the 4D Write PRO document, where the user can 
add content.

Now, the user wants to change attributes of the cells, or columns. i.e. width, 
color, borders. In order to do that (in code), the developer needs to know 
which cells have been selected.

In the table, the user can select 1 or more cells, but here’s the problem: how 
to find out which cell(s) have been selected?

WP get selection will return an object with a ’start’, ‘end’ and ’type’ 
attribute. Type is always = 0, start and end e.g. 32,40 do not give any clue as 
to which cell is selected.
Interestingly, WP Create table range returns exactly the same result, but type 
= 4

‘WP Get position': nothing that can be used: While the user has selected cells 
1 and 2, we get this result:
‘column’ = 1
‘line’ = 3
‘page’ = 1
‘position’ =1

'WP GET ELEMENTS' will return a collection, where the table object can indeed 
be found, but still no information about which cell or cells are selected.
‘WP Table Get Cells' will create a new range containing the specified cells, 
but NOT provide information about which cells are actually selected.


Rudy Mortier
Two Way Communications bvba 



> On 11 Jul 2018, at 19:16, Keisuke Miyako via 4D_Tech <4d_tech@lists.4d.com> 
> wrote:
> 
> a table reference can be obtained from
> 
> WP Create table range
> http://doc.4d.com/4Dv17/4D/17/WP-Create-table-range.301-3703205.en.html
> 
> WP Get elements
> http://doc.4d.com/4Dv17/4D/17/WP-Get-elements.301-3703212.en.html
> 
> or
> 
> WP Get element by ID
> http://doc.4d.com/4Dv17/4D/17/WP-Get-element-by-ID.301-3703233.en.html
> 
> in v16/R, I believe it is only be possible to obtain such a reference
> immediately following creation (WP Insert table)
> 
> ---
> 
> the way I understand it is that a write pro document is a combination of 
> range (of text) and other objects that do not fit in any particular range (of 
> text). such objects are also referred to as a "range object" in the language 
> (table, row, column, anchored picture, etc)
> 
> http://doc.4d.com/4Dv17/4D/17/Accessing-document-contents-by-programming.300-3726304.en.html#3507530
> 
> commands such as WP SELECT work on range of text.
> 
> some commands like WP Get selection works on a range of text or a "range 
> object".
> (result.type tells which)
> 
> 2018/07/12 0:57、Two Way Communications via 4D_Tech 
> <4d_tech@lists.4d.com> のメール:
> So, what if the user has created a table (through a method), and now want to 
> select a cell in that table and change it’s background color, or it’s width?
> 
> 
> 
> **
> 4D Internet Users Group (4D iNUG)
> FAQ:  http://lists.4d.com/faqnug.html
> Archive:  http://lists.4d.com/archives.html
> Options: https://lists.4d.com/mailman/options/4d_tech
> Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
> **

**
4D Internet Users Group (4D iNUG)
FAQ:  http://lists.4d.com/faqnug.html
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: 4D Write PRO: editing a table / collections

2018-07-11 Thread Keisuke Miyako via 4D_Tech
a table reference can be obtained from

WP Create table range
http://doc.4d.com/4Dv17/4D/17/WP-Create-table-range.301-3703205.en.html

WP Get elements
http://doc.4d.com/4Dv17/4D/17/WP-Get-elements.301-3703212.en.html

or

WP Get element by ID
http://doc.4d.com/4Dv17/4D/17/WP-Get-element-by-ID.301-3703233.en.html

in v16/R, I believe it is only be possible to obtain such a reference
immediately following creation (WP Insert table)

---

the way I understand it is that a write pro document is a combination of range 
(of text) and other objects that do not fit in any particular range (of text). 
such objects are also referred to as a "range object" in the language (table, 
row, column, anchored picture, etc)

http://doc.4d.com/4Dv17/4D/17/Accessing-document-contents-by-programming.300-3726304.en.html#3507530

commands such as WP SELECT work on range of text.

some commands like WP Get selection works on a range of text or a "range 
object".
(result.type tells which)

2018/07/12 0:57、Two Way Communications via 4D_Tech 
<4d_tech@lists.4d.com> のメール:
So, what if the user has created a table (through a method), and now want to 
select a cell in that table and change it’s background color, or it’s width?



**
4D Internet Users Group (4D iNUG)
FAQ:  http://lists.4d.com/faqnug.html
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: 4D Write PRO: editing a table / collections

2018-07-11 Thread JOHN BAUGHMAN via 4D_Tech
On Jul 10, 2018, at 10:41 PM, Two Way Communications via 4D_Tech 
<4d_tech@lists.4d.com> wrote:
> 
> You’re right, John.
> 
> When I re-open the document, the table has another reference, and WP SELECT 
> doesn’t work anymore…
> 
> Is there any other way to get the object reference for a table in a 4D Write 
> PRO document?

Not sure if you can do the same for tables, but what I have done with 
images  is when the document is saved, load each image's position and size into 
my collection and delete them all. Then recreate them from the collection when 
re-opened and update collection with the new references.

John



John Baughman
1331 Auwaiku Street
Kailua, Hawaii  96734
(808) 262-0328
john...@hawaii.rr.com

**
4D Internet Users Group (4D iNUG)
FAQ:  http://lists.4d.com/faqnug.html
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: 4D Write PRO: editing a table / collections

2018-07-11 Thread Two Way Communications via 4D_Tech
So, what if the user has created a table (through a method), and now want to 
select a cell in that table and change it’s background color, or it’s width?

How can we do that?


Rudy Mortier
Two Way Communications bvba 



> On 11 Jul 2018, at 17:05, Two Way Communications via 4D_Tech 
> <4d_tech@lists.4d.com> wrote:
> 
> Thanks Achim. But what if the cell is not selected, and I want to fill the 
> cells by programming?
> 
> 
> 
> Rudy Mortier
> Two Way Communications bvba 
> 
> 
> 
>> On 11 Jul 2018, at 17:00, Achim Peschke via 4D_Tech <4d_tech@lists.4d.com> 
>> wrote:
>> 
>> I do it this way:
>> 
>> Cursor is in the cell or text is selected in the cell or cell is selected. I 
>> get the selection using WP Get selection. The I call WP SET TEXT with the 
>> selection range, give the new text and set parameters 3 and 4 accordingly.
>> 
>> Achim
>> 
>> 
>> 
>> 
>> -Ursprüngliche Nachricht-
>> Von: 4D_Tech [mailto:4d_tech-boun...@lists.4d.com] Im Auftrag von Two Way 
>> Communications via 4D_Tech
>> Gesendet: Mittwoch, 11. Juli 2018 16:37
>> An: 4D iNug Technical <4d_tech@lists.4d.com>
>> Cc: Two Way Communications 
>> Betreff: Re: 4D Write PRO: editing a table / collections
>> 
>> Thanks Achim!
>> 
>> Can I also set a text value or a reference in a specific table cell?
>> 
>> I tried:
>> 
>> $CellObj:=WP Table get cells(a$TableObj;colNr;rowNr)
>> WP SET TEXT($CellObj;”test”;wk replace;wk include in range)
>> 
>> but I get an error. When I try ST SET TEXT, the text is placed on top of the 
>> 4D Write document.
>> 
>> 
>> 
>> Rudy Mortier
>> Two Way Communications bvba
>> 
>> 
>> 
>>> On 11 Jul 2018, at 13:59, Achim Peschke via 4D_Tech <4d_tech@lists.4d.com> 
>>> wrote:
>>> 
>>> Do it simply. If the cursor is in a table, WP Get selection. With this 
>>> range WP Get elements(range; 4). Working this way you get the table and its 
>>> id as object in a collection. If the selection spans over more than 1 
>>> table, the collection contains an element for every table contained in the 
>>> selection.
>>> 
>>> Achim
>>> 
>>> 
>>> 
>>> 
>>> -Ursprüngliche Nachricht-
>>> Von: 4D_Tech [mailto:4d_tech-boun...@lists.4d.com] Im Auftrag von Two
>>> Way Communications via 4D_Tech
>>> Gesendet: Mittwoch, 11. Juli 2018 12:21
>>> An: 4D iNug Technical <4d_tech@lists.4d.com>
>>> Cc: Two Way Communications 
>>> Betreff: Re: 4D Write PRO: editing a table / collections
>>> 
>>> In v17, we can now get the element id’s, and also select the table objects 
>>> in a document, so that is definitely an improvement.
>>> 
>>> But, in case there is more than 1 table in the document,  I fail to get a 
>>> reference for the table where the cursor is in… has anyone figured out how 
>>> to do that?
>>> 
>>> How cool would that be ;-)
>>> 
>>> Rudy Mortier
>>> Two Way Communications bvba
>>> 
>>> 
>>> 
>>>> On 11 Jul 2018, at 00:30, JOHN BAUGHMAN via 4D_Tech <4d_tech@lists.4d.com> 
>>>> wrote:
>>>> 
>>>> Try putting the collection in a c_object and store the c_object in an
>>>> c_object field, or put the collection directly into the c_object
>>>> field
>>>> 
>>>> I am assuming that $tableObj is the object reference to the table. If 
>>>> tables are anything like images, your plan might not work. Each time a 
>>>> document is opened any images in the document gets a new object reference. 
>>>> If that is the case with tables, your stored references will not work.
>>>> 
>>>> John
>>>> 
>>>> 
>>>> 
>>>> John Baughman
>>>> 1331 Auwaiku Street
>>>> Kailua, Hawaii  96734
>>>> (808) 262-0328
>>>> john...@hawaii.rr.com
>>>> 
>>>>> On Jul 10, 2018, at 11:45 AM, Two Way Communications via 4D_Tech 
>>>>> <4d_tech@lists.4d.com> wrote:
>>>>> 
>>>>> I love the concept of tables in 4D Write Pro.
>>>>> 
>>>>> You can only add or change them by code, which is fine by me for the  
>>>>> moment.
>>>>> But what to do if a table has been created, and, in the 4D Write Pro 
>>>>> document, you would

Re: 4D Write PRO: editing a table / collections

2018-07-11 Thread Two Way Communications via 4D_Tech
Thanks Achim. But what if the cell is not selected, and I want to fill the 
cells by programming?



Rudy Mortier
Two Way Communications bvba 



> On 11 Jul 2018, at 17:00, Achim Peschke via 4D_Tech <4d_tech@lists.4d.com> 
> wrote:
> 
> I do it this way:
> 
> Cursor is in the cell or text is selected in the cell or cell is selected. I 
> get the selection using WP Get selection. The I call WP SET TEXT with the 
> selection range, give the new text and set parameters 3 and 4 accordingly.
> 
> Achim
> 
> 
> 
> 
> -Ursprüngliche Nachricht-
> Von: 4D_Tech [mailto:4d_tech-boun...@lists.4d.com] Im Auftrag von Two Way 
> Communications via 4D_Tech
> Gesendet: Mittwoch, 11. Juli 2018 16:37
> An: 4D iNug Technical <4d_tech@lists.4d.com>
> Cc: Two Way Communications 
> Betreff: Re: 4D Write PRO: editing a table / collections
> 
> Thanks Achim!
> 
> Can I also set a text value or a reference in a specific table cell?
> 
> I tried:
> 
> $CellObj:=WP Table get cells(a$TableObj;colNr;rowNr)
> WP SET TEXT($CellObj;”test”;wk replace;wk include in range)
> 
> but I get an error. When I try ST SET TEXT, the text is placed on top of the 
> 4D Write document.
> 
> 
> 
> Rudy Mortier
> Two Way Communications bvba
> 
> 
> 
>> On 11 Jul 2018, at 13:59, Achim Peschke via 4D_Tech <4d_tech@lists.4d.com> 
>> wrote:
>> 
>> Do it simply. If the cursor is in a table, WP Get selection. With this range 
>> WP Get elements(range; 4). Working this way you get the table and its id as 
>> object in a collection. If the selection spans over more than 1 table, the 
>> collection contains an element for every table contained in the selection.
>> 
>> Achim
>> 
>> 
>> 
>> 
>> -Ursprüngliche Nachricht-
>> Von: 4D_Tech [mailto:4d_tech-boun...@lists.4d.com] Im Auftrag von Two
>> Way Communications via 4D_Tech
>> Gesendet: Mittwoch, 11. Juli 2018 12:21
>> An: 4D iNug Technical <4d_tech@lists.4d.com>
>> Cc: Two Way Communications 
>> Betreff: Re: 4D Write PRO: editing a table / collections
>> 
>> In v17, we can now get the element id’s, and also select the table objects 
>> in a document, so that is definitely an improvement.
>> 
>> But, in case there is more than 1 table in the document,  I fail to get a 
>> reference for the table where the cursor is in… has anyone figured out how 
>> to do that?
>> 
>> How cool would that be ;-)
>> 
>> Rudy Mortier
>> Two Way Communications bvba
>> 
>> 
>> 
>>> On 11 Jul 2018, at 00:30, JOHN BAUGHMAN via 4D_Tech <4d_tech@lists.4d.com> 
>>> wrote:
>>> 
>>> Try putting the collection in a c_object and store the c_object in an
>>> c_object field, or put the collection directly into the c_object
>>> field
>>> 
>>> I am assuming that $tableObj is the object reference to the table. If 
>>> tables are anything like images, your plan might not work. Each time a 
>>> document is opened any images in the document gets a new object reference. 
>>> If that is the case with tables, your stored references will not work.
>>> 
>>> John
>>> 
>>> 
>>> 
>>> John Baughman
>>> 1331 Auwaiku Street
>>> Kailua, Hawaii  96734
>>> (808) 262-0328
>>> john...@hawaii.rr.com
>>> 
>>>> On Jul 10, 2018, at 11:45 AM, Two Way Communications via 4D_Tech 
>>>> <4d_tech@lists.4d.com> wrote:
>>>> 
>>>> I love the concept of tables in 4D Write Pro.
>>>> 
>>>> You can only add or change them by code, which is fine by me for the  
>>>> moment.
>>>> But what to do if a table has been created, and, in the 4D Write Pro 
>>>> document, you would want to add a column, or a row? Or change the width, 
>>>> the borders etc?
>>>> 
>>>> Apparently there is no way to select the table object. I have tried WP Get 
>>>> selection, but that doesn’t work for tables. Or maybe I am missing 
>>>> something.
>>>> 
>>>> I found out that I can select the table again (in code) using WP
>>>> SELECT($tableObj). So, as soon as I have created the table in code, I copy 
>>>> the table object in a collection. (Yes, I am using deep copy) I do that 
>>>> for every table created in the 4D Write Pro document.
>>>> When I save the record, I put the collection variable in a blob (VARIABLE 
>>>> TO BLOB), so I can retrieve the objects again.
>>>>

Re: 4D Write PRO: editing a table / collections

2018-07-11 Thread Two Way Communications via 4D_Tech
Thanks Achim!

Can I also set a text value or a reference in a specific table cell?

I tried:

$CellObj:=WP Table get cells(a$TableObj;colNr;rowNr)
WP SET TEXT($CellObj;”test”;wk replace;wk include in range)

but I get an error. When I try ST SET TEXT, the text is placed on top of the 4D 
Write document.



Rudy Mortier
Two Way Communications bvba 



> On 11 Jul 2018, at 13:59, Achim Peschke via 4D_Tech <4d_tech@lists.4d.com> 
> wrote:
> 
> Do it simply. If the cursor is in a table, WP Get selection. With this range 
> WP Get elements(range; 4). Working this way you get the table and its id as 
> object in a collection. If the selection spans over more than 1 table, the 
> collection contains an element for every table contained in the selection.
> 
> Achim
> 
> 
> 
> 
> -Ursprüngliche Nachricht-
> Von: 4D_Tech [mailto:4d_tech-boun...@lists.4d.com] Im Auftrag von Two Way 
> Communications via 4D_Tech
> Gesendet: Mittwoch, 11. Juli 2018 12:21
> An: 4D iNug Technical <4d_tech@lists.4d.com>
> Cc: Two Way Communications 
> Betreff: Re: 4D Write PRO: editing a table / collections
> 
> In v17, we can now get the element id’s, and also select the table objects in 
> a document, so that is definitely an improvement.
> 
> But, in case there is more than 1 table in the document,  I fail to get a 
> reference for the table where the cursor is in… has anyone figured out how to 
> do that?
> 
> How cool would that be ;-)
> 
> Rudy Mortier
> Two Way Communications bvba
> 
> 
> 
>> On 11 Jul 2018, at 00:30, JOHN BAUGHMAN via 4D_Tech <4d_tech@lists.4d.com> 
>> wrote:
>> 
>> Try putting the collection in a c_object and store the c_object in an
>> c_object field, or put the collection directly into the c_object
>> field
>> 
>> I am assuming that $tableObj is the object reference to the table. If tables 
>> are anything like images, your plan might not work. Each time a document is 
>> opened any images in the document gets a new object reference. If that is 
>> the case with tables, your stored references will not work.
>> 
>> John
>> 
>> 
>> 
>> John Baughman
>> 1331 Auwaiku Street
>> Kailua, Hawaii  96734
>> (808) 262-0328
>> john...@hawaii.rr.com
>> 
>>> On Jul 10, 2018, at 11:45 AM, Two Way Communications via 4D_Tech 
>>> <4d_tech@lists.4d.com> wrote:
>>> 
>>> I love the concept of tables in 4D Write Pro.
>>> 
>>> You can only add or change them by code, which is fine by me for the  
>>> moment.
>>> But what to do if a table has been created, and, in the 4D Write Pro 
>>> document, you would want to add a column, or a row? Or change the width, 
>>> the borders etc?
>>> 
>>> Apparently there is no way to select the table object. I have tried WP Get 
>>> selection, but that doesn’t work for tables. Or maybe I am missing 
>>> something.
>>> 
>>> I found out that I can select the table again (in code) using WP
>>> SELECT($tableObj). So, as soon as I have created the table in code, I copy 
>>> the table object in a collection. (Yes, I am using deep copy) I do that for 
>>> every table created in the 4D Write Pro document.
>>> When I save the record, I put the collection variable in a blob (VARIABLE 
>>> TO BLOB), so I can retrieve the objects again.
>>> 
>>> When I open the record, I read the collection from the blob (BLOB TO 
>>> VARIABLE), but OK returns 0, and the collection variable stays empty.
>>> 
>>> Here’s the code:
>>> 
>>> C_COLLECTION(c4WRTableCollections)
>>> c4WRTableCollections:=New collection
>>> BLOB TO
>>> VARIABLE([_10_Report_templates]Blob_4WR_tbls;c4WRTableCollections)
>>> 
>>> 
>>> 
>>> Any idea why it’s doing that, and how one could create a table in a 4D 
>>> Writw PRO document, save it, open it again, and edit the table?
>>> 
>>> 
>>> 
>>> Regards,
>>> 
>>> Rudy Mortier
>>> Two Way Communications bvba
>>> 
>>> 
>>> *
>>> *
>>> 4D Internet Users Group (4D iNUG)
>>> FAQ:  http://lists.4d.com/faqnug.html
>>> 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: 4D Write PRO: editing a table / collections

2018-07-11 Thread Two Way Communications via 4D_Tech
In v17, we can now get the element id’s, and also select the table objects in a 
document, so that is definitely an improvement.

But, in case there is more than 1 table in the document,  I fail to get a 
reference for the table where the cursor is in… has anyone figured out how to 
do that?

How cool would that be ;-)

Rudy Mortier
Two Way Communications bvba 



> On 11 Jul 2018, at 00:30, JOHN BAUGHMAN via 4D_Tech <4d_tech@lists.4d.com> 
> wrote:
> 
> Try putting the collection in a c_object and store the c_object in an 
> c_object field, or put the collection directly into the c_object  field
> 
> I am assuming that $tableObj is the object reference to the table. If tables 
> are anything like images, your plan might not work. Each time a document is 
> opened any images in the document gets a new object reference. If that is the 
> case with tables, your stored references will not work.
> 
> John
> 
> 
> 
> John Baughman
> 1331 Auwaiku Street
> Kailua, Hawaii  96734
> (808) 262-0328
> john...@hawaii.rr.com
> 
>> On Jul 10, 2018, at 11:45 AM, Two Way Communications via 4D_Tech 
>> <4d_tech@lists.4d.com> wrote:
>> 
>> I love the concept of tables in 4D Write Pro.
>> 
>> You can only add or change them by code, which is fine by me for the  moment.
>> But what to do if a table has been created, and, in the 4D Write Pro 
>> document, you would want to add a column, or a row? Or change the width, the 
>> borders etc?
>> 
>> Apparently there is no way to select the table object. I have tried WP Get 
>> selection, but that doesn’t work for tables. Or maybe I am missing something.
>> 
>> I found out that I can select the table again (in code) using WP 
>> SELECT($tableObj). So, as soon as I have created the table in code, I copy 
>> the table object in a collection. (Yes, I am using deep copy)
>> I do that for every table created in the 4D Write Pro document.
>> When I save the record, I put the collection variable in a blob (VARIABLE TO 
>> BLOB), so I can retrieve the objects again.
>> 
>> When I open the record, I read the collection from the blob (BLOB TO 
>> VARIABLE), but OK returns 0, and the collection variable stays empty.
>> 
>> Here’s the code:
>> 
>> C_COLLECTION(c4WRTableCollections)   
>> c4WRTableCollections:=New collection
>> BLOB TO VARIABLE([_10_Report_templates]Blob_4WR_tbls;c4WRTableCollections)
>>  
>> 
>>  
>> Any idea why it’s doing that, and how one could create a table in a 4D Writw 
>> PRO document, save it, open it again, and edit the table?
>> 
>> 
>> 
>> Regards,
>> 
>> Rudy Mortier
>> Two Way Communications bvba 
>> 
>> 
>> **
>> 4D Internet Users Group (4D iNUG)
>> FAQ:  http://lists.4d.com/faqnug.html
>> Archive:  http://lists.4d.com/archives.html
>> Options: https://lists.4d.com/mailman/options/4d_tech
>> Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
>> **
> 
> **
> 4D Internet Users Group (4D iNUG)
> FAQ:  http://lists.4d.com/faqnug.html
> Archive:  http://lists.4d.com/archives.html
> Options: https://lists.4d.com/mailman/options/4d_tech
> Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
> **

**
4D Internet Users Group (4D iNUG)
FAQ:  http://lists.4d.com/faqnug.html
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: 4D Write PRO: editing a table / collections

2018-07-11 Thread Two Way Communications via 4D_Tech
You’re right, John.

When I re-open the document, the table has another reference, and WP SELECT 
doesn’t work anymore…

Is there any other way to get the object reference for a table in a 4D Write 
PRO document?

WP Get selection doesn’t seem to work for table objects: 

$WPRange:=WP Get selection([_10_Report_templates]Template_WRPRO)
WP GET ATTRIBUTES($WPRange;wk start;Start)
WP GET ATTRIBUTES($WPRange;wk end;$end)
WP GET ATTRIBUTES($WPRange;wk type;$type)
WP GET ATTRIBUTES($WPRange;wk table id;$tblid)

wk type always returns 0, and an error is returned when getting the wk table id 
… no matter what I select in the document.


Rudy Mortier
Two Way Communications bvba 



> On 11 Jul 2018, at 00:30, JOHN BAUGHMAN via 4D_Tech <4d_tech@lists.4d.com> 
> wrote:
> 
> Try putting the collection in a c_object and store the c_object in an 
> c_object field, or put the collection directly into the c_object  field
> 
> I am assuming that $tableObj is the object reference to the table. If tables 
> are anything like images, your plan might not work. Each time a document is 
> opened any images in the document gets a new object reference. If that is the 
> case with tables, your stored references will not work.
> 
> John
> 
> 
> 
> John Baughman
> 1331 Auwaiku Street
> Kailua, Hawaii  96734
> (808) 262-0328
> john...@hawaii.rr.com
> 
>> On Jul 10, 2018, at 11:45 AM, Two Way Communications via 4D_Tech 
>> <4d_tech@lists.4d.com> wrote:
>> 
>> I love the concept of tables in 4D Write Pro.
>> 
>> You can only add or change them by code, which is fine by me for the  moment.
>> But what to do if a table has been created, and, in the 4D Write Pro 
>> document, you would want to add a column, or a row? Or change the width, the 
>> borders etc?
>> 
>> Apparently there is no way to select the table object. I have tried WP Get 
>> selection, but that doesn’t work for tables. Or maybe I am missing something.
>> 
>> I found out that I can select the table again (in code) using WP 
>> SELECT($tableObj). So, as soon as I have created the table in code, I copy 
>> the table object in a collection. (Yes, I am using deep copy)
>> I do that for every table created in the 4D Write Pro document.
>> When I save the record, I put the collection variable in a blob (VARIABLE TO 
>> BLOB), so I can retrieve the objects again.
>> 
>> When I open the record, I read the collection from the blob (BLOB TO 
>> VARIABLE), but OK returns 0, and the collection variable stays empty.
>> 
>> Here’s the code:
>> 
>> C_COLLECTION(c4WRTableCollections)   
>> c4WRTableCollections:=New collection
>> BLOB TO VARIABLE([_10_Report_templates]Blob_4WR_tbls;c4WRTableCollections)
>>  
>> 
>>  
>> Any idea why it’s doing that, and how one could create a table in a 4D Writw 
>> PRO document, save it, open it again, and edit the table?
>> 
>> 
>> 
>> Regards,
>> 
>> Rudy Mortier
>> Two Way Communications bvba 
>> 
>> 
>> **
>> 4D Internet Users Group (4D iNUG)
>> FAQ:  http://lists.4d.com/faqnug.html
>> Archive:  http://lists.4d.com/archives.html
>> Options: https://lists.4d.com/mailman/options/4d_tech
>> Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
>> **
> 
> **
> 4D Internet Users Group (4D iNUG)
> FAQ:  http://lists.4d.com/faqnug.html
> Archive:  http://lists.4d.com/archives.html
> Options: https://lists.4d.com/mailman/options/4d_tech
> Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
> **

**
4D Internet Users Group (4D iNUG)
FAQ:  http://lists.4d.com/faqnug.html
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: 4D Write PRO: editing a table / collections

2018-07-10 Thread Randy Jaynes via 4D_Tech
Another thing we’re struggling with is that we’re building 4D WP documents 
using code and make tables so that the resulting area can be easily turned into 
an HTML email.

Unfortunately, that makes the Write area awkward for a user to modify. It’s not 
easy to manipulate the tables (delete/add columns or rows, or delete the whole 
table).

We opted for this route in order to be able to go to HTML easily because we 
found that using tab stops didn’t translate well.

Seems to be a catch-22. We tried v17 today to see if it was any better than 
v16R6, but doesn’t seem to be.

Your solution for tracking the collection would seem to help if we were doing 
everything with code, but seems like it doesn’t change anything with regard to 
letting a user make changes themselves.

Randy

--
Randy Jaynes
Senior Programmer and Customer Support

http://printpoint.com  • 845.687.3741 • PrintPoint, Inc 
• 57 Ludlow Lane • Palisades, NY 10964 
Please send all email contacts to supp...@printpoint.com 





> On Jul 10, 2018, at 5:45 PM, Two Way Communications via 4D_Tech 
> <4d_tech@lists.4d.com > wrote:
> 
> I love the concept of tables in 4D Write Pro.
> 
> You can only add or change them by code, which is fine by me for the  moment.
> But what to do if a table has been created, and, in the 4D Write Pro 
> document, you would want to add a column, or a row? Or change the width, the 
> borders etc?
> 
> Apparently there is no way to select the table object. I have tried WP Get 
> selection, but that doesn’t work for tables. Or maybe I am missing something.
> 
> I found out that I can select the table again (in code) using WP 
> SELECT($tableObj). So, as soon as I have created the table in code, I copy 
> the table object in a collection. (Yes, I am using deep copy)
> I do that for every table created in the 4D Write Pro document.
> When I save the record, I put the collection variable in a blob (VARIABLE TO 
> BLOB), so I can retrieve the objects again.
> 
> When I open the record, I read the collection from the blob (BLOB TO 
> VARIABLE), but OK returns 0, and the collection variable stays empty.
> 
> Here’s the code:
> 
> C_COLLECTION(c4WRTableCollections)
> c4WRTableCollections:=New collection
> BLOB TO VARIABLE([_10_Report_templates]Blob_4WR_tbls;c4WRTableCollections)
>   
> 
>   
> Any idea why it’s doing that, and how one could create a table in a 4D Writw 
> PRO document, save it, open it again, and edit the table?
> 
> 
> 
> Regards,
> 
> Rudy Mortier
> Two Way Communications bvba 
> 
> 
> **
> 4D Internet Users Group (4D iNUG)
> FAQ:  http://lists.4d.com/faqnug.html 
> Archive:  http://lists.4d.com/archives.html 
> 
> Options: https://lists.4d.com/mailman/options/4d_tech 
> 
> Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com 
> 
> **

**
4D Internet Users Group (4D iNUG)
FAQ:  http://lists.4d.com/faqnug.html
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: 4D Write PRO: editing a table / collections

2018-07-10 Thread JOHN BAUGHMAN via 4D_Tech
Try putting the collection in a c_object and store the c_object in an c_object 
field, or put the collection directly into the c_object  field

I am assuming that $tableObj is the object reference to the table. If tables 
are anything like images, your plan might not work. Each time a document is 
opened any images in the document gets a new object reference. If that is the 
case with tables, your stored references will not work.

John



John Baughman
1331 Auwaiku Street
Kailua, Hawaii  96734
(808) 262-0328
john...@hawaii.rr.com

> On Jul 10, 2018, at 11:45 AM, Two Way Communications via 4D_Tech 
> <4d_tech@lists.4d.com> wrote:
> 
> I love the concept of tables in 4D Write Pro.
> 
> You can only add or change them by code, which is fine by me for the  moment.
> But what to do if a table has been created, and, in the 4D Write Pro 
> document, you would want to add a column, or a row? Or change the width, the 
> borders etc?
> 
> Apparently there is no way to select the table object. I have tried WP Get 
> selection, but that doesn’t work for tables. Or maybe I am missing something.
> 
> I found out that I can select the table again (in code) using WP 
> SELECT($tableObj). So, as soon as I have created the table in code, I copy 
> the table object in a collection. (Yes, I am using deep copy)
> I do that for every table created in the 4D Write Pro document.
> When I save the record, I put the collection variable in a blob (VARIABLE TO 
> BLOB), so I can retrieve the objects again.
> 
> When I open the record, I read the collection from the blob (BLOB TO 
> VARIABLE), but OK returns 0, and the collection variable stays empty.
> 
> Here’s the code:
> 
> C_COLLECTION(c4WRTableCollections)
> c4WRTableCollections:=New collection
> BLOB TO VARIABLE([_10_Report_templates]Blob_4WR_tbls;c4WRTableCollections)
>   
> 
>   
> Any idea why it’s doing that, and how one could create a table in a 4D Writw 
> PRO document, save it, open it again, and edit the table?
> 
> 
> 
> Regards,
> 
> Rudy Mortier
> Two Way Communications bvba 
> 
> 
> **
> 4D Internet Users Group (4D iNUG)
> FAQ:  http://lists.4d.com/faqnug.html
> Archive:  http://lists.4d.com/archives.html
> Options: https://lists.4d.com/mailman/options/4d_tech
> Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
> **

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