Randy, Here are a couple of methods that are handy working with almost any type of listbox pre collection based ones.
First is my method for getting the column variable pointers. Greatly simplifies working with a listbox constructed of dynamic columns. You pass the name of the listbox and a pointer to a pointer array. The pointer array is populated with the column vars. Sometimes this is easier than screwing around with the specific column names to get those pointers. That is useful if you didn't want to bother with cogent names for the columns in the first place. If the listbox is in a subform you include the subform name as $3. // Method: Listbox_get_colVarArray (text; pointer{;text}) // $1 is the listbox name // $2 is ptr to pointer array // $3 is subform name // Purpose: populate $2 with colVar pointers C_TEXT($1) C_POINTER($2) C_TEXT($3) C_POINTER($ptr) If (Count parameters=3) $ptr:=OBJECT Get pointer(Object named;$1;$3) Else $ptr:=OBJECT Get pointer(Object named;$1) End if ARRAY TEXT($arrColNames;0) ARRAY TEXT($arrHeaderNames;0) ARRAY POINTER($arrColVars;0) ARRAY POINTER($arrHeaderVars;0) ARRAY BOOLEAN($arrColsVisible;0) ARRAY POINTER($arrStyles;0) LISTBOX GET ARRAYS($ptr->;$arrColNames;$arrHeaderNames;$arrColVars;$arrHeaderVars;$arrColsVisible;$arrStyles) // -------------------------------------------------------- COPY ARRAY($arrColVars;$2->) Here is an idea I got from seeing ALP code, is really useful and isn't supported natively: the selected row index. This dates from v13 and works with array and selection based listboxes. Turns out to be a really useful tool. // Method: Listbox_get_selectionIndex (text; pointer) -> longint // $1 is the name of the listbox // $2 is pointer to longint array // $0 is number selections // Purpose: populate longint array with row numbers of selected rows // for selection based listboxes array is record number & // $2{0} is table number C_TEXT($1) C_POINTER($2;$LBptr) C_LONGINT($0) C_LONGINT($i;$tableNum) C_TEXT($set;$nameSel) C_POINTER($id_ptr;$table_ptr) ARRAY LONGINT($aI;0) $LBptr:=OBJECT Get pointer(Object named;$1) Case of : (Nil($LBptr)) : (Type($LBptr->)=Is longint)// selection or named selection LISTBOX GET TABLE SOURCE(*;$1;$tableNum;$nameSel;$set) $table_ptr:=Table($tableNum) $id_ptr:=Table_get_idFieldPtr ($table_ptr)// method returns pointer to key field of a table Case of : (Records in set($set)=0) : ($nameSel#"") USE SET($set) If (Nil($id_ptr))// get record numbers SELECTION TO ARRAY($table_ptr->;$aI) Else SELECTION TO ARRAY($id_ptr->;$aI) End if Else // avoid clobbering the current selection FIRST RECORD($table_ptr->) While (Not(End selection($table_ptr->))) Case of : (Not(Is in set($set))) : (Nil($id_ptr))// get record numbers APPEND TO ARRAY($aI;Record number($table_ptr->)) Else APPEND TO ARRAY($aI;$id_ptr->) End case NEXT RECORD($table_ptr->) End while End case $aI{0}:=$tableNum : (Type($LBptr->)=Boolean array)// array based LB For ($i;1;Size of array($LBptr->)) If ($LBptr->{$i}) APPEND TO ARRAY($aI;$i) End if End for Else TRACE End case // -------------------------------------------------------- COPY ARRAY($aI;$2->) $0:=Size of array($aI) For collection based listboxes there are better ways of managing the listbox and the data. On Sun, Dec 30, 2018 at 3:58 PM Randy Engle via 4D_Tech < 4d_tech@lists.4d.com> wrote: > List has been pretty quiet the last few days. > Anyone alive out there? > > I've been using ALPro vs Listbox exclusively since before Listbox existed. > As such, I've got extremely limited experience/knowledge of it. > > So, I've decided to educate myself so at least I know how to put a LISTBOX > together. > > There is a command in ALPro that allows assigning a popup/pull-down array > to a column, so the user can click the popup and select from some given > values for entry into a cell. > > e.g. > associatedMenuPtr:=->at_My_Text_Array > AL_SetColumnPtrProperty > ($alpArea;$columnNumber;ALP_Column_PopupArray;$associatedMenuPtr) > > I've dug around a lot in LISTBox but have not found a similar > method/command > > Does it exist? > > Many thanks > > Randy Engle > > > ********************************************************************** > 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 **********************************************************************