Page 1 of 2

Programmer needs a reference ...

Posted: Tue Jun 14, 2011 7:21 pm
by psavolai
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.

Re: Programmer needs a reference ...

Posted: Tue Jun 14, 2011 8:31 pm
by Janschenkel
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.

Re: Programmer needs a reference ...

Posted: Wed Jun 15, 2011 12:28 am
by mwieder
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

Re: Programmer needs a reference ...

Posted: Wed Jun 15, 2011 3:05 am
by BvG
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 :(

Re: Programmer needs a reference ...

Posted: Wed Jun 15, 2011 6:15 am
by psavolai
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.

Re: Programmer needs a reference ...

Posted: Wed Jun 15, 2011 10:24 am
by Klaus
Hi Petri,

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


Best

Klaus

Re: Programmer needs a reference ...

Posted: Wed Jun 15, 2011 11:46 am
by BvG
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?

Re: Programmer needs a reference ...

Posted: Wed Jun 15, 2011 1:23 pm
by doc
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-

Re: Programmer needs a reference ...

Posted: Wed Jun 15, 2011 6:04 pm
by psavolai
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.

Re: Programmer needs a reference ...

Posted: Wed Jun 15, 2011 8:00 pm
by mwieder
Yeah - I just wish they were a bit more prominent on the web site. You really have to dig to find them.

Re: Programmer needs a reference ...

Posted: Tue Sep 27, 2011 11:22 pm
by richervin
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.

Re: Programmer needs a reference ...

Posted: Fri Oct 28, 2011 9:27 am
by AndyP
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/

Re: Programmer needs a reference ...

Posted: Fri Oct 28, 2011 9:46 am
by Mark

Re: Programmer needs a reference ...

Posted: Thu Aug 30, 2012 6:11 pm
by richervin
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.

Re: Programmer needs a reference ...

Posted: Mon Sep 03, 2012 5:42 pm
by dunbarx
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