Real Software Forums

The forum for Real Studio and other Real Software products.
[ REAL Software Website | Board Index ]
It is currently Sat Aug 19, 2017 5:24 pm
xojo

All times are UTC - 5 hours




Post new topic Reply to topic  [ 6 posts ] 
Author Message
 Post subject: Bizzare "You pressed the space bar!" alert
PostPosted: Thu May 30, 2013 8:17 am 
Offline

Joined: Fri Jan 08, 2010 9:59 am
Posts: 315
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?


Top
 Profile  
Reply with quote  
 Post subject: Re: Bizzare "You pressed the space bar!" alert
PostPosted: Thu May 30, 2013 12:55 pm 
Offline

Joined: Sun Feb 28, 2010 4:14 am
Posts: 37
viewtopic.php?t=46197


Top
 Profile  
Reply with quote  
 Post subject: Re: Bizzare "You pressed the space bar!" alert
PostPosted: Fri May 31, 2013 12:16 am 
Offline

Joined: Mon Aug 15, 2011 10:25 pm
Posts: 293
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

_________________
Real Studio 2012r1.1 | MacBook Pro i5, 10.6.8 | Windows 7


Top
 Profile  
Reply with quote  
 Post subject: Re: Bizzare "You pressed the space bar!" alert
PostPosted: Fri May 31, 2013 3:50 am 
Offline

Joined: Fri Jan 08, 2010 9:59 am
Posts: 315
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)


Top
 Profile  
Reply with quote  
 Post subject: Re: Bizzare "You pressed the space bar!" alert
PostPosted: Fri May 31, 2013 11:33 pm 
Offline

Joined: Mon Aug 15, 2011 10:25 pm
Posts: 293
Mac, MAC is something else ;-)

_________________
Real Studio 2012r1.1 | MacBook Pro i5, 10.6.8 | Windows 7


Top
 Profile  
Reply with quote  
 Post subject: Re: Bizzare "You pressed the space bar!" alert
PostPosted: Sat Jun 01, 2013 2:36 am 
Offline

Joined: Fri Jan 08, 2010 9:59 am
Posts: 315
Yada, yada...

I think you know what I mean :wink:


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 6 posts ] 

All times are UTC - 5 hours


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group