On Sep 24, 2018, at 9:44 AM, Two Way Communications via 4D_Tech <4d_tech@lists.4d.com> wrote: > > $page:=New object("objects";New object("myListBox";$obj)) $form:=New > object(“pages";New collection(Null;$page)) > > $form:=New object("windowTitle";"Select a > Map:";"windowMinWidth";500;"windowMinHeight";300;"pages";New > collection(Null;$page)) > > Now, this dynamic form only shows a listbox, and I want to add a button to > the form. I assume this button object has to be added to the ‘Objects’ object > in $page.
Yes, each object on the page is represented by the unique name you give it, then the the page is part of a collection of pages for the form. Something like $oPage:=New object $oPage.myButton:=$oButton1 $oPage.myListbox:=$oListbox $oForm.pages:=New collection $oForm.pages[1]:=New object $oForm.pages[1].objects:=$oPage Your code will be more readable and maintainable if you write methods to generate each object type. > Secondly, the listbox displays an entity selection. How do I get the row > number that has been selected? You specify the currentItemSource property for the dynamic listbox. I use Form and specify a property based on the object name like this: $form:=Command name(1466)+"." //Form command $0:=New object $0.type:="listbox" $0.listboxType:="collection" $0.currentItemSource:=$form+$name+"__currentItem" $0.currentItemPositionSource:=$form+$name+"__currentItemPosition" $0.selectedItemsSource:=$form+$name+"__selectedItems" John DeSoi, Ph.D. ********************************************************************** 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 **********************************************************************