Array

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

Moderators: FourthWorld, heatherlaine, Klaus, robinmiller

BlaBlaBliBli
Posts: 37
Joined: Sat Oct 06, 2012 12:22 pm

Array

Post by BlaBlaBliBli » Sat Nov 03, 2012 3:02 pm

Hello everyone!

I wan't to make something that people talled me called an Array.
This thing is really similar to a remainder.
I made a card that i want everything i add to my remainder will be there in a scrolling field. And in the rows will be like: Row 1 - To buy a Spoon Row 2 - 13/11/12 Row 3 - 10 Days left.
Now i want that the remainder will be able to put from everyone place like if im in a card of Spoons then i will click (In the same card) on the remainder and put the date and the name and the 10 days left it will do from itself. How can i do this ?

Thank you very much!

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

Re: Array

Post by Mark » Sun Nov 04, 2012 8:51 pm

Hi,

I think you are trying to describe an app and ask how to start? I think you mean to make something you call a "reminder". I'd start with something very simple, just to see how things work.

You could create one field "Description" for the item description and another field "Date" for the due date. You need a button, which puts the info into a scrolling field. This scrolling field "List" needs to have the tabstops set to e.g. 100 (see the properties inspector of that field).

The button needs this script:

Code: Select all

on mouseUp
  put fld "Description" & tab & fld "Date" & cr before fld "List"
end mouseUp
Now you need another button, which updates the day count:

Code: Select all

on mouseUp
  set the itemDel to tab
  repeat with x =1 to number of lines of fld "List"
    put item 2 of line x of fld "List" into myDate
    convert myDate to seconds
    put round((the seconds - myDate)/86400) into myDays
    put myDays && "days left" into item 3 of line x of fld "List"
  end repeat
end mouseUp
This example may not always give exactly the right number of days, but it is a good test to start with. Later on, you could change the calculation to round the number of days downwards and display the remaing number of hours and minutes.

The date in the Date field needs to be entered in a particular format. To see the format, just type "put the short date" into the message box. You can change this later.

Kind regards,

Mark
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

BlaBlaBliBli
Posts: 37
Joined: Sat Oct 06, 2012 12:22 pm

Re: Array

Post by BlaBlaBliBli » Tue Nov 06, 2012 10:15 pm

Im really really sorry for the late response, I saw you'r letter on the same day but I didn't have time to check you'r code and answer to it.

I tried you'r code now and I dont really understand what this thing doing...

I don't undestand what I have to put in the textFileds and how do I add it with a name of someone, I dont understand why when I wrote "lala" into one of the buttons and some date in the other field it did problems..

How called the Exactly buttons I have to add ? And what are they'r names again ?

Yes, you pretty right, I want to make something like a "Remainder" But not exactly the same. I need to know something that will 100% work. if you know one .. ;S

Even I told you this I will tell you it again, I want something That will show me the date and name of something in one card. If the name of the card will be "Everything" and a big scrolling field will be on the card anything Im adding with a time will be added to there.

E.g. I go into card "Spoons" I have a button at the bottom of the card that says "Wish to add something?" after I click on him, there will be an option to add the name of it, like "My Spoons" and I will add the date it should be happen. After that, im going back to the card "Everything" And I see that a line added which on her there is on the left side "My Spoons" on the middle the date it should happen and on the right side the days left for that thing to happen.

Do you have something specific for that :D? Thanks alot!

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

Re: Array

Post by Mark » Tue Nov 06, 2012 11:05 pm

Hi,

No, I don't have something specific for that. I believe you need to make this software yourself. The example is a good start for this. I'll be happy to help you further once you understand how the example works.

In the example I gave you, you don't need to give the buttons a name. They only need scripts.

Did you follow my instructions literally? If you did, then it should work. What do you type in the date field and what does the message box return if you type "put the short date" and press return?

Kind regards,

Mark
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

BlaBlaBliBli
Posts: 37
Joined: Sat Oct 06, 2012 12:22 pm

Re: Array

Post by BlaBlaBliBli » Fri Nov 09, 2012 1:04 pm

The message box saying "Message execution error:
Error description: Handler: can't find handler
Hint: "put"

When i write "put the short date" in the textfield Date and press on one of the buttons it says to me in the fields twice "put the short date" "put the short date"
and when i just click on the button with this script
"on mouseUp
set the itemDel to tab
repeat with x =1 to number of lines of fld "List"
put item 2 of line x of fld "List" into myDate
convert myDate to seconds
put round((the seconds - myDate)/86400) into myDays
put myDays && "days left" into item 3 of line x of fld "List"
end repeat
end mouseUp" it says 15606 days
in the scrolling field for many times idk like alot of times... I really dont undestand what to do ... I followed you'r insturctions can you please give me a file of that you made ?


Thanks alot!

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

Re: Array

Post by Mark » Fri Nov 09, 2012 1:09 pm

Hi,

If I post a complete file, you won't learn from it. Besides, it seems that you have created the stack correctly, but don't understand how to use it.

Do you know what the message box is? It is the little window that appears if you press command-M or control-M. Please, check your documentation and read about the message box. Come back when you can actually execute the syntax

Code: Select all

put the short date
in the message box and get a date returned.

Kind regards,

Mark
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

BlaBlaBliBli
Posts: 37
Joined: Sat Oct 06, 2012 12:22 pm

Re: Array

Post by BlaBlaBliBli » Fri Nov 09, 2012 1:35 pm

Ok,
i did in the message box the date and it tells me the right date.
Now what I have to do?

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

Re: Array

Post by Mark » Fri Nov 09, 2012 1:39 pm

Hi,

Now you see the format of the date as it is accepted by the date field in the stack. Enter a description in one field and enter this date, in this format, in the other (=date) field of the stack. Press the two buttons in correct order and see what happens.

Kind regards,

Mark
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

BlaBlaBliBli
Posts: 37
Joined: Sat Oct 06, 2012 12:22 pm

Re: Array

Post by BlaBlaBliBli » Sat Nov 10, 2012 4:20 pm

its showing me there is a prob with one line :

put round((the seconds - myDate)/86400) into myDays
button "Button": execution error at line 6 (Operators -: error in right operand), char 22

BlaBlaBliBli
Posts: 37
Joined: Sat Oct 06, 2012 12:22 pm

Re: Array

Post by BlaBlaBliBli » Sat Nov 10, 2012 4:48 pm

I tried now the code again and if you write the same day of the date from the Message box in the field and press on the button it does 0 days any other date you give making him write "15655"

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

Re: Array

Post by Mark » Sat Nov 10, 2012 9:28 pm

Hi,

Are you sure that you enter the date in the Date field in exactly the same format as it is displayed in the message box? Aren't you mixing up days and months for example? Are you sure that your code is exactly the same as the code in my examples and did you follow all steps correctly? Aren't there any other scripts and controls in your stack?

Kind regards,

Mark
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

BlaBlaBliBli
Posts: 37
Joined: Sat Oct 06, 2012 12:22 pm

Re: Array

Post by BlaBlaBliBli » Sun Nov 11, 2012 2:10 pm

Yes man, Im sure im not mixing anything.

I dont know what it's writing to me this prob. I followed correctly all of you'r steps one by one.

I really need a reminder as soon as possible , can you please send me one or give me another thing that works better ? I need that it will be correct 100%

Thanks alot.+

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

Re: Array

Post by Mark » Sun Nov 11, 2012 3:13 pm

Hi,

I propose that you upload a file with your own work and I'll have a look to see what you did wrong. It would be interesting to see your attempt. I think you can attach a file to a message on the forum (you need to make a zip file of your stack) or you can use Dropbox. If you don't have Dropbox, you can register here.

I do projects for other people, but I do this for a living. I don't upload complete stacks on this forum, also because people don't learn if someone else does it for them (I did give you complete instructions, though).

Kind regards,

Mark
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

BlaBlaBliBli
Posts: 37
Joined: Sat Oct 06, 2012 12:22 pm

Re: Array

Post by BlaBlaBliBli » Mon Nov 12, 2012 1:28 pm

I can learn by looking at the scripts you've done :?

I need this thing asap and I really do as my best, I can learn the things but looking at you'r field and in what you've done in him

Thanks!

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

Re: Array

Post by Mark » Mon Nov 12, 2012 2:20 pm

Hi,

Why don't you upload your stack and let me have a look at it?

Kind regards,

Mark
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

Post Reply

Return to “Converting to LiveCode”