Page 1 of 2
Trapping keystrokes outside Datagrid interfering with DG Field Editor
Posted: Sat Apr 11, 2020 3:33 am
by adxsoft
I have a keyUp handler in my datagrid group script which detects letter "A" and has code that will format the current row in my datagrid (on the same card). The keyUp handler performs some simple actions when letter "A" is detected.
DataGrid script
Code: Select all
on keyUp pKey
if pKey is "A" then
# do something, for example
put the dgHilitedLines of group "MyGrid" into tLineNo
put the dgDataOfLine[the dgHilitedLines of grp "MyGrid"] of grp "MyCard" into tArray
put "SomeValue" into tArray["Date"
dispatch "ResetList" to grp "MyGrid"
set the dgHilitedLines of grp "MyGrid" to tLineNo
end if
pass keyUp
end keyUp
This works fine however when I double click a field in the grid and type the letter "A" then the keyUp handler processes the A whereas I want it to let the A through without doing anything.
My thought is to have the keyUp handler somehow be aware that a field edit is in progress however I cannot find a way to detect this.
Any tips would be greatly appreciated.
I'm using LC9.5.1 on Mac.
Cheers
Allan
Re: Trapping keystrokes outside Datagrid interfering with DG Field Editor
Posted: Sat Apr 11, 2020 8:48 am
by richmond62
Well, how about something like this . . .
Script in datagrid:
Code: Select all
on keyDown
pass keyUp
----blah, blah, blah
end keyDown
that should mean that you can then type into the grid.
-

- Screenshot 2020-04-11 at 10.54.19.png (12.13 KiB) Viewed 11642 times
-
Nope!
HOWEVER . . . I have just set up a stack containing a single field with this code in the cardScript:
Code: Select all
on keyUp KUP
put "%" && KUP && "%" into fld "ff"
end keyUp
and this in the fieldScript:
Code: Select all
on keyUp KAP
put KAP into me
end keyUp
And when I type in the field the fieldScript over-rides the cardScript.
The stack is here:
https://www.dropbox.com/s/7npu3b67e7h7u ... e.zip?dl=0
Re: Trapping keystrokes outside Datagrid interfering with DG Field Editor
Posted: Sat Apr 11, 2020 9:46 am
by Klaus
on
keyDown
pass
keyUp
...
You really should get some (more) sleep!

Re: Trapping keystrokes outside Datagrid interfering with DG Field Editor
Posted: Sat Apr 11, 2020 11:41 am
by richmond62
You really should get some (more) sleep!
No: I should just wait until after my morning cup of coffee.

Re: Trapping keystrokes outside Datagrid interfering with DG Field Editor
Posted: Sat Apr 11, 2020 12:02 pm
by Klaus
Or that.

Re: Trapping keystrokes outside Datagrid interfering with DG Field Editor
Posted: Sat Apr 11, 2020 3:45 pm
by richmond62
Of course there is a point of view that states that attempting to help an OP is better than making sarcastic remarks.
Re: Trapping keystrokes outside Datagrid interfering with DG Field Editor
Posted: Sat Apr 11, 2020 3:55 pm
by Klaus
Yes, sure, but take a look at your first posting, especially the screenshot and the line below!
I just could not help but add this remark!
Sorry, Allan!
Re: Trapping keystrokes outside Datagrid interfering with DG Field Editor
Posted: Sat Apr 11, 2020 4:05 pm
by richmond62
Sometimes I write as I think as I do.
This does have the advantage that no-one else is going to make the goofy mistakes they have already seen me make!
And the fact that the script of the first control that gets a mouseClick will over-ride any of the same "higher up the tree"
is worth noticing . . .
While you may inherit your father's wise looks, your foolishness over-rides that.

Re: Trapping keystrokes outside Datagrid interfering with DG Field Editor
Posted: Sat Apr 11, 2020 4:19 pm
by Klaus
Not sure if the last line is just a saying or an insult!
@Allan
Sorry for our little verbal exchange!
Ok, after a bit of reading, do this, tested and works:
Code: Select all
on keyUp pKey
## We just sort out the Field Editor!
if the short name of the target = "DataGridFieldEditor" then
pass keyup
end if
if pKey is "A" then
# do something, for example
put the dgHilitedLines of group "MyGrid" into tLineNo
put the dgDataOfLine[the dgHilitedLines of grp "MyGrid"] of grp "MyCard" into tArray
put "SomeValue" into tArray["Date"
dispatch "ResetList" to grp "MyGrid"
set the dgHilitedLines of grp "MyGrid" to tLineNo
end if
pass keyUp
end keyUp
So Richmond cannot accuse me of only writing bitchy remarks anymore!

Re: Trapping keystrokes outside Datagrid interfering with DG Field Editor
Posted: Sat Apr 11, 2020 4:33 pm
by bogs
Klaus wrote: ↑Sat Apr 11, 2020 4:19 pm
So Richmond cannot accuse me of only writing bitchy remarks anymore!
When I wake up later, I'll make sure to laugh at that one ... nah, why wait?

Re: Trapping keystrokes outside Datagrid interfering with DG Field Editor
Posted: Sat Apr 11, 2020 4:42 pm
by richmond62
Klaus wrote: ↑Sat Apr 11, 2020 4:19 pm
So Richmond cannot accuse me of only writing bitchy remarks anymore!
I have never accused you of ONLY writing bitchy remarks.
And if
While you may inherit your father's wise looks, your foolishness over-rides that.
is an insult, it applies to me for starters.

Re: Trapping keystrokes outside Datagrid interfering with DG Field Editor
Posted: Sat Apr 11, 2020 4:56 pm
by Klaus
bogs wrote: ↑Sat Apr 11, 2020 4:33 pm
Klaus wrote: ↑Sat Apr 11, 2020 4:19 pm
So Richmond cannot accuse me of only writing bitchy remarks anymore!
When I wake up later, I'll make sure to laugh at that one ... nah, why wait?

Re: Trapping keystrokes outside Datagrid interfering with DG Field Editor
Posted: Sat Apr 11, 2020 4:59 pm
by Klaus
richmond62 wrote: ↑Sat Apr 11, 2020 4:42 pm
Klaus wrote: ↑Sat Apr 11, 2020 4:19 pm
So Richmond cannot accuse me of only writing bitchy remarks anymore!

I have never accused you of ONLY writing bitchy remarks.
Sorry, forgot to mention "... in this thread!"
BTW: Happy Easter!

Re: Trapping keystrokes outside Datagrid interfering with DG Field Editor
Posted: Sat Apr 11, 2020 6:34 pm
by richmond62
Not round this neck of the woods: our Easter is next week.
If this is a conceptual problem for you go and check out the Latin word
fileoque . . .
Not that, frankly I believe 'God' is either a sectarian, or a supporter of most of organised religion.
Re: Trapping keystrokes outside Datagrid interfering with DG Field Editor
Posted: Sat Apr 11, 2020 6:40 pm
by bogs
Don't look at me, I only believe in the Flying Sphagetti Monster.
