Real Software Forums
http://forums.realsoftware.com/

Bizzare "You pressed the space bar!" alert
http://forums.realsoftware.com/viewtopic.php?f=1&t=48021
Page 1 of 1

Author:  seanclancy [ Thu May 30, 2013 8:17 am ]
Post subject:  Bizzare "You pressed the space bar!" alert

I have some bizarre things going on with the above alert going off.
RS 2012.2
I also have an HTMLViewer page on my window and it's running webkits.
The HTMLViewer displays a graphic and then I set the focus to the main window.

In my keydown of my main window I have an event do do something when I press the spacebar.

However, I press the spacebar and it doesn't even get as far as keydown (I set a breakpoint to check that)
Instead an alert pops up saying "You pressed the spacebar!"
There are NO msgbox commands in my window!
If I press spacebar again after closing the alert, it goes to the keydown event on my page...

Anybody knows about this problem and how to fix this?

Author:  gre [ Thu May 30, 2013 12:55 pm ]
Post subject:  Re: Bizzare "You pressed the space bar!" alert

viewtopic.php?t=46197

Author:  shaosean [ Fri May 31, 2013 12:16 am ]
Post subject:  Re: Bizzare "You pressed the space bar!" alert

This is JavaScript and goes in the webpage (you can always inject the code if the original html page is not under your control)..

document.addEventListener('keydown', function (event) {
var tSpace = event.which == 32,
el = event.target,
input = el.nodeName != 'INPUT' && el.nodeName != 'TEXTAREA',
tStopPropagation = false;

if (input) {
if (tSpace) {
window.status = 'space'; // callback to RealStudio so we can stop the MsgBox
tStopPropagation = true;
}

// this is to reset it to allow this command to work again
// if we just clear out the 'space' status with an empty string, it does not work after the first time
window.status = '-';

if (tStopPropagation) {
event.preventDefault();
event.stopImmediatePropagation();
}
}
}, true);



This is the code in the StatusChanged event

Sub StatusChanged(newStatus as String)
if (newStatus = "space") then
// you need to declare the variable first and then set its value, you cannot do this in a single line
DIM tMoo As String
tMoo = "cow"
end if
End Sub

Author:  seanclancy [ Fri May 31, 2013 3:50 am ]
Post subject:  Re: Bizzare "You pressed the space bar!" alert

Thanks, I'll try that out...

So, according to the article, this won't be a problem when Xojo comes out (1 week).

I am hoping that Xojo does NOT break my code. I rely on a few "depreciated" commands (such as editmovie and move.startselection as well as various quicktime functions (MBS) that are vital to my software.

However, this does mean that I can edit my MAC version so that it can catch up to my windows version (yes MAC fanboys - windows does some things better than MAC)

Author:  shaosean [ Fri May 31, 2013 11:33 pm ]
Post subject:  Re: Bizzare "You pressed the space bar!" alert

Mac, MAC is something else ;-)

Author:  seanclancy [ Sat Jun 01, 2013 2:36 am ]
Post subject:  Re: Bizzare "You pressed the space bar!" alert

Yada, yada...

I think you know what I mean :wink:

Page 1 of 1 All times are UTC - 5 hours
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/