name options

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

ittzy
Posts: 27
Joined: Thu Feb 04, 2016 11:48 pm

name options

Post by ittzy » Sun Apr 10, 2016 10:02 pm

Hey im trying to build some sort of sports app, but i have one big issue... how to create an function to sort all the players and how to select each one for example goal, foul and so on.

does any one have any suggestion?

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

Re: name options

Post by dunbarx » Sun Apr 10, 2016 11:38 pm

Hi.

Look up the "sort" and "sort container" commands in the dictionary. Make a list, and then play with the "sortKey"

Play with that a lot.

As for picking one line out of many, We must know more about what you need and intend. And you may well need to clarify that for yourself as well. The good news is that we will get you going very quickly.

Cfraig Newman

ittzy
Posts: 27
Joined: Thu Feb 04, 2016 11:48 pm

Re: name options

Post by ittzy » Mon Apr 11, 2016 2:00 pm

thank you i will look at that.

so for example, if i make a soccer app it have to have 15 players in each team, So i need somewhere to add those players like a "bin" or "base", so if example 14 scores a goal i want to be able to choose him from a list. does this explains anything?

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

Re: name options

Post by dunbarx » Mon Apr 11, 2016 3:19 pm

Hi.

I think you should start with a scrolling list field. Pull one from the tools palette. Resize it so it has at leas 15 lines. Make a button. Put this into its script:

Code: Select all

on mouseUp
   repeat with y = 1 to 15
      put "Player" & y  into line y of fld 1
   end repeat
end mouseUp
Now in the scrolling field script itself:

Code: Select all

on mouseUp
   answer the clickText & return & the clickLine & return & the selectedLine
end mouseUp
Play around for a minute, and see what you might see. What might be the value of the "selectedLine", when it is alway the same as the clickLine?

Craig

ittzy
Posts: 27
Joined: Thu Feb 04, 2016 11:48 pm

Re: name options

Post by ittzy » Thu Apr 14, 2016 8:52 pm

Yes Craig! this is a good start. how can i make a function to add players name and so on`? right now the buttom makes 15 players but what if i write all those in a field and then load them into the scrolling field? what do you think?

ittzy
Posts: 27
Joined: Thu Feb 04, 2016 11:48 pm

Re: name options

Post by ittzy » Thu Apr 14, 2016 9:11 pm

is it possible to make a script for a socket example ( when i press F10 I add a score)??

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

Re: name options

Post by dunbarx » Thu Apr 14, 2016 9:15 pm

Hi.

It is possible to do anything you can think of. Simply and quickly, and enjoyably.

Where are you with learning LC? Have you written a handler? Created objects on a card? This has to come first, before either of us starts to answer any of the questions you have. Write back...

Craig

ittzy
Posts: 27
Joined: Thu Feb 04, 2016 11:48 pm

Re: name options

Post by ittzy » Fri Apr 15, 2016 7:35 am

im makeing a caspar cg client and I have the whole client ready im just trying to adjust and improve some functions. Im working as a proffesional tv-graphics, and now im trying to build my own client that have all my needs. so far i have everything but im trying to buid this player function and see if its possile to use function buttuns as functions. (we use stuff like that on tv, F2 to add screbugg, F10 to remove all GFX)

Image

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

Re: name options

Post by dunbarx » Fri Apr 15, 2016 3:45 pm

You have constructed a nice display. My latest question was more along the lines of "have much have you worked with the LC language"?

Try this. I hope the field with the player list is named "Tranare Borta" (in the card script)

Code: Select all

on functionKey tkey
   switch tKey
      case"6" 
         ask "Select Player"
         if it is among the lines of fld "tranare borta" then put it into tPlayer else exit to top
         ask "Enter score"
         if it is an integer then put it into newScore else exit to top
         put lineOffset(tPlayer, fld "tranare borta") into tLine
         put newScore into item 2 of line tLine of  fld "tranare borta"
         break
      case "10"
         answer "Delete all players?" with "Delete" or "Cancel"
         if it is "delete" then put "" into  fld "tranare borta"
         break
   end switch
end functionKey
Please let me know if you can read and understand this handler. It will help me know how to help you. Do you see the checks to determine valid data?

Craig

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

Re: name options

Post by Klaus » Fri Apr 15, 2016 4:33 pm

Hi all,

I did some tests recently and found that the system is "eating" most FunctionKeys on the Mac!
I could only make F5, F6 and F13 make work/respond in LC!

(Factory) system settings on Mac:
F1 to F2 = monitor brightness
F3 = exposee
F4 = dashboard
F7 to F12 = iTunes controls and system loudness
F14 to F15 = no idea, but do not work in LC.


Best

Klaus

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

Re: name options

Post by dunbarx » Fri Apr 15, 2016 5:59 pm

Klaus.

These can be turned of on a Mac in the System preferences, "Use all F1,F2..." checkBox.

Though the explanation right below the checkBox seems to be backwards,

Craig

EDIT.

Your are right about F14 and F15. But 1-13 work OK.

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

Re: name options

Post by Klaus » Fri Apr 15, 2016 6:38 pm

Hi Craig,
dunbarx wrote:These can be turned of on a Mac in the System preferences, "Use all F1,F2..." checkBox.
yes, sure, that's why I wrote "(Factory) system settings...".
We cannot assume that every potential user of our software has done this! 8)


Best

Klaus

ittzy
Posts: 27
Joined: Thu Feb 04, 2016 11:48 pm

Re: name options

Post by ittzy » Fri Apr 15, 2016 7:38 pm

Wow craig this script Helped me a lot! i can do everything with it! It made the app so work friendly now.

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

Re: name options

Post by dunbarx » Fri Apr 15, 2016 7:54 pm

Good.

But are you sure you want to use function keys to invoke those actions? I rarely do, reserving them for things that are more universal.

Buttons are nice, or menus.

Craig

ittzy
Posts: 27
Joined: Thu Feb 04, 2016 11:48 pm

Re: name options

Post by ittzy » Fri Apr 15, 2016 8:10 pm

im not going to use them like you writed, im going to use it to show Scorebug and remoove all grapgics.

Post Reply