getting option menu responses into a field

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
sabiam3
Posts: 9
Joined: Fri Jun 20, 2014 6:46 pm

getting option menu responses into a field

Post by sabiam3 » Mon Jun 30, 2014 9:45 pm

Hi guys,

I was wondering how I might go about getting the responses users make from option menus into a field. In order to create a unique ID for the limited (30 or so) people who will end up using the program, I ask them to identify certain letters of their name and the day of their birth to generate a random sequence of letters and numbers for an ID, and then I've created a button that will compile those responses and transfer them to the text field where I want them. However, when I go to try this out, it seems that I can only get numerical options to transfer to the field, while letter options remain unrecognized; for example, if the sequence is MAPA6, only "6" is transferred to the field. Any suggestions on how to fix this?

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

Re: getting option menu responses into a field

Post by Klaus » Mon Jun 30, 2014 9:56 pm

Hi,

to be honest, I have no idea what you are trying to do,
so it might help if you could show:
1. the content and names of your option button(s)
2. the script you are currently using
:D


Best

Klaus

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

Re: getting option menu responses into a field

Post by dunbarx » Tue Jul 01, 2014 3:15 am

Hmmm.

Do you know how to get information from an option menu? In other words, do you know about such concepts as the "menuHistory" or the "selectedText" as they relate to such a control?

For (at least part of) the other question, are you familiar with the concept of, say:

Code: Select all

answer char 5 of "MAPA6" -- a number
answer char 3 of "MAPA6" -- a letter
answer the last char of "MAPA6"
That sort of thing? This is known as "chunking" and is a pillar of LC.

In other words, we will help you with technique and knowledge, but will (try to) leave it to you to develop your application.

So write back with specific questions all day. But break them down into smaller pieces.

Craig Newman

sabiam3
Posts: 9
Joined: Fri Jun 20, 2014 6:46 pm

Re: getting option menu responses into a field

Post by sabiam3 » Tue Jul 01, 2014 5:25 pm

Ok, I'll try to be more clear.

There are five questions I'm asking participants on this card. Four of them can be answered by choosing a letter of the alphabet, the other by choosing a number from 1-31. Once they are done, they should click a button I have on the card that will put the 5-character combination that they have chosen into a text field somewhere else on the card. The code I currently have written for the button will only allow me to transfer the answer to the final question (the number) into the text field. Is there some script I need to write to get the text field to recognize letters? Or am I doing something else wrong? I have been using option menus to display the possible choices for each question, perhaps that is not necessary or not the best way of doing that?

sefrojones
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 447
Joined: Mon Jan 23, 2012 12:46 pm

Re: getting option menu responses into a field

Post by sefrojones » Tue Jul 01, 2014 5:55 pm

This is my first experiment with option menus, But I was able to accomplish (i think) what you are looking for pretty easily. In my sample stak I made four option menus with A-Z as their options, and 1 with the numbers 1-31. I named them Menu1,menu2,menu3,menu4, and menu5. I created a Field named "result", and a buttton with this script:

Code: Select all

on mouseUp
   put empty into fld "result"
   repeat with x = 1 to 5
      put the label of btn ("menu"&x) after fld "result"
   end repeat
end mouseUp
And it seems to be working. Let me know if this helps at all..

--Sefro
optiontest.livecode.zip
(957 Bytes) Downloaded 194 times

Post Reply