Selections that auto populate other selections

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Post Reply
altamative
Posts: 1
Joined: Wed Nov 20, 2013 2:49 pm

Selections that auto populate other selections

Post by altamative » Wed Nov 20, 2013 2:58 pm

I am working on a data entry program -- and I am having issues with a couple things.

First off I need some help with Option menus.

I need option menus that can be dynamically changed based off the selection of another. For example:

Option Menu A has : House, Car, Kids, Cheese

If someone chooses "House" I need for Option Menu B to then say:

Option Menu B: Apartment, Condo, Beach, Duplex

Basically Option B dynamically changes based off what Option A does.



Second - I am trying to aggregate multiple data "text" fields into a datagrid on a separate card.

For Example On my main card I have:

Name _______ Age _______ Email______ Phone_________

When I click a submit button, I want any text in those fields to be saved to a data grid

Name _Steve__ Age _41_ Email ____ Phone __555-1212__


Click Submit

New data grid with already set columns that now contains that info. Any help would be great --- I am going nuts here trying to get this to work.

Thanks in advance!!!

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10331
Joined: Wed May 06, 2009 2:28 pm

Re: Selections that auto populate other selections

Post by dunbarx » Wed Nov 20, 2013 3:52 pm

Hi.

Quickly, I would say you might create a few custom properties of the "main" option menu, so that one of them, named, say, "house", has the contents:

apartment
condo
beach
duplex

Then when you run your menuPick handler you simply:

put the house of me into comboBox "B" --this likely derived from the pItem in a switch construction or whatever.

As for the datagrid, this is organized as a tab and return delimited gadget, though it contains enormous additional functionality. But you can simply:

set the dgText of group "yourDG" to tabAndeturnDelimitedText

Try it by hand. But you need to check out the dataGrid manual.

Craig Newman

Klaus
Posts: 14199
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: Selections that auto populate other selections

Post by Klaus » Wed Nov 20, 2013 9:39 pm

Hi altamative,

please check the attached stack for your option menu problem :D

For the datagrid:
You said you have all neccessary columns already created, means like in your example
Name _Steve__ Age _41_ Email ____ Phone __555-1212__
name
age
email
phone

Right?

OK, then you need to create an array:
...
put "Steve" into tArray["name"]
put "41" into tArray["age"]
put "" into tArray["email"]
put "555-1212" into tArray["phone"]
## and "disaptch" the message "addData" to your datagrid with the array
disaptch "addData" to grp "your datagrid here..." with tArray
...
That will append the new data at the bottom of the datagrid.


Best

Klaus
Attachments
dynamic_option_menus.livecode.zip
(2.1 KiB) Downloaded 142 times

Post Reply