Re: LISTBOX INSERT COLUMN not getting data

2017-01-28 Thread Lee Hinde
Cool.  Thanks.

> On Jan 28, 2017, at 10:33 AM, John DeSoi  wrote:
> 
> Yes, you can declare a 2D array of each type and then just allocate listbox 
> columns as needed from the 2D arrays.
> 
> John DeSoi, Ph.D.
> 
> 
> 
>> On Jan 28, 2017, at 12:07 PM, Lee Hinde  wrote:
>> 
>> In my case I am flattening out c_objectc/fields. By definition I don’t know 
>> how many keys will be in whatever I’m finding. So I have to pre-declare my 
>> best guess + 10 to have them ready.
>> 
>> I think. There isn’t a way to do this in real time, is there?
> 

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

Re: LISTBOX INSERT COLUMN not getting data

2017-01-28 Thread Arnaud de Montard

> Le 28 janv. 2017 à 19:07, Lee Hinde  a écrit :
> 
> In my case I am flattening out c_objectc/fields. By definition I don’t know 
> how many keys will be in whatever I’m finding. So I have to pre-declare my 
> best guess + 10 to have them ready.
> 
> I think. There isn’t a way to do this in real time, is there?

In that case I use 2d arrays of various types, one by field type. 

Let's say for example you have these fields: 1 alpha, 1 text, 1 real, 2 long. 
  array text($_a2t;2;0)  //1 alpha + 1 text
  array real($_a2r;1;0)  //1 real
  array long($_a2l;2;0)  //2 long

Schematically, for a given type of field, the code must add a column to the 
corresponding 2D array type, and set that column as the field target when 
you'll execute STA. Not the same situation, but same principle here:

- lines 45..50 = 2D arrays we may need
- lines 87..115 = add a column to the array of the wanted type 

-- 
Arnaud de Montard 


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

Re: LISTBOX INSERT COLUMN not getting data

2017-01-28 Thread John DeSoi
Yes, you can declare a 2D array of each type and then just allocate listbox 
columns as needed from the 2D arrays.

John DeSoi, Ph.D.



> On Jan 28, 2017, at 12:07 PM, Lee Hinde  wrote:
> 
> In my case I am flattening out c_objectc/fields. By definition I don’t know 
> how many keys will be in whatever I’m finding. So I have to pre-declare my 
> best guess + 10 to have them ready.
> 
> I think. There isn’t a way to do this in real time, is there?

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

Re: LISTBOX INSERT COLUMN not getting data

2017-01-28 Thread Lee Hinde
In my case I am flattening out c_objectc/fields. By definition I don’t know how 
many keys will be in whatever I’m finding. So I have to pre-declare my best 
guess + 10 to have them ready.

I think. There isn’t a way to do this in real time, is there?


> On Jan 28, 2017, at 8:41 AM, Arnaud de Montard  wrote:
> 
> 
>> Le 28 janv. 2017 à 00:03, Kirk Brooks  a écrit :
>> 
>> I've settled on a 3 step methodology that works like this (which I was
>> tweaking just the other day):
>> 
>> 1) get the column var pointers from the Listbox get arrays command (wrapped
>> in ​Listbox_get_colVarArray​).
>> 2) declare the variable type of those columns.
>> 3) then populate the arrays​.[...]
> 
> I like that way, it sounds better than copy! I'll change my habits for my 
> next array listbox… 
> BTW, I use a wrapper for LISTBOX GET ARRAYS too:
> 
> I was tired to declare 6 or more arrays just to get one. 
> 
> I have a question about typing in step 2 and SELECTION TO ARRAY (STA) in step 
> 3: 
> • STA interpreted will type the target array according to the source field
> • STA compiled will strictly not accept "incompatible" source field and 
> target array (for example: STA(integerField;longintArray) throws an error)
> • using STA 1st in a local array, then COPY ARRAY to a pointer on a column 
> listbox, I never noticed the array type way different from the field
> This to say I'd be tempted by "JackSparrowing" step 2: remove. Do I miss 
> something? 
> 
> -- 
> Arnaud de Montard 
> 
> 
> 
> 
> **
> 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
> **

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

Re: LISTBOX INSERT COLUMN not getting data

2017-01-27 Thread Kirk Brooks
Lee,
I've settled on a 3 step methodology that works like this (which I was
tweaking just the other day):

1) get the column var pointers from the Listbox get arrays command (wrapped
in ​
Listbox_get_colVarArray
​).
2) declare the variable type of those columns.
3) then populate the arrays​.

​
And here's those steps applied to a listbox populated with dynamic column
vars:


  //  get pointers to the arrays in the listbox

ARRAY POINTER($aPtr;0)

Listbox_get_colVarArray ("itemPriceLB";->$aPtr)

ARRAY TEXT($aPtr{1}->;0)
ARRAY TEXT($aPtr{2}->;0)
ARRAY REAL($aPtr{3}->;0)
ARRAY REAL($aPtr{4}->;0)
ARRAY LONGINT($aPtr{5}->;0)

Case of
: (Records in selection([Catalog_Items_curPrice])=0)

$errMsg:="No item prices found."


Else   // load the listbox

SELECTION TO ARRAY([Catalog_Items_curPrice]vendorName;$aPtr{1}->)

SELECTION TO ARRAY([Catalog_Items_curPrice]unit;$aPtr{2}->)

SELECTION TO ARRAY([Catalog_Items_curPrice]price;$aPtr{3}->)

SELECTION TO ARRAY([Catalog_Items_curPrice]cost;$aPtr{4}->)

SELECTION TO ARRAY([Catalog_Items_curPrice]ID;$aPtr{5}->)

End case

​
​You can get along in a lot of cases without declaring the arrays after the
listbox exists - until it mysteriously stops working. To paraphrase the
great developer Jack Sparrow, "those listbox dynamic variable types aren't
really types - they're more like guidelines." Actually declaring them takes
away any ambiguity. Note - I've never tried changing the type from what's
in the listbox to something else. No idea what that would do.

I find using the array of pointers more reliable than using Object get
pointer. No idea if it's an actual quantitative difference or my loosey
goosey programming style but I rarely have problems when I use the pointers
LISTBOX GET ARRAYS returns. Using the same approach you outlined just
didn't always work for me either.

You could throw in a step to check the size of the pointer array to make
sure you have all the variables you think you should.

​


On Fri, Jan 27, 2017 at 1:20 PM, Lee Hinde  wrote:

> Thanks Paul. In this case all the arrays are of equal length and all have
> data.
>
> The array returned by LISTBOX GET ARRAYS shows the expected results.
>
>
> On Fri, Jan 27, 2017 at 1:13 PM, Paul Ringsmuth 
> wrote:
>
> > I was just reading about list boxes today. If any of the columns have no
> > data, you will get a selection of no records.
> >
> > The number of rows shown will equal the shortest row of data in any
> column.
> >
> > Paul Ringsmuth
> > 515 Aberdeen Dr
> > Waite Park, MN 56387
> > 320-223-2747
> > pringsm...@charter.net
> >
> >
> > > On Jan 27, 2017, at 3:07 PM, Lee Hinde  wrote:
> > >
> > > I’m trying to populate a listbox.
> > >
> > > After building a bunch of generically named arrays, I pass them all in.
> > >
> > > I’m getting headers, but no data.
> > >
> > > The list box get arrays command at the bottom reflects what I intend to
> > happen, but the data isn’t showing up
> > >
> > > Something simple, I assume, that you all figured out years ago.
> > >
> > > For ($prop_index;1;$property_count)
> > >   C_TEXT($col_name)
> > >   $col_name:="$array_"+String($prop_index)
> > >   $get_pointer:=Get pointer($col_name)
> > >
> > >   $col_header_name:="$header_text_"+String($prop_index)
> > >   $get_header_ptr:=Get pointer($col_header_name)
> > >
> > >   LISTBOX INSERT COLUMN(*;$list_box_name;$prop_
> > index;$col_name;$get_pointer->;$col_header_name;$get_header_ptr->)
> > >   OBJECT SET TITLE($get_header_ptr->;$lb_
> > property_names{$prop_index})
> > >
> > > End for
> > >
> > > $count:=LISTBOX Get number of columns(*;$list_box_name)
> > > LISTBOX GET ARRAYS(*;$list_box_name;arrColNames;arrHeaderNames;
> > arrColVars;arrHeaderVars;arrColsVisible;arrStyles)
> > >
> >
> >
> **
> 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
> **
>



-- 
Kirk Brooks
San Francisco, CA
===
**
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
**

Re: LISTBOX INSERT COLUMN not getting data

2017-01-27 Thread Lee Hinde
Thanks Paul. In this case all the arrays are of equal length and all have
data.

The array returned by LISTBOX GET ARRAYS shows the expected results.


On Fri, Jan 27, 2017 at 1:13 PM, Paul Ringsmuth 
wrote:

> I was just reading about list boxes today. If any of the columns have no
> data, you will get a selection of no records.
>
> The number of rows shown will equal the shortest row of data in any column.
>
> Paul Ringsmuth
> 515 Aberdeen Dr
> Waite Park, MN 56387
> 320-223-2747
> pringsm...@charter.net
>
>
> > On Jan 27, 2017, at 3:07 PM, Lee Hinde  wrote:
> >
> > I’m trying to populate a listbox.
> >
> > After building a bunch of generically named arrays, I pass them all in.
> >
> > I’m getting headers, but no data.
> >
> > The list box get arrays command at the bottom reflects what I intend to
> happen, but the data isn’t showing up
> >
> > Something simple, I assume, that you all figured out years ago.
> >
> > For ($prop_index;1;$property_count)
> >   C_TEXT($col_name)
> >   $col_name:="$array_"+String($prop_index)
> >   $get_pointer:=Get pointer($col_name)
> >
> >   $col_header_name:="$header_text_"+String($prop_index)
> >   $get_header_ptr:=Get pointer($col_header_name)
> >
> >   LISTBOX INSERT COLUMN(*;$list_box_name;$prop_
> index;$col_name;$get_pointer->;$col_header_name;$get_header_ptr->)
> >   OBJECT SET TITLE($get_header_ptr->;$lb_
> property_names{$prop_index})
> >
> > End for
> >
> > $count:=LISTBOX Get number of columns(*;$list_box_name)
> > LISTBOX GET ARRAYS(*;$list_box_name;arrColNames;arrHeaderNames;
> arrColVars;arrHeaderVars;arrColsVisible;arrStyles)
> >
>
>
**
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
**

Re: Listbox insert column

2016-10-07 Thread Peter Mew
Ahh
Drag the headers - Excellent
Thanks very much
cheers
-pm

On Fri, Oct 7, 2016 at 9:16 PM, Keith Culotta  wrote:

> I forget how v13 may have accomplished this...  In v15 the contextual menu
> has "Add column before", "Add column after" options.  You should also be
> able to grab the Header cell of the column and drag it left and right.
>
> Keith - CDI
>
> > On Oct 7, 2016, at 3:08 PM, Peter Mew  wrote:
> >
> > Nope
> > If I do that the column is added at the right hand side, then how do I
> move
> > it between existing columns 2 & 3.
> > And how do I delete a column?
> > this is v13 and Yosemite
> >
> > thanks
> > -pm
> >
> > On Fri, Oct 7, 2016 at 8:47 PM, Keith Culotta  wrote:
> >
> >> Highlight a column.  Right-click (or control-click) on the column and
> you
> >> will see the contextual menu.
> >>
> >> Keith - CDI
> >>
> >>> On Oct 7, 2016, at 2:32 PM, Peter Mew  wrote:
> >>>
> >>> Hi
> >>> I cant find how to do this.
> >>> I have an array based listbox, with several columns.
> >>> I now want to add another column between my existing column 2 and
> column
> >> 3
> >>> not by code, but in the design environment
> >>> Ive tried adding a new column at the right hand end and dragging it, I
> >> cant
> >>> find an insert column command
> >>> How is it done?
> >>>
> >>> Many thanks
> >>> -pm
> >>> **
> >>> 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
> >>> **
> >>
> >> **
> >> 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
> >> **
> > **
> > 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
> > **
>
> **
> 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
> **
>
**
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
**

Re: Listbox insert column

2016-10-07 Thread Keith Culotta
I forget how v13 may have accomplished this...  In v15 the contextual menu has 
"Add column before", "Add column after" options.  You should also be able to 
grab the Header cell of the column and drag it left and right.

Keith - CDI

> On Oct 7, 2016, at 3:08 PM, Peter Mew  wrote:
> 
> Nope
> If I do that the column is added at the right hand side, then how do I move
> it between existing columns 2 & 3.
> And how do I delete a column?
> this is v13 and Yosemite
> 
> thanks
> -pm
> 
> On Fri, Oct 7, 2016 at 8:47 PM, Keith Culotta  wrote:
> 
>> Highlight a column.  Right-click (or control-click) on the column and you
>> will see the contextual menu.
>> 
>> Keith - CDI
>> 
>>> On Oct 7, 2016, at 2:32 PM, Peter Mew  wrote:
>>> 
>>> Hi
>>> I cant find how to do this.
>>> I have an array based listbox, with several columns.
>>> I now want to add another column between my existing column 2 and column
>> 3
>>> not by code, but in the design environment
>>> Ive tried adding a new column at the right hand end and dragging it, I
>> cant
>>> find an insert column command
>>> How is it done?
>>> 
>>> Many thanks
>>> -pm
>>> **
>>> 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
>>> **
>> 
>> **
>> 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
>> **
> **
> 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
> **

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

Re: Listbox insert column

2016-10-07 Thread Keith Culotta
Highlight a column.  Right-click (or control-click) on the column and you will 
see the contextual menu.

Keith - CDI

> On Oct 7, 2016, at 2:32 PM, Peter Mew  wrote:
> 
> Hi
> I cant find how to do this.
> I have an array based listbox, with several columns.
> I now want to add another column between my existing column 2 and column 3
> not by code, but in the design environment
> Ive tried adding a new column at the right hand end and dragging it, I cant
> find an insert column command
> How is it done?
> 
> Many thanks
> -pm
> **
> 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
> **

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