Page 2 of 2

Re: Clock App

Posted: Fri Jun 10, 2016 2:57 pm
by jameshale
I can have a look from Monday so if you can zip the stack and post it here I will,take a look.

James

Re: Clock App

Posted: Fri Jun 10, 2016 3:05 pm
by dave.kilroy
Hi Saleh

What happens if you download the completed lesson stack and step through it? Does it behave in the same way as your own one? What are the differences (if any)? Does the completed lesson stack give you any clues as to what the problem is?
If so then it may be worth your while also downloading the completed stack "clock-6.livecode" and comparing it with your own - for example on the card they name "cardAlarm" they have not one but two datagrids ("gridAlarm" and "gridAlarmEdit"). I haven't stepped through the code properly and can't say for sure whether both datagrids are actually needed - but the difference in the number of datagrids is pretty major difference between your version and the 'official' version.

Re: Clock App

Posted: Mon Jun 13, 2016 8:38 am
by jameshale
Hi Saleh,

Well I spent some time over the weekend doing the clock app lessons.
I only used the slides (except once) as I didn't want to watch the videos.
There are a few problems with the material (using / as a line continuation character instead of \).
One handler beginning with "put" instead of "local" and one completely omitted function.
And a big one if your OS is set to use a 12 hour clock and not 24 hour one.
However, the stack built does indeed work, at least in terms of showing the set alarms in a data grid.

So what is wrong with your stack?

I am assuming you were able to get past the errors in the instructions as when trying to either compile a script or run it would indicate the errors mentioned.
So, that is not the issue.
But, it could simply turn out to be a simple typo.
When I first completed the app I too had nothing showing in my list of alarms regardless of how many alarms I added.
What was going wrong??
OK, starting at the "saveAlarm" handler I traced through saving the alarm, returning to the "Alarm" card and populating the data grid.
In doing so I discovered a couple of typos in my variable names.

Of course these will not be picked up by the compiler because, even though it really does a pretty good job at finding errors it can't know that when I type

add 1 to tLocal
and then
put tLocak into Fred

that I mistyped tLocal.

Yet this is what I did and because of this Fred does not have the value i expect.

In my case I had doubled up a couple of letters trying to type camel case for all the variables.

My point is that after I had found and cleared up these typos the stack worked as expected.

So I am really thinking you need to trace through your scripts and find the error.

James

Re: Clock App

Posted: Fri Nov 25, 2016 1:02 pm
by salah99
Dear James,

so sorry for my very late reply as I was busy with other mobile technologies.

Back to the clock app, I tried it again with version 8.1.1 and the datagrid is still empty. I really don't know what is wrong with it as there are no errors or typos with the code.

I have attached my file for you to look at.

So far, when I go to the alarm card and click on add and then clock on save, the app should save the new alarm to a file as well to the memory.

When I return to the alarm card again I should see the list of ala
Clock.zip
(14.12 KiB) Downloaded 507 times
rms that were saved to the memory at least.

Right now even through I could see that the code check for the in memory array is not empty (I couldn't though display the array contents in the debugger I don't know why),
the datagrid is still empty. Please help me as I saw another post complaining about the same issue!!!

Regards,
Salah.

Re: Clock App

Posted: Sat Nov 26, 2016 5:22 am
by jameshale
I downloaded your app and sure enough there was an issue with showing the alarms.
The first clue is the list of errors that come up in the message box when you go to the "alarm" card.
Message_Box__Single_Line_.png
errors on going to alarm card
These tell you something is amiss in the template.

When I looked at the "alarm" card in the project browser it all looked ok.

I then had a look at your datagrid template and here it was not ok.
Open the Project Browser, reveal the "Clock" components and then reveal the "Data Grid Templates ....." substack
Reveal the second card in the template substack
There you should see a group "Row Template" which when opened will show all your controls.
What you will see however is all your controls OUTSIDE the group "Row Template"
Project_Browser_1.png
controls not in group
I suspect that when you edited the row template you didn't click on the existing controls and then select "edit group".

I simply deleted your data grid and redid it.

Works fine (for this stage of the app).

Re: Clock App

Posted: Sat Nov 26, 2016 5:24 am
by jameshale
Here is how the template should appear in the Project Browser...
Project_Browser_and_Clock__1___.png
controls in group

Re: Clock App

Posted: Sun Nov 27, 2016 7:54 pm
by salah99
Dear James,

Thank you very much for your help.

Alhamdulillah all is ok now.

As you stated rightly, my data grid was not set up correctly as I wasn't fully aware that while my data grid group is in edit mode and if I save my work before stopping editing the group I should click on edit group again as the edit mode will go off when saving!!

Also, there was some error in the way of coding the app in some cases as of deleting the entry in the array should have been based on the attribute "id" and not based on the index.

I had to perform a linear search on the array to find out the right index based on the passed "id" attribute.

I wonder if livecode has any other data structure that the developer can perform a faster search based on any attribute!!

The line separator of the graphic bottom line was also not appearing in my case even though I used the same coordinated as instructed but I had to lift it up higher in the template in order for it to appear.

Also, there was a need to explicitly clear the dgData of the data grid in case the array is empty.

Now all is ok and app is working fine.

Thanks again for all of your help dear.

Regards,
Salah.

Re: Clock App

Posted: Fri Dec 16, 2016 4:03 pm
by salah99
Guys I am posting here my working clock app for reference

Re: Clock App

Posted: Tue Jul 04, 2017 2:41 pm
by ty.bailey@o2.pl
Thanks for details, guys. I was looking for smart but at the same time not difficult app building course. Want to try this one.

Re: Clock App

Posted: Sun Sep 13, 2020 2:01 pm
by johnamaro
salah99 wrote:
Sat Jun 04, 2016 10:41 am
Dear All,

I recently purchased this course and its a lot of fun!!

I have two major issues with the clock app as follows:

1. When I click anywhere on any free space on any card, the app navigates away from the current card. I am not sure why!!

2. The list of alarms are saved successfully to the file but they are not loaded to the list of alarms on the alarm card. Very wierd!!! :roll:

If anyone could please help me out as this is my first post in the forum and I hope to get some good initial impression.

Here is my code for the show list command.

I have debugged it and tFormattedArray contains the desired contents as follows:

tFormattedArray
1
edit = false
id = 1
label = morning alarm
on = false
sound = Beep
time = 11:31

But when the curser reaches the the following statement, the debugger exits with no error but no list is displayed:

set the dgData of group "alarmList" to tFormattedArray

I have set up my data grid behavior as follows:

##############################################################

on FillInData pDataArray

set the text of field "time" of me to pDataArray["time"]
set the text of field "alarmLabel" of me to pDataArray["label"]
set the text of field "id" of me to pDataArray["id"]

if pDataArray["on"] is true then
set the hilite of button "alarmOn" of me to true
else
set the hilite of button "alarmOn" of me to false
end if

if pDataArray["edit"] is true then
hide button "alarmOn" of me
show button "edit" of me
else
show button "alarmOn" of me
hide button "edit" of me
end if

end FillInData


################################################################

on LayoutControl pControlRect

local theFieldRect

if the hilite of button "alarmOn" of me is true then
set the backGroundColor of graphic "alarmBackground" of me to 255,255,255
else
set the backGroundColor of graphic "alarmBackground" of me to 239,239,244
end if

set the rect of graphic "alarmBackground" of me to pControlRect

end LayoutControl

######################################################################


Please I need your help guys!!!


Regards,
Salah.
I am very excited to do this course but I need to know something about how this FMWhatsApp Apk app is made. I have also used Android Studio and thunkable site like free site but I don't understanding the coding which is use in this app.