Learn it with livecode (calculator tutorial problem)

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

Post Reply
omekkainteractive
Posts: 8
Joined: Sat Mar 28, 2015 7:16 pm

Learn it with livecode (calculator tutorial problem)

Post by omekkainteractive » Tue Jul 21, 2015 11:56 am

Hi there ...

I'm new to livecode and an indy subscriber ....

In the lesson of day 2 regarding groups in the calculator lesson , i am getting a problem .... When i group together the number keys and put the code in them .... no number is displayed on the label field on the top named "display". although no error is shown in the errors section in code.

on deep investigation of what the problem is , i found out that the numbers i am pressing indeed appear in the contents section of the label in the inspector of the label but isn't shown on the front as is shown in the video to the tutorial ...

pretty confused as to how its possible ...

hope anyone of you can help as to what i am doing wrong here..

Regards:

Shahzad

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

Re: Learn it with livecode (calculator tutorial problem)

Post by Klaus » Tue Jul 21, 2015 1:19 pm

Hi Shahzad,

1. welcome to the forum! :D

2. I don't know what exactly "Learn it with LC" is, so I need to guess a bit
on deep investigation of what the problem is , i found out that the numbers i am pressing
indeed appear in the contents section of the label in the inspector of the label but isn't shown on
the front as is shown in the video to the tutorial ...
pretty confused as to how its possible ...
That can have a couple of causes:
a. the text has the same color as its background, so it appears invisible.
b. There is an object right in front of that field so you cannot see its content.
c. that text field is just too small for its text size, so it appears clipped or not at all.

Please make sure this is not the case!


Best

Klaus

omekkainteractive
Posts: 8
Joined: Sat Mar 28, 2015 7:16 pm

Re: Learn it with livecode (calculator tutorial problem)

Post by omekkainteractive » Tue Jul 21, 2015 1:33 pm

First case in my opinion isn't applicable
Screen-Shot-2015-07-21-at-5.27.57-pm.gif

omekkainteractive
Posts: 8
Joined: Sat Mar 28, 2015 7:16 pm

Re: Learn it with livecode (calculator tutorial problem)

Post by omekkainteractive » Tue Jul 21, 2015 1:34 pm

The second case is as the instructor has done himself ... the numbers come after 0 in sequence on every key pressed

omekkainteractive
Posts: 8
Joined: Sat Mar 28, 2015 7:16 pm

Re: Learn it with livecode (calculator tutorial problem)

Post by omekkainteractive » Tue Jul 21, 2015 1:38 pm

in third case scenario , text field isn't small , nor the numbers are truncated

see i've pressed the keys but they do not appear in the label field where as they do appear in the contents field of the label as soon as i press them under 0 .... don't know why ... should i post my livecode file for your review ?
Screen-Shot-2015-07-21-at-5.36.12-pm.gif

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

Re: Learn it with livecode (calculator tutorial problem)

Post by Klaus » Tue Jul 21, 2015 1:48 pm

Hi omekkainteractive,
omekkainteractive wrote:in third case scenario , text field isn't small , nor the numbers are truncated
see i've pressed the keys but they do not appear in the label field where as they do appear in the contents field of the label as soon as i press them under 0 .... don't know why ... should i post my livecode file for your review ?
Screen-Shot-2015-07-21-at-5.36.12-pm.gif
OK, that image does indeed shed some light on this mistery :D

Looks like there is a CR (carriage return = new line) right after the 0!
That will of course make all text/number that you "put after fld "display" appear
in the SECOND line but only the FIRST line is visible of that field!
Know what I mean?


Best

Klaus

omekkainteractive
Posts: 8
Joined: Sat Mar 28, 2015 7:16 pm

Re: Learn it with livecode (calculator tutorial problem)

Post by omekkainteractive » Tue Jul 21, 2015 1:49 pm

Alright now ...

i've gone through the problem one more time and found what the problem was ... though its a bit strange ...

When i place my cursor at the start of 0 that I've put in the contents of label field it gives the results as indicated in the tutorial....
Screen-Shot-2015-07-21-at-5.45.01-pm.gif
and when i press return while inputting the 0 (at the end of 0) the numbers come down in the field .... which refers to your point of numbers getting truncated cause the field isn't wide enough ...

Regards:

Shahzad

(and thank you very very much) obliged and happy .... :D

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

Re: Learn it with livecode (calculator tutorial problem)

Post by Klaus » Tue Jul 21, 2015 1:58 pm

Hi Shahzad,

Okie Dokie, glad I could help! :D


Best

Klaus

omekkainteractive
Posts: 8
Joined: Sat Mar 28, 2015 7:16 pm

Re: Learn it with livecode (calculator tutorial problem)

Post by omekkainteractive » Tue Jul 21, 2015 2:49 pm

Hi Klaus ...

Can you please help me out with one little thing here as well...

I,ve completed the AC button tutorial but when it is pressed the resulting label doesn't turn to 0, whereas again i don't have the errors ...

Can you please guide in it as well , that is if you've got time ....
Screen Shot 2015-07-21 at 6.33.03 pm.png
Regards:

Shahzad

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

Re: Learn it with livecode (calculator tutorial problem)

Post by Klaus » Tue Jul 21, 2015 2:55 pm

Hi Shahzad,

you are not putting 0 into fld "display" at any time!?

Add this line BEFORE the ELSE line in the "on clearpressed" handler:

Code: Select all

on clearpressed
     ...
    put empty into lCurrentoperator
    put 0 into fld "display"
  ELSE
    ...
  ## END IF needs to be in a separate line here!
  END IF
end clearpressed
Best

Klaus

omekkainteractive
Posts: 8
Joined: Sat Mar 28, 2015 7:16 pm

Re: Learn it with livecode (calculator tutorial problem)

Post by omekkainteractive » Tue Jul 21, 2015 3:25 pm

Thanks again but here i would like to mention that the tutorials have quite a lot of differences between the pdf or ppt provided and the videos ... When you're a complete beginner and you're told to just copy and paste and the result comes out right in the video whereas it doesn't in live expermentation, its quite frustrating ...

I know its my fault as well to check the logic first (which i will do the next time round) , still guidance should in itself be complete rather then taking you by hand and removing that hand in the middle ...

Attached is the screenshot of the pdf provided from which the instructor supposedly and in video have copy and pasted code and it worked pretty well (for him)
Screen Shot 2015-07-21 at 7.20.02 pm.png
Thanks yet again ....

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

Re: Learn it with livecode (calculator tutorial problem)

Post by Klaus » Tue Jul 21, 2015 3:33 pm

The screenshot shows the missing line
...
put 0 into fld "display"
...
And yes, I heard that the tutorials are sometimes a bit "quick and dirty", which is no excuse of course!

Anyway, that's why we have this great forum :D


Best

Klaus

omekkainteractive
Posts: 8
Joined: Sat Mar 28, 2015 7:16 pm

Re: Learn it with livecode (calculator tutorial problem)

Post by omekkainteractive » Tue Jul 21, 2015 3:45 pm

and its already in the code that i sent you in the screenshot but when i entered your line of code exactly where you told me to , it started working ....

Best

Shahzad

Post Reply