From: Ashley Wright on 8 Jul 2010 23:30 I've got a few questions regarding GUI development. I'm making a GUI that will allow the user to input a bunch of different items. To give you a simplified example, I'm trying to allow a user to input characteristics on different animals in a pet store. Each animal will have a separate GUI to input name, color, type of animal (cat or dog) and things like that. Right now I'm trying to do this with guide. Name: Fluffy (String) Type: Dog (From Popup Menu that has Cat, Dog, and Fish as string options) Weight: 20 (String) Breed: Lab (From listbox??) My questions are as follows: 1. How can I make the Breed listbox dependent on the type of animal? For example, I want the user to select dog from the popup menu, then have the breed listbox populated by common dog breed names instead of allowing the user to input a text string. 2. How can I make it so the user can input the next animal? I'd like the user to click a box that says something like NEXT animal and then be able to have another screen that allows him/her to put in the same type of data for the next animal. Thanks for the help!
From: Matt Fig on 8 Jul 2010 23:44 1. In the callback for the type listbox, use a SWITCH on the selection to repopulate the breed listbox if necessary. 2. This depends somewhat on what you are going to do with the user's selections. If it was me I might have a pushbutton which indicates that the user is done with that particular animal and would like to enter another animal. This would cause all data to be stored in the appropriate elements of a structure. Then all uicontrols would be reset to initial values. I would probably also have another button which let the user indicate that he was done with all animal inputs. This is the point at which one would need to know what you are going to do with the data.
From: Walter Roberson on 8 Jul 2010 23:52 Ashley Wright wrote: > My questions are as follows: > 1. How can I make the Breed listbox dependent on the type of animal? > For example, I want the user to select dog from the popup menu, then > have the breed listbox populated by common dog breed names instead of > allowing the user to input a text string. Set the String parameter of the Breed listbox to a cell array of strings that lists the possible breeds for the species. > 2. How can I make it so the user can input the next animal? I'd like > the user to click a box that says something like NEXT animal and then be > able to have another screen that allows him/her to put in the same type > of data for the next animal. Why would you need to go on to another screen when the current screen already has the proper controls? Why not just store the data and reset the controls to their default state?
From: Ashley Wright on 9 Jul 2010 00:02 Walter Roberson <roberson(a)hushmail.com> wrote in message <m2xZn.11992$3%3.4063(a)newsfe23.iad>... > Ashley Wright wrote: > > > My questions are as follows: > > 1. How can I make the Breed listbox dependent on the type of animal? > > For example, I want the user to select dog from the popup menu, then > > have the breed listbox populated by common dog breed names instead of > > allowing the user to input a text string. > > Set the String parameter of the Breed listbox to a cell array of strings > that lists the possible breeds for the species. > > > 2. How can I make it so the user can input the next animal? I'd like > > the user to click a box that says something like NEXT animal and then be > > able to have another screen that allows him/her to put in the same type > > of data for the next animal. > > Why would you need to go on to another screen when the current screen > already has the proper controls? Why not just store the data and reset > the controls to their default state? What would be the best way to do that without overwriting the data?
From: Walter Roberson on 9 Jul 2010 01:03
Ashley Wright wrote: > Walter Roberson <roberson(a)hushmail.com> wrote in message > <m2xZn.11992$3%3.4063(a)newsfe23.iad>... >> Ashley Wright wrote: >> > 2. How can I make it so the user can input the next animal? I'd >> like > the user to click a box that says something like NEXT animal >> and then be > able to have another screen that allows him/her to put >> in the same type > of data for the next animal. >> >> Why would you need to go on to another screen when the current screen >> already has the proper controls? Why not just store the data and reset >> the controls to their default state? > > What would be the best way to do that without overwriting the data? You did not indicate what you want to do with all the data you collected, so we can't tell you the "best" way. A way that sounds reasonable for your circumstances would be to use a structure array, and when the user indicates they have finished entering the data for an animal, store the information into the next available structure array member. AllSpecies = get(handles.species,'String'); thisspecies = AllSpecies{get(handles.species,'Value')}; AllBreeds = get(handles.breeds,'String'); thisbreed = AllBreeds{get(handles.breeds,'Value')}; Animals(end+1).species = thisspecies; Animals(end).breed = thisbreed; That sort of thing. |