Page 1 of 1

LC Indy 9.0.0 Build 15017 (Grid Problem) [resolved]

Posted: Sat Apr 21, 2018 8:28 pm
by townsend
First let me say I've really been enjoying all the nice little amenities of the new 9.0 version!!

But I'm having this one VERY odd problem with the grid. Here are the clues. Maybe you can help me figure this out.

I create a Grid with three columns. (any amount is okay) Then I populate the Grid with some simple code like this.

Code: Select all

on mouseUp pMouseButton
     local temp
     put "one" & tab & "two" & tab & "three" into temp
     dispatch "AddLine" to grp "myGrid" with temp
end mouseUp
Then I click on a row and the hilite bar is blue, as expected. Then I start clicking on the down arrow one click at a time and something very strange happens. First the hilite color turns gray. THEN on the next click, the LiveCode Dictionary opens up. Every time! (Even on a larger 9.0 app I've working on.)

(The number of down clicks varies. But 7 or 8 down arrow clicks should produce a gray hilite bar, then the next down click opens up the Dictionary.)

BIG CLUE: I think The hilite bar is blue when the grid has focus. But when focus is lost the hilite bar turns gray. So... it seems as though for some reason, something is going on in the background, taking focus away from the Grid AND opening the Dictionary! Very odd.
Grid Problem.PNG
Grid Problem.PNG (10.23 KiB) Viewed 3057 times

Re: LiveCode Indy 9.0.0 Build 15017 (Grid Problem)

Posted: Sun Apr 22, 2018 12:41 am
by townsend
I'VE GOT ANOTHER CLUE. I'm working on this application. And according to the Windows 10 Task Manager, it starts out using about 75 MB. Then after working for a few hours, LiveCode gets very sluggish. So much so that I have to continually close down LiveCode and reload to correct. Today in the Tex Editor, it got so bad that I was waiting like 4 seconds for the text I was typing to fully display. At this point I looked at the Task Manager and saw this same application was using over 350 MB.

What's with that? Is there some way for force LiveCode to clean this memory mix up?

Anyway... I guess it's too late to downgrade this app to version 8.1? Then again... at this point I kind of hate to give up all the 9.0 amenities, which I'm really liking.

Re: LiveCode Indy 9.0.0 Build 15017 (Grid Problem)

Posted: Sun Apr 22, 2018 4:57 am
by bogs
townsend wrote:
Sun Apr 22, 2018 12:41 am
Anyway... I guess it's too late to downgrade this app to version 8.1?
Well, I'm pretty sure you can open a 9.x stack in 8.x (tested opening 9.0 in 8.1.4 before posting, I assume it goes down to 8.1 itself).

Re: LiveCode Indy 9.0.0 Build 15017 (Grid Problem)

Posted: Sun Apr 22, 2018 4:11 pm
by jacque
Can you post your addLine handler?

Re: LiveCode Indy 9.0.0 Build 15017 (Grid Problem)

Posted: Sun Apr 22, 2018 7:55 pm
by townsend
Thanks for your replies... Jacque & bogs.

Good to know, if need be I can downgrade to 8.1.4. (Hope it doesn't come to that.)

As for my AddLine Handler, that's the code I included at the start of this tread. Though... that works fine. No problem there.

ANOTHER CLUE (new day); The Dictionary did not automatically open when I was using the down arrow key, (like yesterday). But it now takes two clicks of the down arrow to move down one row. On the first click the hilite bar turns gray. Then on the second click, the hilite bar moves down and turns back to blue. (??)

ALSO: The app where this problem originated, does a bunch of web scraping. That is, in the course of an hour maybe 100 pages are downloaded and processed. Always being rewritten into the same variable. I think that's probably why there is buildup of memory, as reported by Windows Task Manager. And thus, the eventual sluggishness of the Code Editor.

SO... is there some way to clear the LiveCode's internal cache???

Re: LiveCode Indy 9.0.0 Build 15017 (Grid Problem)

Posted: Sun Apr 22, 2018 8:25 pm
by jacque
I'm not sure what's going on with the hilitedLine. As long as the focus hasn't changed it should work normally. There may be something in your script that focuses on another object or removes the focus entirely, you could check for that.

To clear a variable, just put empty into it. The variable will clear itself when the handler ends, if it's a local handler variable. If it's a script local or global variable then it will retain its content until you empty it or completely replace its content.

If you can't find the cause, it might be helpful to see the relevant portion of your scraping handler.

Edit: on second thought, arrow keys can be set to navigate and it sounds like that's what's happening. Up and down arrows navigate to other stacks, left and right arrows navigate through cards. You can change that by setting the navigationArrows to false. You could also set the textArrows to true.

Indy 9.0 Build 15017 (Grid Problem) [mostly resolved]

Posted: Mon Apr 23, 2018 5:54 pm
by townsend
Thanks Jacque!! From the Preferences window, under General, I clicked off the
Arrow keys to navigate through cards option and the hilite problem no longer occurs.

Yes, you can clear any variable by putting empty into it. Or you can replace the contents of the variable by putting something else into it. That's what I do. But I suspect that LiveCode has some kind of memory manager that's not cleaning up after itself. I guess the is no command to force a garbage clean-up.

As for the sluggish Code Editor when memory is overloaded, I will run some more tests and post those results as a new thread.

Re: LC Indy 9.0.0 Build 15017 (Grid Problem) [resolved]

Posted: Mon Apr 23, 2018 6:18 pm
by jacque
Garbage collection is done whenever an idle happens. If you're running a tight loop or several handlers call each other serially there will be no idle. That's one reason why using "send in time" is preferable to long repeat loops, because even if the sending time is zero, the engine will do cleanup. You can accomplish the same thing with "wait 0 with messages" if necessary.

But I'd also check to make sure a script somewhere isn't accidentally adding content to a variable. Or maybe there's an image that got imported and not removed. Or something else like that.