[Gambas-user] Application_mousedown() + Application_keypress() ?

Lee McPherson leemcpherson at ...626...
Mon Sep 14 01:01:21 CEST 2009



Benoît Minisini wrote:
>> I'm trying to get an application-wide mouse down event to register.  I
>> found that when I do a Form_mousedown() it only triggers when you click
>> on an empty part of the form, not when you're clicking on any type of
>> control.  I'm looking for something that will trigger whenever you hit
>> the mouse button.  (My app is going to be full screen, so I don't care
>> if it works outside of the app window or not.)
>>
>> During my searching of the list archives, I found someone tried to use
>> Application_Keypress() as a way to get a key press while the app is
>> running.  Well, I tried it and it doesn't work, nothing happens:
>>
>> Static Public Sub Application_Keypress()
>>     Message.Info(Key.code)
>> End
>>
>> I tried it on Gambas 2.8 and I even compiled Gambas 3.0 r2329 and that
>> didn't change anything.  I am using GTK only (Ubuntu).  Any ideas?
>>
>> Thanks,
>> Lee
>>
>>     
>
> There is no global pointer event handler, only Application_KeyPress(). But 
> apparently it does not work with gb.gtk... Can you try with gb.qt to see if at 
> least Application_KeyPress() is called? Note that this function must be 
> defined in the startup class!
>   
Switching to gb.qt in gambas 3 works.  Haven't tried it in 2.8 yet, but 
I don't want to use qt in any case.  Since there's no global pointer 
event handler yet, it does not matter if you fix applicaiton_keypress 
for gtk (for me at least). 

I would suggest a global pointer event handler as a feature if you have 
the time.  The reason I wanted to use it was for a feedback response 
when using a touchscreen.  Since there will be no pointer on the screen 
(and no vibrate function like on a mobile phone), I wanted to create a 
graphical response to touching (clicking) the screen with your finger (a 
pointer). 

I suppose the only workaround to this is to create a procedure and call 
the procedure for a mouse_down or mouse_up event for every control on 
the form.

Let me say that despite some of the drawbacks, this is the easiest and 
most useful tool I've ever used to do programming.  Keep up the good 
work!  When I get better at this I hope to contribute more myself.

-Lee




More information about the User mailing list