Creating LiveCode applications that play well with git

Anything beyond the basics in using the LiveCode language. Share your handlers, functions and magic here.

Moderators: Klaus, FourthWorld, heatherlaine, robinmiller, kevinmiller

Post Reply
jim1001
Posts: 143
Joined: Fri Jan 29, 2016 6:25 pm

Re: Creating LiveCode applications that play well with git

Post by jim1001 » Mon Jun 12, 2017 5:11 pm

Trevor,

I’ve re-visited Levure and the wiki.

Creating a Levure application (Windows 7, LC Community 8.1.3, with git) went smoothly. I was also able to successfully replace the LevureSampleWindow and Levure Sample Window Card Behavior stacks with my own. Although I’m still near the start
I’ll summarize my thoughts so far in the hope that it may be useful to somebody.

I’ve noticed some pages, e.g Building Your Application - ui have just been changed and have already answered some questions / comments I was going to make.

Also, some of the things I mention below now seem obvious to me - but they weren’t when I first encountered them.


General thoughts

* There are many LiveCode concepts in the Levure Wiki which are either new to me or I’ve hardly used but which have to be understood to make progress, e.g. setting a behaviors script for an object. These contribute to making Levure a steep learning curve.

* I made best progress when using the wiki to perform a specific task - in my case swap the sample UI stacks for my own

* It could be helpful to emphasize which parts of the User Guide are functional (necessary to set up & use a Levure app) and which are background information or refinements to the process. The essential bare-bones could be presented first then refinements gradually introduced later.

* The sample app could be used a bit more to assist in explanations. For example, on the ui page under 4. Assign the script-only stacks as behaviors, you could direct readers to have a look at the behaviors tab of the card in the UI stack

Specific questions / feedback

* Is there best practice for closing / saving / exiting / managing a Levure app with all its stacks?

* Following on from this, several times on exiting LiveCode I have seen
Do you want to save changes to stack “LevureStandalone” and all other stacks in the file “standalone.livecode” before closing? Think I said yes to this once by mistake. After this when I opened the standalone.livecode stack I didn’t see the opening window with the Open Application button. Managed to correct this. Reading the wiki I think most times the answer to this should be no - perhaps this could be emphasized.

*Advice for using Git with Levure - is the idea is to open the app repository, e.g. LevureTest for the sample, and track changes to all files except the binary .livecode files?

* Don’t understand Helpers
Are they same as plugins?
Do they exist outside Levure? I’ve seen reference to a Data Grid helper...
Why put something in a helper?
There is a preferences framework helper - but what preferences can be set?
Could you give a link to explain helpers?

* Don’t understand frontscripts / backscripts - are frontscripts related to the preOpenStack handler?

* Levure Sample Window text should be You can delete the sample_window folder…(not main_window folder)

* It wasn’t clear to me that the script name on first line of .livecodescript stack file becomes the name of the stack file in the IDE & doesn’t have to agree with the filesystem name. Not directly a Levure issue but I first noticed it with the sample app

* Adding a script stack to Stack Files tab: Again, not directly a Levure issue but this was first time I’d done this. I noticed that adding in the IDE by browsing to the stack file added the full path - whereas path for Levure Sample Windows Card Behaviour was relative i.e. behaviours/card_behaviour.livecodescript. Initially I couldn’t change this in the IDE. Got it to change later (not sure what was going on). Now the wiki mentions adding by script - is there a recommended place to do this?

* Worth explaining what you can see in the project browser when the sample app is first opened and that other stacks appear there when you run the app in the IDE

* The sample app button mouseUp handler is coded
on mouseUp pBtnNum
if pBtnNum is 1 then...
Why the need for pBtnNum?

Thank you,
Jim

jim1001
Posts: 143
Joined: Fri Jan 29, 2016 6:25 pm

Re: Creating LiveCode applications that play well with git

Post by jim1001 » Mon Jun 12, 2017 10:41 pm

...I just spotted
Levure Sample Window text should be You can delete the sample_window folder…(not main_window folder)
is already an Issue on the GitHub page so cross that one off the list :)

jim1001
Posts: 143
Joined: Fri Jan 29, 2016 6:25 pm

Re: Creating LiveCode applications that play well with git

Post by jim1001 » Mon Jun 12, 2017 11:20 pm

From a previous post Trevor said
You should be able to use the Test feature in the IDE like you normally would.
I'm developing for an Android tablet and usually use this feature to quickly build, install and run my app on a USB connected tablet. Can you explain how to do this for a Levure app?

... and something I said earlier:
Worth explaining what you can see in the project browser when the sample app is first opened and that other stacks appear there when you run the app in the IDE
is partly explained on the wiki page Loading an Application in the LiveCode IDE

Thanks.

trevordevore
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 962
Joined: Sat Apr 08, 2006 3:06 pm
Location: Overland Park, Kansas
Contact:

Re: Creating LiveCode applications that play well with git

Post by trevordevore » Mon Jun 12, 2017 11:48 pm

Thanks for the detailed feedback Jim! I'm including comments on some items below.
jim1001 wrote:There are many LiveCode concepts in the Levure Wiki which are either new to me or I’ve hardly used but which have to be understood to make progress, e.g. setting a behaviors script for an object. These contribute to making Levure a steep learning curve.
This is both a relatively new concept and difficult to do in the 8.1.4 IDE. The 8.1.5 IDE (RC-1 is available for download) makes assigning behaviors easier, however. The Behavior icon menu where you assign behaviors now allows you to create a script only stack that will automatically be assigned as the behavior of the selected control and assign the script only stack file to the stackFiles property. And it will use a relative path.
jim1001 wrote:Is there best practice for closing / saving / exiting / managing a Levure app with all its stacks?
Not yet. You can close down the IDE like you normally would. You don't have to do anything special with a Levure app. As for saving, you can just saves that stacks you are working on as you go.
jim1001 wrote:Following on from this, several times on exiting LiveCode I have seen
Do you want to save changes to stack “LevureStandalone” and all other stacks in the file “standalone.livecode” before closing? Think I said yes to this once by mistake. After this when I opened the standalone.livecode stack I didn’t see the opening window with the Open Application button. Managed to correct this. Reading the wiki I think most times the answer to this should be no - perhaps this could be emphasized.
This save dialog should be ignored. If you didn't explicitly make changes to the standalone stack don't save it. The reason it isn't showing up is because it was saved in an invisible state. I'll make a note that we should point this out in the FAQ.
jim1001 wrote:Advice for using Git with Levure - is the idea is to open the app repository, e.g. LevureTest for the sample, and track changes to all files except the binary .livecode files?
You track changes to binary files as well. You just don't track the `builds` folder. Your entire application resides in the git repo. You just can't determine the exact changes to binary stacks. You have to rely on the git commit message that you wrote when you checked the binary file changes into the git repo.
jim1001 wrote:Don’t understand Helpers. Are they same as plugins?
No.
jim1001 wrote:Do they exist outside Levure? I’ve seen reference to a Data Grid helper...
No.
jim1001 wrote:Why put something in a helper?
There is a preferences framework helper - but what preferences can be set?
Could you give a link to explain helpers?
Here is the page on Helpers from the wiki:

https://github.com/trevordevore/levure/wiki/helpers

And here is the wiki page on the Preferences helper:

https://github.com/trevordevore/levure/ ... references

You can examine the helpers in the Levure/framework/helpers folder to see some examples. Levure ships with seven of them. After you look those materials over let me know if you still have questions.
jim1001 wrote:Don’t understand frontscripts / backscripts - are frontscripts related to the preOpenStack handler?
frontscripts/backscripts are LiveCode features. Take a look at frontscript or backscript in the LiveCode dictionary.
jim1001 wrote:Adding a script stack to Stack Files tab: Again, not directly a Levure issue but this was first time I’d done this. I noticed that adding in the IDE by browsing to the stack file added the full path - whereas path for Levure Sample Windows Card Behaviour was relative i.e. behaviours/card_behaviour.livecodescript. Initially I couldn’t change this in the IDE. Got it to change later (not sure what was going on). Now the wiki mentions adding by script - is there a recommended place to do this?
As mentioned above 8.1.5 RC-1 improves this workflow. I would recommend downloading and using it with Levure. http://downloads.livecode.com/livecode/
jim1001 wrote:The sample app button mouseUp handler is coded
on mouseUp pBtnNum
if pBtnNum is 1 then...
Why the need for pBtnNum?
If you don't check the button number then a right-click would trigger the answer dialog.
jim1001 wrote:I'm developing for an Android tablet and usually use this feature to quickly build, install and run my app on a USB connected tablet. Can you explain how to do this for a Levure app?
Have you tried clicking the Test button? If should work just the same.
Trevor DeVore
ScreenSteps - http://www.screensteps.com

Levure Application Framework: https://github.com/trevordevore/levure
LiveCode Resources for Developers: http://livecode.bluemangolearning.com

jim1001
Posts: 143
Joined: Fri Jan 29, 2016 6:25 pm

Re: Creating LiveCode applications that play well with git

Post by jim1001 » Tue Jun 13, 2017 11:52 pm

Trevor,

Thanks for replies. To focus on just one
Have you tried clicking the Test button? If should work just the same.
Yes, I had tried a number of times but wasn't sure what I was doing. You have to understand that I've been using LiveCode very simply up to now.

I think this is right:
** Before using the Test feature you still have to set the Standalone Application Settings for your UI stack
** The LevureStandalone stack isn’t used when using the Test feature - it only comes into play when running the app in the IDE

Now, my UI /app runs as expected in the IDE. When I test it on a tablet however none of the behaviors do anything as if they haven’t been copied over. Think I need to re-read the wiki...

trevordevore
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 962
Joined: Sat Apr 08, 2006 3:06 pm
Location: Overland Park, Kansas
Contact:

Re: Creating LiveCode applications that play well with git

Post by trevordevore » Wed Jun 14, 2017 4:58 am

Jim,

Try this:

1. Launch the IDE
2. Open standalone.livecode
3. Press the "Test" button.

Does your app launch in the simulator when you follow those steps?
Trevor DeVore
ScreenSteps - http://www.screensteps.com

Levure Application Framework: https://github.com/trevordevore/levure
LiveCode Resources for Developers: http://livecode.bluemangolearning.com

jim1001
Posts: 143
Joined: Fri Jan 29, 2016 6:25 pm

Re: Creating LiveCode applications that play well with git

Post by jim1001 » Wed Jun 14, 2017 10:25 am

Trevor,
1. Launch the IDE
2. Open standalone.livecode
The Test Target isn't enabled at this point so if I press the Test button nothing happens.

If I press the Browse Tool then press the Open Application button the Test Target is enabled. If I then press the Test button the app is built, installed and launched on the target device. My UI appears. But the buttons I coded do not do anything when pressed

jim1001
Posts: 143
Joined: Fri Jan 29, 2016 6:25 pm

Re: Creating LiveCode applications that play well with git

Post by jim1001 » Wed Jun 14, 2017 11:04 am

Trevor,

I re-read your last post
Does your app launch in the simulator when you follow those steps?
I'm not using a simulator - I'm launching on a USB connected tablet. Perhaps that is the problem?

trevordevore
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 962
Joined: Sat Apr 08, 2006 3:06 pm
Location: Overland Park, Kansas
Contact:

Re: Creating LiveCode applications that play well with git

Post by trevordevore » Wed Jun 14, 2017 4:21 pm

I haven't ever done Android testing on a device so I'm not sure if that makes a difference or not. It seems odd that the Test button isn't active when you open the standalone.livecode stack. Have you configured the standalone settings for that stack? If not then you will need to do that first.

Trying to test your UI stack won't work so that isn't surprising. The UI stack won't load the Levure framework.
Trevor DeVore
ScreenSteps - http://www.screensteps.com

Levure Application Framework: https://github.com/trevordevore/levure
LiveCode Resources for Developers: http://livecode.bluemangolearning.com

jim1001
Posts: 143
Joined: Fri Jan 29, 2016 6:25 pm

Re: Creating LiveCode applications that play well with git

Post by jim1001 » Wed Jun 14, 2017 4:31 pm

Have you configured the standalone settings for that stack?
Yes, I had tried that.

The Test Target becomes available. On clicking the Test button an app is built, installed and launched on the target device. The app UI has one button - Open Application. However clicking this button does nothing.

I spent a lot of time a few months back trying to get the simulator for my Android device working. Gave up in the end and have been testing directly on the device with the Test button. Read that was a lot better than any simulator & it's fairly quick once working.

Cheers,
Jim

trevordevore
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 962
Joined: Sat Apr 08, 2006 3:06 pm
Location: Overland Park, Kansas
Contact:

Re: Creating LiveCode applications that play well with git

Post by trevordevore » Wed Jun 14, 2017 4:33 pm

I'm not sure what the problem could be then. I can only test on iOS but following the steps I outlined works. Are you able to make your project available for me to look at?
Trevor DeVore
ScreenSteps - http://www.screensteps.com

Levure Application Framework: https://github.com/trevordevore/levure
LiveCode Resources for Developers: http://livecode.bluemangolearning.com

jim1001
Posts: 143
Joined: Fri Jan 29, 2016 6:25 pm

Re: Creating LiveCode applications that play well with git

Post by jim1001 » Thu Jun 15, 2017 10:19 am

...and when I get time I'll repeat my test using the unchanged sample skeleton app that comes with the Levure framework. That will eliminate any problems caused by my coding :wink:

trevordevore
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 962
Joined: Sat Apr 08, 2006 3:06 pm
Location: Overland Park, Kansas
Contact:

Re: Creating LiveCode applications that play well with git

Post by trevordevore » Thu Jun 15, 2017 5:02 pm

Jim - it turns out I'm taking crazy pills. The Test button won't work (at least not yet). I thought I had tested it but I can't get it to work for iOS either.

Here is what you have to do to test in a simulator:

levurePackageApplication "android simulator"
levurePackageApplication "ios simulator"

I apologize for the confusion.
Trevor DeVore
ScreenSteps - http://www.screensteps.com

Levure Application Framework: https://github.com/trevordevore/levure
LiveCode Resources for Developers: http://livecode.bluemangolearning.com

jim1001
Posts: 143
Joined: Fri Jan 29, 2016 6:25 pm

Re: Creating LiveCode applications that play well with git

Post by jim1001 » Thu Jun 15, 2017 6:21 pm

Thanks for the update Trevor,
it turns out I'm taking crazy pills.
No worries - I have my own supply of those :)
Here is what you have to do to test in a simulator:
From experience so far I'm not keen on simulators. It seems difficult to get a good match to your target up & running & even then you're not sure if your app will work on the real thing.

Maybe I'll have another go or just build & install an apk each time until you are able to get the Test button working.

trevordevore
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 962
Joined: Sat Apr 08, 2006 3:06 pm
Location: Overland Park, Kansas
Contact:

Re: Creating LiveCode applications that play well with git

Post by trevordevore » Thu Jun 15, 2017 6:23 pm

Have you tried the handler I posted to see if it launches the app on your device? It may work.
Trevor DeVore
ScreenSteps - http://www.screensteps.com

Levure Application Framework: https://github.com/trevordevore/levure
LiveCode Resources for Developers: http://livecode.bluemangolearning.com

Post Reply

Return to “Talking LiveCode”