Programmer needs a reference ...

Want to move your code and projects to LiveCode but don't know where to start?

Moderators: Klaus, FourthWorld, heatherlaine, robinmiller

psavolai
Posts: 3
Joined: Tue Jun 14, 2011 7:09 pm

Programmer needs a reference ...

Post by psavolai » Tue Jun 14, 2011 7:21 pm

Hi ,
I've been professionally programming with various languages for over 20 years and am trying to learn livecode now.

The biggest problem is not the "english like" syntax but the lack of proper documentation.
Everyone says that the dictionary has everything ... no it does not have everything, not even close.

for example I am trying to understand how to add strings to an existing listbox.
Pseudocode:
onButtonPress
ListBox1.Items.Append(TextBox1.text)

I am having hard time finding a reference of the properties and methods available for the list field,where is it ?
Please tell me the location of a complete reference that lists every available component, every method and property.
I'd love to read it.

regards,
petri.

Janschenkel
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 977
Joined: Sat Apr 08, 2006 7:47 am
Location: Aalst, Belgium
Contact:

Re: Programmer needs a reference ...

Post by Janschenkel » Tue Jun 14, 2011 8:31 pm

Hi Petri,

You are right that LiveCode is different from other programming languages and development environments. It's not object-oriented, even though it applies a whole series of design patterns. You start off with button, field, graphic, image and scrollbar controls, optionally in groups, on cards in stacks. There are no other objects - a list field is just another field.
The beauty of LiveCode is that once you get past the hurdle that it's not like anything you've used before, you can quickly build useful applications. But it takes time and an open mind to let go of 'mainstream' development practices and immerse yourself in this new paradigm.

You should definitely head over to the Lessons and tuturials section on the RunRev website.
And work your way through the User Guide - also accessible from the Help menu within LiveCode.

To answer your specific question, you'd have a button with the following script:

Code: Select all

on mouseUp
   if field "List field" is not empty then
      put return after field "List field"
   end if
   put field "New item" after field "List field"
end mouseUp
HTH,

Jan Schenkel.
Quartam Reports & PDF Library for LiveCode
www.quartam.com

mwieder
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2786
Joined: Mon Jan 22, 2007 7:36 am
Location: Berkeley, CA, US
Contact:

Re: Programmer needs a reference ...

Post by mwieder » Wed Jun 15, 2011 12:28 am

In addition to Jan's advice, I'd also like to point out that in the dictionary you can open the Object menu on the left, then select Field and you'll have a handy listing of the properties and commands you can use with field objects.

...and be patient - coming from another high-level language programming environment it'll take about a six-week (un)learning curve to get the hang of the message path. This might help:

http://www.fourthworld.com/embassy/arti ... _path.html

BvG
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 1236
Joined: Sat Apr 08, 2006 1:10 pm
Location: Zurich
Contact:

Re: Programmer needs a reference ...

Post by BvG » Wed Jun 15, 2011 3:05 am

I agree that in theory stuff is documented. So besides the dictionary, there is the user guide pdf, and a lot of examples, etc. However that's just too much information. There used to be very constrained articles about variables, or custom properties, or urls, giving a great entry point for finding information about the task one wants to do currently. in this case, it'd have been the variable & container one. Sadly, these genius entries do not exist anymore since version 2.5 or so :(
Various teststacks and stuff:
http://bjoernke.com

Chat with other RunRev developers:
chat.freenode.net:6666 #livecode

psavolai
Posts: 3
Joined: Tue Jun 14, 2011 7:09 pm

Re: Programmer needs a reference ...

Post by psavolai » Wed Jun 15, 2011 6:15 am

Janschenkel wrote: To answer your specific question, you'd have a button with the following script:

Code: Select all

on mouseUp
   if field "List field" is not empty then
      put return after field "List field"
   end if
   put field "New item" after field "List field"
end mouseUp
Jan Schenkel.
Thanks Jan.
So you are saying that a list is not a collection of individual list elements, but instead a long string that is broken into lines by newline characters ?
And appending works by "putting after" ?

Works for me.
I only wish that it was documented somewhere ...
After all strings are just strings and concatenation is concatenation regardless how "revolutionary" the syntax is.

So , if lists are just strings with delimeters , how does the slicing and dicing work then ?
string operations manual ... anyone ... ?
... and the relationship of strings and arrays ?
conversions back and forth ?

The lack of formal documentation makes us newbies/converts/evaluators very dependent on the community.
So thanks to to all who responded.

cheers,

petri.

Klaus
Posts: 11062
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: Programmer needs a reference ...

Post by Klaus » Wed Jun 15, 2011 10:24 am

Hi Petri,

please check these stacks here, they will sure get you started:
http://www.runrev.com/developers/lesson ... nferences/


Best

Klaus

BvG
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 1236
Joined: Sat Apr 08, 2006 1:10 pm
Location: Zurich
Contact:

Re: Programmer needs a reference ...

Post by BvG » Wed Jun 15, 2011 11:46 am

have you looked at the pdf (accessible as "user guide" from the help menu).

it certainly is very formal, if a bit huge and monolithic?
Various teststacks and stuff:
http://bjoernke.com

Chat with other RunRev developers:
chat.freenode.net:6666 #livecode

doc
Posts: 148
Joined: Fri Jun 09, 2006 4:30 pm
Location: Oklahoma, USA

Re: Programmer needs a reference ...

Post by doc » Wed Jun 15, 2011 1:23 pm

Hello Petri,
For text and string handling, have a look at "Chapter 6 - Using Chunk Expressions" in the Users Guide in particular. Also, as Klaus mentioned above, the scripting conferences are very good. The conference in particular that deals with "chunking" is #8 done by Alex Tweedy.

I've tried almost everything under the Sun and have never found anything at all that even remotely comes close to beating LiveCode in the area of text and string handling. Very simple and very powerful once you grasp the concepts!

Best regards,
-Doc-

psavolai
Posts: 3
Joined: Tue Jun 14, 2011 7:09 pm

Re: Programmer needs a reference ...

Post by psavolai » Wed Jun 15, 2011 6:04 pm

Thanks a lot guys.
The material contained in those scripting conference stacks is good stuff.

Now I'll just have to read a little ...

cheers,

petri.

mwieder
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2786
Joined: Mon Jan 22, 2007 7:36 am
Location: Berkeley, CA, US
Contact:

Re: Programmer needs a reference ...

Post by mwieder » Wed Jun 15, 2011 8:00 pm

Yeah - I just wish they were a bit more prominent on the web site. You really have to dig to find them.

richervin
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 54
Joined: Sat Sep 17, 2011 5:04 pm

Re: Programmer needs a reference ...

Post by richervin » Tue Sep 27, 2011 11:22 pm

I agree that a syntactical guide would be a great tool. However, I'm afraid the richness of the language would make such a guide essentially unusable.

I've been relying very heavily on sample scripts and intuition so far, but a handy, easy to use guide (as opposed to an 800 page dictionary) would make this much easier.

I'm also finding the editor and environment difficult to use. Does it have features like autocompletion? Or an object browser? Is there a way of listing or accessing all the scripts in a stack without having to guess which cards, backgrounds, fields, etc might have an associated script?

Finally, I see that there is significant flexibility in the syntax. What if I want to know the shortest possible syntax, or would like something to be less "english" like and more "computer" like? A syntax guide would make it easier to understand which conjugations, adjectives, and verbs are optional, defaulted, or redundant.
LiveCode 5.1.1 on Mac OS Mountain Lion
Attempting to develop for Android and iPhone
Currently on my third trial, and still finding LiveCode to be difficult for mobile applications in general, and particularly poor for Android

AndyP
Posts: 431
Joined: Wed Aug 27, 2008 12:57 pm
Location: Seeheim, Germany (ex UK)
Contact:

Re: Programmer needs a reference ...

Post by AndyP » Fri Oct 28, 2011 9:27 am

Hi Petri,

I found this course content at BRIGHAM YOUNG UNIVERSITY every useful when starting out, also has a lot of links to other Livecode info.

http://livecode.byu.edu/
Andy Piddock

http://2108.co.uk/tinyide/ - Mini LC IDE alternative

http://2108.co.uk/script-editor-themer/ - Script Editor colour theming

http://livecodeshare.runrev.com/stack/897/LiveCode-Multi-Search - Search across 8 LC resources

Mark
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 5132
Joined: Thu Feb 23, 2006 9:24 pm
Contact:

Re: Programmer needs a reference ...

Post by Mark » Fri Oct 28, 2011 9:46 am

The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode

richervin
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 54
Joined: Sat Sep 17, 2011 5:04 pm

Re: Programmer needs a reference ...

Post by richervin » Thu Aug 30, 2012 6:11 pm

This is an old thread, but it may be useful to add that in the current release, there is more in-IDE documentation of the functions and objects. I still find the language weak and somewhat ambiguous, but it is still far better than before when you had only a fat PDF reference guide and sample code to work from.

Example of ambiguity:
"hide all groups" (in a button script)

It passes the syntax check and compiles
It executes as a command in the debugger
It has no apparent effect at run-time
The documentation does not help you understand how the compiler is interpreting this line
It does NOT hide all the groups, so what does it do? It's entirely unclear what it does, and entirely unclear what the programmer should use instead if his purpose is to hide all the groups belonging to the object.

My best guess here is that it hides the objects named "all" and "groups", but there are no such objects, and there is no error. "all groups" is in purple, suggesting that they are are optional modifiers and are not interpreted, but this does not make sense because the command "Hide" does not pass the compiler.

This is just one example of how the "Natural Language" feature is still weak. I'm not necessarily looking for a solution to this,just pointing up that the newest version gives more help than previous versions, but can still leave you standing there scratching your head.
LiveCode 5.1.1 on Mac OS Mountain Lion
Attempting to develop for Android and iPhone
Currently on my third trial, and still finding LiveCode to be difficult for mobile applications in general, and particularly poor for Android

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 6082
Joined: Wed May 06, 2009 2:28 pm
Location: New York, NY

Re: Programmer needs a reference ...

Post by dunbarx » Mon Sep 03, 2012 5:42 pm

Hi.

It is true that one aspect of the language, that its syntax is very forgiving, can also cause that head scratching you mentioned. This is a holdover from Hypercard, which was even more forgiving.

But a quick look at the "hide" entry in the dictionary shows that your code:

hide all groups

is not proper, even though it does not throw an error.

That said, "all" is not even a word in the language, and if you substitute "iceCream" for "all", you do get a runtime (not compiletime) error. I am going to think about this.

Craig Newman

Post Reply

Return to “Converting to LiveCode”