Re: Setting up an entity / collection listbox in code

2018-10-31 Thread Jeremy Roussak via 4D_Tech
Julio, you provide the answer to my question, which is “no”. I’m disappointed, 
I must confess.

Everyone, thanks for suggesting workarounds. I hope the ability to specify the 
properties in code will be implemented - and soon!

Jeremy


> On 30 Oct 2018, at 20:10, Julio Carneiro via 4D_Tech <4d_tech@lists.4d.com> 
> wrote:
> 
> Jeremy,
> 
> I have something similar to what you have, and I use entity selection. Except 
> that I have a single column Listbox already set in the forms where I need 
> them,
> The missing link for a completely dynamic Listbox is the ability to set the 
> “Datasource” properties by code.
> 
> As of V17r2, afaik, those properties must be set via the Form editor.
> Without them you cannot get or set the selected row(s).
> 
> julio


**
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: Setting up an entity / collection listbox in code

2018-10-30 Thread John DeSoi via 4D_Tech
Maybe it could work if you adopted the convention that the collection 
properties are based on the listbox object name, e.g.

Form.listbox1__currentItem
Form.listbox1__selectedItems
etc.

You would have to adjust these properties after the first listbox, but I assume 
the component could manage the selection just by knowing the listbox object 
name. Not tested.

The other way to do it is to generate the entire form including the list boxes 
with code. A lot more work up front, but hopefully worth it in the long run.

John DeSoi, Ph.D.


> On Oct 30, 2018, at 3:21 AM, Jeremy Roussak via 4D_Tech 
> <4d_tech@lists.4d.com> wrote:
> 
> It seems to me that that won’t work with entity boxes unless I put them in 
> subforms or set up the variables (your Form.xx variables) myself. Even then, 
> the component can’t “know” which variables to use unless I tell it directly, 
> because it can’t read the box to determine what they are.
> 
> That seems to me a retrograde step, a step back from “everything about a 
> listbox is readable and configurable in code” which we had reached before.

**
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: Setting up an entity / collection listbox in code

2018-10-30 Thread Julio Carneiro via 4D_Tech
Jeremy,

I have something similar to what you have, and I use entity selection. Except 
that I have a single column Listbox already set in the forms where I need them,
The missing link for a completely dynamic Listbox is the ability to set the 
“Datasource” properties by code.

As of V17r2, afaik, those properties must be set via the Form editor.
Without them you cannot get or set the selected row(s).

julio

> On Oct 30, 2018, at 5:21 AM, Jeremy Roussak via 4D_Tech 
> <4d_tech@lists.4d.com> wrote:
> 
> Jeremy / Kirk
> 
> Thanks for the replies. 
> 
> They don'tt really address my question, though. As things stand, I have a 
> component which sets up and manages listboxes which I’ve designed: I tell it 
> the sources and the columns and it handles the rest. I plonk an empty listbox 
> (of the correct type: array or selection) on the form, call the component in 
> its object method, passing it only the name of the configuration, and need do 
> nothing else. If I want a second listbox on the same form, I just put it 
> there and pass the component a different name. It works for array and 
> selection boxes.
> 
> It seems to me that that won’t work with entity boxes unless I put them in 
> subforms or set up the variables (your Form.xx variables) myself. Even then, 
> the component can’t “know” which variables to use unless I tell it directly, 
> because it can’t read the box to determine what they are.
> 
> That seems to me a retrograde step, a step back from “everything about a 
> listbox is readable and configurable in code” which we had reached before.
> 
> Am I wrong?
> 
> Jeremy
> 
> 
>> On 29 Oct 2018, at 13:05, Jeremy French > > wrote:
>> 
>>> It’s great to be able to make generic listboxes and set them up entirely in 
>>> code. It’s easy for array-based and selection-based listboxes, but can it 
>>> be done for entity/collection boxes?
>> 
>> Yes. It's even more easy using collections.
>> 
>>> In other words, are there LISTBOX SET xx calls to identify the names of the 
>>> variables unique to entity/collection boxes: the collection/entity source; 
>>> the current item; the current item position; and the selected items? 
>> 
>> No new listbox commands are needed, since we have the "Form" command.
>> 
>> I'm using the naming convention:
>> 
>> Form.LBA
>> Form.itemA
>> Form.indexA
>> Form.selectedA
>> 
>> where "A" uniquely identies the listbox collection. If more than one listbox 
>> is present on the form, the "A" becomes "B", "C" and so on.
>> 
>> So the listbox properties would show these references:
>> 
>> https://i.postimg.cc/SxB6FPPL/collection-listbox.png 
>> 
>> 
>> Use the "LISTBOX INSERT COLUMN FORMULA” command to create columns. Remember 
>> to prefix attribute names with “This."
>> 
>> 
>> 
>> 
>>> On Oct 29, 2018, at 6:21 AM, Jeremy Roussak via 4D_Tech 
>>> <4d_tech@lists.4d.com  
>>> >> wrote:
>>> 
>>> It’s great to be able to make generic listboxes and set them up entirely in 
>>> code. It’s easy for array-based and selection-based listboxes, but can it 
>>> be done for entity/collection boxes?
>>> 
>>> In other words, are there LISTBOX SET xx calls to identify the names of the 
>>> variables unique to entity/collection boxes: the collection/entity source; 
>>> the current item; the current item position; and the selected items? 
>>> 
>>> I can’t find them, but it’s perfectly possible that, as so often, I’ve 
>>> missed something.
>>> 
>>> Jeremy
>>> **
>>> 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 
>>>  
>>> >> >
>>> **
>> 
> 
> **
> 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
> **

--
Julio Carneiro
jjfo...@gmail.com



**
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: Setting up an entity / collection listbox in code

2018-10-30 Thread Jeremy Roussak via 4D_Tech
Jeremy / Kirk

Thanks for the replies. 

They don'tt really address my question, though. As things stand, I have a 
component which sets up and manages listboxes which I’ve designed: I tell it 
the sources and the columns and it handles the rest. I plonk an empty listbox 
(of the correct type: array or selection) on the form, call the component in 
its object method, passing it only the name of the configuration, and need do 
nothing else. If I want a second listbox on the same form, I just put it there 
and pass the component a different name. It works for array and selection boxes.

It seems to me that that won’t work with entity boxes unless I put them in 
subforms or set up the variables (your Form.xx variables) myself. Even then, 
the component can’t “know” which variables to use unless I tell it directly, 
because it can’t read the box to determine what they are.

That seems to me a retrograde step, a step back from “everything about a 
listbox is readable and configurable in code” which we had reached before.

Am I wrong?

Jeremy


> On 29 Oct 2018, at 13:05, Jeremy French  wrote:
> 
>> It’s great to be able to make generic listboxes and set them up entirely in 
>> code. It’s easy for array-based and selection-based listboxes, but can it be 
>> done for entity/collection boxes?
> 
> Yes. It's even more easy using collections.
> 
>> In other words, are there LISTBOX SET xx calls to identify the names of the 
>> variables unique to entity/collection boxes: the collection/entity source; 
>> the current item; the current item position; and the selected items? 
> 
> No new listbox commands are needed, since we have the "Form" command.
>  
> I'm using the naming convention:
> 
> Form.LBA
> Form.itemA
> Form.indexA
> Form.selectedA
> 
> where "A" uniquely identies the listbox collection. If more than one listbox 
> is present on the form, the "A" becomes "B", "C" and so on.
> 
> So the listbox properties would show these references:
> 
> https://i.postimg.cc/SxB6FPPL/collection-listbox.png 
> 
> 
> Use the "LISTBOX INSERT COLUMN FORMULA” command to create columns. Remember 
> to prefix attribute names with “This."
> 
> 
> 
> 
>> On Oct 29, 2018, at 6:21 AM, Jeremy Roussak via 4D_Tech 
>> <4d_tech@lists.4d.com > wrote:
>> 
>> It’s great to be able to make generic listboxes and set them up entirely in 
>> code. It’s easy for array-based and selection-based listboxes, but can it be 
>> done for entity/collection boxes?
>> 
>> In other words, are there LISTBOX SET xx calls to identify the names of the 
>> variables unique to entity/collection boxes: the collection/entity source; 
>> the current item; the current item position; and the selected items? 
>> 
>> I can’t find them, but it’s perfectly possible that, as so often, I’ve 
>> missed something.
>> 
>> Jeremy
>> **
>> 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 
>> 
>> **
> 

**
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: Setting up an entity / collection listbox in code

2018-10-29 Thread Kirk Brooks via 4D_Tech
Jeremy,
Jeremy French outlines the steps you need to follow. I would add a couple
of ideas expanding on his post if you have multiple listboxes in a form.

The first is simply adopt a custom of putting all the listboxes in a single
object of the parent form. So I might have:

Form.LB.A...

Which means "LB" is an object I use for all the listboxes. "A" is the
object for the first listbox and so on.

Subforms are really helpful in this situation too. You can design a subform
whose only purpose is to display a listbox. This subform can be duplicated
multiple times on the parent form and the subform object itself can be a
collection or object. Now the cool part is the contents of the subform Form
object ARE the Form object of the subform. And these can be linked to the
parent form's Form.

This is particularly convenient for configuring LBs for tools or controls
of various types but they can also be full blown listboxes as well.

On Mon, Oct 29, 2018 at 3:22 AM Jeremy Roussak via 4D_Tech <
4d_tech@lists.4d.com> wrote:

> It’s great to be able to make generic listboxes and set them up entirely
> in code. It’s easy for array-based and selection-based listboxes, but can
> it be done for entity/collection boxes?
>
> In other words, are there LISTBOX SET xx calls to identify the names of
> the variables unique to entity/collection boxes: the collection/entity
> source; the current item; the current item position; and the selected
> items?
>
> I can’t find them, but it’s perfectly possible that, as so often, I’ve
> missed something.
>
> Jeremy
> **
> 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
> **



-- 
Kirk Brooks
San Francisco, CA
===

*We go vote - they go home*
**
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: Setting up an entity / collection listbox in code

2018-10-29 Thread Jeremy French via 4D_Tech
> It’s great to be able to make generic listboxes and set them up entirely in 
> code. It’s easy for array-based and selection-based listboxes, but can it be 
> done for entity/collection boxes?

Yes. It's even more easy using collections.

> In other words, are there LISTBOX SET xx calls to identify the names of the 
> variables unique to entity/collection boxes: the collection/entity source; 
> the current item; the current item position; and the selected items? 

No new listbox commands are needed, since we have the "Form" command.
 
I'm using the naming convention:

Form.LBA
Form.itemA
Form.indexA
Form.selectedA

where "A" uniquely identies the listbox collection. If more than one listbox is 
present on the form, the "A" becomes "B", "C" and so on.

So the listbox properties would show these references:

https://i.postimg.cc/SxB6FPPL/collection-listbox.png 


Use the "LISTBOX INSERT COLUMN FORMULA” command to create columns. Remember to 
prefix attribute names with “This."




> On Oct 29, 2018, at 6:21 AM, Jeremy Roussak via 4D_Tech 
> <4d_tech@lists.4d.com> wrote:
> 
> It’s great to be able to make generic listboxes and set them up entirely in 
> code. It’s easy for array-based and selection-based listboxes, but can it be 
> done for entity/collection boxes?
> 
> In other words, are there LISTBOX SET xx calls to identify the names of the 
> variables unique to entity/collection boxes: the collection/entity source; 
> the current item; the current item position; and the selected items? 
> 
> I can’t find them, but it’s perfectly possible that, as so often, I’ve missed 
> something.
> 
> Jeremy
> **
> 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
> **

**
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
**