Complete Newbie (but 25 years experience in older stuff)

LiveCode is the premier environment for creating multi-platform solutions for all major operating systems - Windows, Mac OS X, Linux, the Web, Server environments and Mobile platforms. Brand new to LiveCode? Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

J&R Rovers
Posts: 19
Joined: Thu Feb 26, 2015 7:51 am
Contact:

Re: Complete Newbie (but 25 years experience in older stuff)

Post by J&R Rovers » Sat Jul 29, 2017 11:46 am

Regarding the illusive debug mode the Development - Script Debug Mode menu item is ignored in both Edit and Run mode. Ctrl - Click placing the breakpoint still results in a grey mark and nothing stops
Cheers
John

J&R Rovers
Posts: 19
Joined: Thu Feb 26, 2015 7:51 am
Contact:

Re: Complete Newbie (but 25 years experience in older stuff)

Post by J&R Rovers » Sat Jul 29, 2017 12:00 pm

Debug again, yes I can right click on a breakpoint and choose enable (or indeed enter a condition). However Choosing Enable does not turn debug on or enable the breakpoint. Breakpoints are greyed out and the menu item Development - Script Debug Mode does not work. I haven't been able to find anything in the docs that suggest there is a switch somewhere. There is nothing in Preferences to suggest a switch.
I am developing in Windows, could this be a Windows issue ? Maybe I should downgrade to a lessor version ?
Cheers
John

shaosean
Posts: 906
Joined: Thu Nov 04, 2010 7:53 am

Re: Complete Newbie (but 25 years experience in older stuff)

Post by shaosean » Sat Jul 29, 2017 12:05 pm

I forgot to uncomment out the first line, in the post above..
Also, it's "among the items of" not "among the lines of", so that's been changed in this version..

Code: Select all

local sMySendCommandID

on keyDown pKey
   if (sMySendCommandID is among the items of the pendingMessages) then cancel sMySendCommandID
   send "MyDelayedSearch pKey" to me in 500 milliseconds
   put the result into sMySendCommandID
   pass keyDown
end keyDown

command MyDelayedSearch pKey
   -- do your stuff here
end MyDelayedSearch

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7389
Joined: Sat Apr 08, 2006 8:31 pm
Contact:

Re: Complete Newbie (but 25 years experience in older stuff)

Post by jacque » Sat Jul 29, 2017 5:19 pm

J&R Rovers wrote:Regarding the illusive debug mode the Development - Script Debug Mode menu item is ignored in both Edit and Run mode. Ctrl - Click placing the breakpoint still results in a grey mark and nothing stops
Cheers
John
This is also the behavior of an uncompiled script. To debug, the Debug Mode must be set in the Development menu (you can leave it on permanently, most of us never turn it off.) Then edit your script as needed, and click the Apply button at the top left of the script editor window, or just hit the Enter key on the keyboard. Then set some debug points.

Note that there is currently a bug in the script editor that doesn't always keep the breakpoints aligned with the correct lines of script if you edit the script with existing breakpoints in place. If that happens the breakpoints won't work as expected, so keep an eye out for wandering red dots.

However, a gray dot is a disabled breakpoint and will never trigger. If you see those it's likely the script has been changed but not yet compiled. (Or the dot has wandered into a comment where it can't be active.)
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

J&R Rovers
Posts: 19
Joined: Thu Feb 26, 2015 7:51 am
Contact:

Re: Complete Newbie (but 25 years experience in older stuff)

Post by J&R Rovers » Sun Jul 30, 2017 2:01 am

A BIG thank you all for your help.
(1) Yes the incremental search now works a treat by changing the lines to items
(2) The debugger ? All I have to do is to switch the debugger on before I load any stacks or start work and I will always leave it on. My mistake was assuming it could be switched on at will.

Hopefully I can go forward and get over the next few humps on my own. :D Pretty excited and more than a little embarrassed

Cheers
John

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7389
Joined: Sat Apr 08, 2006 8:31 pm
Contact:

Re: Complete Newbie (but 25 years experience in older stuff)

Post by jacque » Sun Jul 30, 2017 4:23 am

Don't be embarrassed -- you should be able to turn debugging on and off at will. Sounds like a glitch to me. Probably no one has noticed it because we never turn it off.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

bogs
Posts: 5480
Joined: Sat Feb 25, 2017 10:45 pm

Re: Complete Newbie (but 25 years experience in older stuff)

Post by bogs » Sun Jul 30, 2017 4:53 am

Ditto to what Jaque said, the other big gotcha (that got me a lot) was forgetting to turn messages back on after turning it off :roll: or getting to change the 'select grouped' box, or ...(too many other things to mention)... :oops:
Image

J&R Rovers
Posts: 19
Joined: Thu Feb 26, 2015 7:51 am
Contact:

Re: Complete Newbie (but 25 years experience in older stuff)

Post by J&R Rovers » Mon Jul 31, 2017 8:16 am

Yeah, well I try to avoid finding fault with a new environment. Ask any experienced Visual Foxpro Developer. It is/was the fastest RAD system ever invented. The MVP's there were at the leading edge of everything; inheritance, intellisense, data manipulation, you name it. Even that little thing the Escape key to drop out of any window and clear the Command (Messages) box, little things but oh so great for speed of work. The previous owners had a Mac compiler as well. Then Microsoft dumped it, a great shame.
Like where the hell do I find formatting or Inputmask of a field in Livecode to be able to force upper/lower case, pictures of number formatting 99999.99 etc etc. Drives me mad. :shock:

But, and here is the rub, Livecode has multi platform support, that is EVERYTHING as far as I am concerned. So I will spend days on one small thing trying to understand the logic that escapes me, just like I did when I first moved to Object Oriented programming so often walking away to clear my head. Then coming back at all hours to try again.

Then the thrill of making something work that fires the addiction and makes it all worth while :D

Cheers
John

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7389
Joined: Sat Apr 08, 2006 8:31 pm
Contact:

Re: Complete Newbie (but 25 years experience in older stuff)

Post by jacque » Mon Jul 31, 2017 4:43 pm

Like where the hell do I find formatting or Inputmask of a field in Livecode to be able to force upper/lower case, pictures of number formatting 99999.99 etc etc.
Did you find out? Because both of these things are doable.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

J&R Rovers
Posts: 19
Joined: Thu Feb 26, 2015 7:51 am
Contact:

Re: Complete Newbie (but 25 years experience in older stuff)

Post by J&R Rovers » Tue Aug 01, 2017 4:41 am

No, I have tried to use toUpper() like this
on mousedown
toUpper(me)
end mousedown
But that doesn't work.
I did get a semblance of something working to a point with the code below, however that just echo's a double up. Type a and you get Aa
on keyDown pKey
put toUpper(pKey) into the selection
if (sMySendCommandID is among the items of the pendingMessages) then cancel sMySendCommandID
send "MyDelayedSearch pKey" to me in 500 milliseconds
put the result into sMySendCommandID
pass keyDown
end keyDown

command MyDelayedSearch pKey
set the dgData of group "DataGrid1" to empty
put field "fldEntry" into myField
put "%" after myField
put "SELECT * FROM customers where customerid like " into tQuery
put "'" after tQuery
put myField after tQuery
put "'" after tQuery

put revDataFromQuery(,,gConID,tQuery) into tRecords
set the dgText of group "datagrid1" to tRecords

end MyDelayedSearch
The property inspector actually has a format checkbox, but that does nothing. I couldn't find anything under formatting that was relevant in the property inspector. There is nothing under inputmask either.
From what I can see we have to write most of the functionality we took for granted in other languages ourselves.
BTW although I got the debugger working, it changes it's mind (even in edit mode) and stops working even though Script Debug mode is on. To get it working again I have to close everything and open Livecode again. Not the quickest way to develop an app :(
Also with Background switched on to get rid of the clutter behind me and I open a stack or anything else it doesn't appear (stays hidden) until I click on the background then it shows.

J&R Rovers
Posts: 19
Joined: Thu Feb 26, 2015 7:51 am
Contact:

Re: Complete Newbie (but 25 years experience in older stuff)

Post by J&R Rovers » Tue Aug 01, 2017 4:43 am

Sorry that first quote should have been
on keyDown
etc

Not on Mousedown
Cheers
John

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7389
Joined: Sat Apr 08, 2006 8:31 pm
Contact:

Re: Complete Newbie (but 25 years experience in older stuff)

Post by jacque » Tue Aug 01, 2017 6:30 am

You're close. KeyDown is sent before the character goes into the field, keyUp is sent after. If you don't pass KeyDown, the engine will never get a chance to process the keypress. So the reason you're getting double characters is because the handler puts the text into the field, passes the message, and the engine (which doesn't know you've handled the keypress) puts it in again. So the solution is: don't pass keyDown.

This is pretty much how we write input masks; you can capture and work with typed text in any way you want, including discarding it. For example, if you only want a field to accept numbers:

Code: Select all

if pKey is a number or pKey is "." then
  put pKey into the selection
end if
That will accept numbers and decimal points, but not alpha characters. Basic rule of thumb is that if you are handling the keypress, don't pass keyDown. Just take out that line and you should be good.

I'm glad you're sticking it out -- besides syntax and vocabulary, there is always a raft of behaviors to learn, and for me that's the hardest part. It isn't just knowing what the words are, but also what happens when you use them and how the system works.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

J&R Rovers
Posts: 19
Joined: Thu Feb 26, 2015 7:51 am
Contact:

Re: Complete Newbie (but 25 years experience in older stuff)

Post by J&R Rovers » Tue Aug 01, 2017 7:18 am

That worked !
I can now see how I can create standard validations as well.
Yes the order of firing of events and even what they are will be a challenge and in some ways the simplistic commands are a bit hard to grasp, but it's what we do I guess. I was going through the lessons and came across one of yours using the debugger. Small world :)
Thank you for your patience. I have no doubt I will need to post other questions time goes by, but I do spend a lot of time sifting through lessons, demos and the dictionary to pick up tips and logic
Cheers
John

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10305
Joined: Wed May 06, 2009 2:28 pm

Re: Complete Newbie (but 25 years experience in older stuff)

Post by dunbarx » Tue Aug 01, 2017 2:47 pm

Hi.

LC seems at first blush so easy, new users are oftentimes disappointed when they learn that considerable learning effort is required to actually do real work. That is because LC is a vast, rich environment, that, if as easy to learn as it first seemed, would not have the power and flexibility it does.

The next thing to struggle with is the fact that there are always many ways to do what you want to. As you gain experience, you will find this both enlightening and annoying. Annoying because the third way you see is (and always was) likely the best way.

For example, if you wanted to filter anything that was not a valid "number" when the user types into a field, you would need to include the minus sign. So this might be one way:

Code: Select all

if pKey is in "0123456789.-" then pass keyDown
So unless you explicitly want the user to be able to include "+", this covers it. :wink:

Craig Newman

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7389
Joined: Sat Apr 08, 2006 8:31 pm
Contact:

Re: Complete Newbie (but 25 years experience in older stuff)

Post by jacque » Tue Aug 01, 2017 4:19 pm

So about the debugger. I've never seen that happen and have never had to restart LC. What exactly happens when it stops working?
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

Post Reply