Page 1 of 2

name options

Posted: Sun Apr 10, 2016 10:02 pm
by ittzy
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?

Re: name options

Posted: Sun Apr 10, 2016 11:38 pm
by dunbarx
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

Re: name options

Posted: Mon Apr 11, 2016 2:00 pm
by ittzy
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?

Re: name options

Posted: Mon Apr 11, 2016 3:19 pm
by dunbarx
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

Re: name options

Posted: Thu Apr 14, 2016 8:52 pm
by ittzy
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?

Re: name options

Posted: Thu Apr 14, 2016 9:11 pm
by ittzy
is it possible to make a script for a socket example ( when i press F10 I add a score)??

Re: name options

Posted: Thu Apr 14, 2016 9:15 pm
by dunbarx
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

Re: name options

Posted: Fri Apr 15, 2016 7:35 am
by ittzy
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

Re: name options

Posted: Fri Apr 15, 2016 3:45 pm
by dunbarx
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

Re: name options

Posted: Fri Apr 15, 2016 4:33 pm
by Klaus
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

Re: name options

Posted: Fri Apr 15, 2016 5:59 pm
by dunbarx
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.

Re: name options

Posted: Fri Apr 15, 2016 6:38 pm
by Klaus
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

Re: name options

Posted: Fri Apr 15, 2016 7:38 pm
by ittzy
Wow craig this script Helped me a lot! i can do everything with it! It made the app so work friendly now.

Re: name options

Posted: Fri Apr 15, 2016 7:54 pm
by dunbarx
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

Re: name options

Posted: Fri Apr 15, 2016 8:10 pm
by ittzy
im not going to use them like you writed, im going to use it to show Scorebug and remoove all grapgics.