Question to get started with Levure framework

A place to discuss Version Control in LiveCode

Moderators: heatherlaine, Klaus, FourthWorld, kevinmiller

Post Reply
mimu
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 38
Joined: Tue Mar 05, 2013 7:00 pm
Location: Berlin
Contact:

Question to get started with Levure framework

Post by mimu » Mon Nov 06, 2017 4:35 pm

1
after calling levurePackageApplication "ios simulator"
in the message box the app windows are closed and the app starts in the simulator.
To make changes to my app i try clicking „Open Application“ in the LevureApplication window again , but nothing happens.
After a restart of live code „Open Application“ in the LevureApplication window is working again.
What i am doing wrong?


2
I’ve put every card in its own ui stack and the card code into a different behavior stacks.
I navigate from card to card with:
for example in a button script
go stack „xxxx“
close stack me

To get a openCard message inside the card i navigate to, i use “ close stack me „
This works fine inside the ide and on mobile
Is this the correct or intended way?

3
My Problem with Datagrids on mobile
i navigate to a UIstack with a datagrid of type form and fill it with about 50 records (5 fields).
it scrolls smoothly
now i navigate to another card with go stack „xxx2“ (UI stack with only one card)
next i navigate back to the first card (UI stack with only one card) and the data grid on it

Now scrolling of the data grid does not work anymore.
the scrollbar is visible and moving, but the records stay fixed.

Only on mobile, inside the ide it works as expected .

What i’am missing or doing wrong?

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

Re: Question to get started with Levure framework

Post by trevordevore » Mon Nov 06, 2017 5:42 pm

HI @mimu,

1) I would have to look into this but I'm unable to test this at the moment as my XCode has been updated to 9.1 and LiveCode doesn't have a vision that works with 9.1 yet. I don't keep an older version around as I don't do mobile development on a regular basis.

2) Here is what I use for navigating between UI cards stacks:

Code: Select all

go stack "Playback" in window (the short name of this stack)
This will replace the current window with the one you want to navigate to.

3) I'm not sure about this one. There is probably an error occurring in a script somewhere that isn't being reported. You could try adding the following script to your app.livecodescript script and see if an error dialog pops up when testing on mobile:

Code: Select all

on errorDialog pError
  beep
  answer error pError
end errorDialog
Trevor DeVore
ScreenSteps - http://www.screensteps.com

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

mimu
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 38
Joined: Tue Mar 05, 2013 7:00 pm
Location: Berlin
Contact:

Re: Question to get started with Levure framework

Post by mimu » Tue Nov 07, 2017 10:39 am

Hello Trevor,

thank you very much for your quick reply.

Concerning my datagrid problem,
i've put the suggested error handler into app.livecodescript script but i don't get an error.

My next step was to add a button script :
if the environment is "mobile" then
put mobileControls() into tControlList
answer tControlList

When i first open the stack with a data grid i get the answer 1,
afterwards i navigate to the next stack with a data grid and back to the first stack.
Now no mobile control is created and the answer is empty.

Any ideas?

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

Re: Question to get started with Levure framework

Post by trevordevore » Tue Nov 07, 2017 12:56 pm

It sounds like there is code that creates a mobile scroller for the DataGrid. It would appear that the scroller is deleted when the card closes but is not recreated when returning to the card. Is it your code that creates the mobile scroller?
Last edited by trevordevore on Tue Nov 07, 2017 5:56 pm, edited 1 time in total.
Trevor DeVore
ScreenSteps - http://www.screensteps.com

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

mimu
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 38
Joined: Tue Mar 05, 2013 7:00 pm
Location: Berlin
Contact:

Re: Question to get started with Levure framework

Post by mimu » Tue Nov 07, 2017 3:59 pm

No its not my code, its handled by the data grid itself.

I looked into the code in the datagrid stack and there is code which handles it.

I'am on LC9DP10

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

Re: Question to get started with Levure framework

Post by trevordevore » Tue Nov 07, 2017 4:28 pm

I think I found the problem.

The mobile scroller is created in the `_Initialize` command (line 126 in ./Tools/Toolset/palettes/revdatagridlibrary/behaviorsdatagridbuttonbehavior.livecodescript). `_Initialize` is called from `preOpenControl`. The mobile scroller is deleted in `closeControl`. Create and delete are not balanced, however!

The `Initialize` command will only execute the code in the command once because the first line of the command is the following:

Code: Select all

if not sInit then
So when opening the DataGrid for the first time the mobile scroller is created. When you leave the card the mobile scroller is deleted. When you return to the card the `preOpenControl` message is sent to the DataGrid but because sInit is already true the mobile scroller is not created.

The code to create the mobile scroller needs to be moved into a separate handler and called regardless of whether or not sInit is true. I created a gist with an update script which I think will do the trick:

https://gist.github.com/trevordevore/2f ... 7beb4cf45c
Trevor DeVore
ScreenSteps - http://www.screensteps.com

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

mimu
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 38
Joined: Tue Mar 05, 2013 7:00 pm
Location: Berlin
Contact:

Re: Question to get started with Levure framework

Post by mimu » Tue Nov 07, 2017 5:49 pm

Trevor, thank you so much for your help.

I replaced /Tools/Toolset/palettes/revdatagridlibrary/behaviorsdatagridbuttonbehavior.livecodescript in the LC Programm bundle with the one from your gist.

Is it necessary to recreate the data grid from scratch ?
If not still no luck

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

Re: Question to get started with Levure framework

Post by trevordevore » Tue Nov 07, 2017 6:06 pm

You shouldn't need to recreate the DataGrid from scratch. You may need to restart the IDE after replacing the file though.

I made one change to the gist about 15 minutes ago. Maybe grab it again and see if that addresses the issue. Otherwise I would suggest adding some logging to the script to see if the mobile controller is really getting recreated when you navigate back.
Trevor DeVore
ScreenSteps - http://www.screensteps.com

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

mimu
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 38
Joined: Tue Mar 05, 2013 7:00 pm
Location: Berlin
Contact:

Re: Question to get started with Levure framework

Post by mimu » Tue Nov 07, 2017 6:23 pm

I just replaced the behaviorsdatagridbuttonbehavior again with the last version from your gist.

But the the mobile controller is not recreated.

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

Re: Question to get started with Levure framework

Post by trevordevore » Tue Nov 07, 2017 6:25 pm

It sounds like you are going to need to dig in and do some debugging then :)

One idea is to use some answer commands to alert you when the scroller is created and deleted.
Trevor DeVore
ScreenSteps - http://www.screensteps.com

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

mimu
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 38
Joined: Tue Mar 05, 2013 7:00 pm
Location: Berlin
Contact:

Re: Question to get started with Levure framework

Post by mimu » Tue Nov 07, 2017 9:22 pm

Hello Trevor,
your code works perfect!
Thank you so much

I made a silly mistake (typo in first of the behaviorsdatagridbuttonbehavior.livecodescript) :mrgreen:
and at some point i was wondering why no debugging added to the behavior was working

I made one small edit at the end of the _Initialize handler:

Code: Select all

    
    ......
    put true into sInit
  else
    if the environment is  "mobile" then
    _CreateMobileScroller
    end if
  end if

  ResizeToFit
end _Initialize
without the extra mobile check inside the IDE the scrollbars of datagrids are disabled.

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

Re: Question to get started with Levure framework

Post by trevordevore » Wed Nov 08, 2017 12:55 am

I'm glad you got it working. Here is the PR that I submitted so that the next update to LC 9 includes the fix:

https://github.com/livecode/livecode-ide/pull/1824
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 “Version Control”