Hey Peter,

On Sat, Sep 17, 2016 at 9:30 AM, Peter Jakobsson <li...@netkelvin.com>
wrote:

> sounds interesting. Do you mean present the menu as a button and then
> display the pop-up menu dynamically when the user clicks on the button ?
>
​Exactly. Something like this:
​

​$menu:=create menu
For($i;1;size of array(aArray))

APPEND MENU ITEM($menu;$aArray{$i})

SET MENU PARAMETER($menu;-1;string($i))// put the array index in the param

or
SET MENU PARAMETER($menu;-1;$aArray{$i})// to put the array value in the
param

End for​

​$result:=Dynamic popup menu($menu) // returns the param set above
RELEASE MENU($menu)

if($result#"")// means the user chose something

//  deal with it

end if​

​I'm doing that from memory so the syntax may need tweaking but that's how
easy it is. ​



> Also, what is a “form object array” ?
>
​If you were displaying the array itself (though I don't know why you
wouldn't put it in a listbox) you ​could let that be a dynamic variable 4D
manages and you just copy your array to it.

>
> I like process variables on forms because they can proxy for a numeric ID
> and provide realtime state feedback via a paired array which makes the data
> entry process very reliable. But maybe there are better approaches that
> acheive the same result - just got many old habit like that ;)
>
You can just as easily do the sorts of things you mention without process
vars - you just have to build the form to accommodate.

​This may come down to one of those issues of taste and style of
programming. I want forms to be as self-contained and modular as possible.
This is really important working with subforms but it's also a good design
principle, I think. For one thing it makes it easier to actually test the
functionality of form actions. I'm not talking about things like drawing
variables or fields but testing what the form does to the data.

I think the 'old habit' comes from learning to work with 4D years ago when
you had to load all sorts of stuff into arrays and variables to get a
decently fast user experience. You can achieve those things now with a
different approach and tools that weren't available then.

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

Reply via email to