Complete Newbie (but 25 years experience in older stuff)
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
-
- Posts: 19
- Joined: Thu Feb 26, 2015 7:51 am
- Location: Perth, Western Australia
- Contact:
Complete Newbie (but 25 years experience in older stuff)
Hi All
After so many years programming in GWBasic - Quick Basic - dBase - Foxbase - Foxpro - Visual Foxpro it is indeed humbling to be brought up short and have to learn to crawl again. I wonder if it might be easier for a non programmer to learn Livecode without the constraints of old knowledge and habits.
However I have the greatest admiration for Livecode and what the team have produced, it is nothing short of amazing that a small company can pull of what we have been waiting for for years. A simplified multi platform programming environment. I managed to produce and compile a working app using sqlLite within a few days after a week of study. Admittedly it was a Windows app which is familiar territory for me, but it ran without error and produced queries into a grid without a hitch. Maybe an Android compile will produce a few more challenges.
What's more I was pleasantly surprised by the speed of loading and running of queries. Amazing !
I have one small request maybe someone could help me with please. I have partly built an incremental search field that displays queries into a grid while the user is typing. At this stage the user can't type any more than one letter at a time. I would like to have it allow the user to continue and the query to only kick in when they stop typing (for more than say .5 or 1 second). Here is the code, please excuse how cumbersome it is (but it works !):
on keyDown pKey
put toUpper(pKey) into the selection
end keyDown
on keyUp
global gConID
#// Empty the grid
set the dgData of group "DataGrid1" to empty
put field "fldEntry" into myField
put "%" after myField
#// insert some code in here that will prevent the query from happening
#// until a set period of time after the user stops typing (say 1 second)
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 keyUp
And if anyone can help with some docs on the hierarchy of folders produced by the compiler. There seems to be a lot more files than are needed for distribution.
Thank you in advance
Kind regards
John Stephen
After so many years programming in GWBasic - Quick Basic - dBase - Foxbase - Foxpro - Visual Foxpro it is indeed humbling to be brought up short and have to learn to crawl again. I wonder if it might be easier for a non programmer to learn Livecode without the constraints of old knowledge and habits.
However I have the greatest admiration for Livecode and what the team have produced, it is nothing short of amazing that a small company can pull of what we have been waiting for for years. A simplified multi platform programming environment. I managed to produce and compile a working app using sqlLite within a few days after a week of study. Admittedly it was a Windows app which is familiar territory for me, but it ran without error and produced queries into a grid without a hitch. Maybe an Android compile will produce a few more challenges.
What's more I was pleasantly surprised by the speed of loading and running of queries. Amazing !
I have one small request maybe someone could help me with please. I have partly built an incremental search field that displays queries into a grid while the user is typing. At this stage the user can't type any more than one letter at a time. I would like to have it allow the user to continue and the query to only kick in when they stop typing (for more than say .5 or 1 second). Here is the code, please excuse how cumbersome it is (but it works !):
on keyDown pKey
put toUpper(pKey) into the selection
end keyDown
on keyUp
global gConID
#// Empty the grid
set the dgData of group "DataGrid1" to empty
put field "fldEntry" into myField
put "%" after myField
#// insert some code in here that will prevent the query from happening
#// until a set period of time after the user stops typing (say 1 second)
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 keyUp
And if anyone can help with some docs on the hierarchy of folders produced by the compiler. There seems to be a lot more files than are needed for distribution.
Thank you in advance
Kind regards
John Stephen
Re: Complete Newbie (but 25 years experience in older stuff)
What you want to do is to use send to do your time delayed search.. When the KeyDown event is fired, check if the message is among the pendingMessages and if it is, then cancel it..
Code: Select all
local sMySendCommandID
on keyDown pKey
if (sMySendCommandID is among the lines of the pendingMessages) then cancel sMySendCommandID
send "MyDelayedSearch pKey" to me in 500 milliseconds
put the result into sMySendCommandID
end keyDown
private command MyDelayedSearch pKey
-- do your stuff here
end MyDelayedSearch
Last edited by shaosean on Fri Jul 28, 2017 3:00 pm, edited 1 time in total.
Re: Complete Newbie (but 25 years experience in older stuff)
Shouldn't we add a line to make it really work?
Code: Select all
local sMySendCommandID
on keyDown pKey
if (sMySendCommandID is among the lines of the pendingMessages) then cancel sMySendCommandID
send "MyDelayedSearch pKey" to me in 500 milliseconds
put the result into sMySendCommandID
end keyDown
private command MyDelayedSearch pKey
-- do your stuff here
end MyDelayedSearch
Re: Complete Newbie (but 25 years experience in older stuff)
I knew I forgot something, but couldn't see what it was I'll edit my code as well that way if someone copies it, it won't be a cruise on the fail boat
-
- Posts: 19
- Joined: Thu Feb 26, 2015 7:51 am
- Location: Perth, Western Australia
- Contact:
Re: Complete Newbie (but 25 years experience in older stuff)
Thank you, I am really sorry guys but I couldn't make this work. I confess to not understanding the comment by Klaus regarding the extra line, I couldn't see one. Here is the code as I interpreted it. It now does nothing, the character entered does not echo, the field stays blank and nothing happens
Cheers
John
Where did I go wrong ?local sMySendCommandID
on keyDown pKey
if (sMySendCommandID is among the lines of the pendingMessages) then cancel sMySendCommandID
send "MyDelayedSearch pKey" to me in 500 milliseconds
put the result into sMySendCommandID
end keyDown
private command MyDelayedSearch pKey
-- do your stuff here
global gConID
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
Cheers
John
Re: Complete Newbie (but 25 years experience in older stuff)
Klaus' message about the missing line was because I missed the line "put the result into sMySendCommandID" in my original posting.. Seems we both missed the "pass KeyDown" as well..
OR use the keyUp event instead
Code: Select all
on keyDown pKey
if (sMySendCommandID is among the lines of the pendingMessages) then cancel sMySendCommandID
send "MyDelayedSearch pKey" to me in 500 milliseconds
put the result into sMySendCommandID
pass keyDown -- this is the line we both missed
end keyDown
Code: Select all
on keyUp pKey
if (sMySendCommandID is among the lines of the pendingMessages) then cancel sMySendCommandID
send "MyDelayedSearch pKey" to me in 500 milliseconds
put the result into sMySendCommandID
end keyUp
-
- Posts: 19
- Joined: Thu Feb 26, 2015 7:51 am
- Location: Perth, Western Australia
- Contact:
Re: Complete Newbie (but 25 years experience in older stuff)
No that does nothing either, but thank you for trying to help
Perhaps you could help me with something else. I am trying to use the debugger, but it won't switch on and breakpoints are in grey not red and are ignored. Is there a switch somewhere that disables the debugger ? I can find nothing in any documentation and in the demos the debugger just works. I am using Indy version 8.1.5. I have seen it working once, but I have no idea what made it work.
If I can get that going I am sure I can work something out even using my old programming logic.
Thanks and cheers
John
Perhaps you could help me with something else. I am trying to use the debugger, but it won't switch on and breakpoints are in grey not red and are ignored. Is there a switch somewhere that disables the debugger ? I can find nothing in any documentation and in the demos the debugger just works. I am using Indy version 8.1.5. I have seen it working once, but I have no idea what made it work.
If I can get that going I am sure I can work something out even using my old programming logic.
Thanks and cheers
John
-
- Posts: 19
- Joined: Thu Feb 26, 2015 7:51 am
- Location: Perth, Western Australia
- Contact:
Re: Complete Newbie (but 25 years experience in older stuff)
No that does nothing either, but thank you for trying to help
Perhaps you could help me with something else. I am trying to use the debugger, but it won't switch on and breakpoints are in grey not red and are ignored. Is there a switch somewhere that disables the debugger ? I can find nothing in any documentation and in the demos the debugger just works. I am using Indy version 8.1.5. I have seen it working once, but I have no idea what made it work.
If I can get that going I am sure I can work something out even using my old programming logic.
Thanks and cheers
John
Perhaps you could help me with something else. I am trying to use the debugger, but it won't switch on and breakpoints are in grey not red and are ignored. Is there a switch somewhere that disables the debugger ? I can find nothing in any documentation and in the demos the debugger just works. I am using Indy version 8.1.5. I have seen it working once, but I have no idea what made it work.
If I can get that going I am sure I can work something out even using my old programming logic.
Thanks and cheers
John
-
- VIP Livecode Opensource Backer
- Posts: 2718
- Joined: Sat Dec 22, 2007 5:35 pm
- Location: Genève
- Contact:
Re: Complete Newbie (but 25 years experience in older stuff)
Hi John,
clic-ctrl. You can even put a condition
Best regards
Jean-Marc
Maybe menu development>script debug modeIs there a switch somewhere that disables the debugger ?
You can enable/disable a breakpoint with a contextual menubreakpoints are in grey not red and are ignored
clic-ctrl. You can even put a condition
Best regards
Jean-Marc
https://alternatic.ch
Re: Complete Newbie (but 25 years experience in older stuff)
Remove "private", seems send doesn't work with it.. not
Code: Select all
command MyDelayedSearch
Code: Select all
private command MyDelayedSearch
Code: Select all
local sMySendCommandID
on keyDown pKey
-- if (sMySendCommandID is among the lines 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
put pKey
end MyDelayedSearch
Re: Complete Newbie (but 25 years experience in older stuff)
Ouch, yesshaosean wrote:Klaus' message about the missing line was because I missed the line "put the result into sMySendCommandID" in my original posting.. Seems we both missed the "pass KeyDown" as well..
Re: Complete Newbie (but 25 years experience in older stuff)
aww.. You're forgiven schnucki..
-
- Posts: 19
- Joined: Thu Feb 26, 2015 7:51 am
- Location: Perth, Western Australia
- Contact:
Re: Complete Newbie (but 25 years experience in older stuff)
Ha ha, works now - sort of. If I type two letters in quick succession it flashes the result up twice the first time it flashes and disappears, then the second time shows the result (correctly) Is there a way of avoiding the first refresh ?
Thanks and cheers
John
Thanks and cheers
John
Re: Complete Newbie (but 25 years experience in older stuff)
Merci, cherie!shaosean wrote:aww.. You're forgiven schnucki..
-
- Posts: 19
- Joined: Thu Feb 26, 2015 7:51 am
- Location: Perth, Western Australia
- Contact:
Re: Complete Newbie (but 25 years experience in older stuff)
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
Cheers
John