[Gambas-user] GTK - Form Events - Strange behaviours

Benoît Minisini gambas at ...1...
Wed Jan 20 19:44:28 CET 2010


> Hi everybody,
> I can't understand some behaviours, as reported in the subject.
> 
> I'm using Gambas 2.13 from Ubuntu 9.10 64bit.
> The project uses only gtk.
> 
> I've created a Form, FTest, that contains five components: three labels,
> one picture and a timer.
> 
> This is my (trivial) code:
> ''''''''''''''''''''' FTest ''''''''''''''''''''''''''''''
> PUBLIC SUB Form_MouseDown()
>   ME.Close(0)
> END
> 
> PUBLIC SUB Form_KeyPress()
>   IF Key.Code = Key.Esc THEN
>     ME.Close(0)
>   ENDIF
> END
> 
> PUBLIC SUB Form_Open()
>   tmr.Enabled = TRUE
> END
> 
> PUBLIC SUB Form_Close()
>   tmr.Enabled = FALSE
> END
> 
> 
> Another Form, FMain, creates an instance of FTest through this code:
> '''''''''''''''''''''' FMain ''''''''''''''''''''''''''
> PUBLIC SUB Form_KeyPress()
>    DIM ftst AS NEW FTest
>    DIM nResult AS Integer
>    IF Key.code = Key["T"] AND Key.Control THEN
>       nResult = ftst.ShowModal()
>    ENDIF
> END
> 
> The problems that I'm experiencing:
> 
> * FMAIN: ftst.ShowModal() method creates a modal window but if I click
> on any point of the FMain window the ftst form gets closed.
> * FTEST: Within FTest the Form_KeyPress Event seems to be not working at
> all, but within FMain the KeyPress event is spawned correctly.
> * FTEST: Form_MouseDown Event is spawned only if I click on the picture
> control or on the label controls. It doesn't work if I click on the Form
> surface. It should be the opposite, I think.
> 
> During some tests I made (always with gtk), I've seen that if there is
> no button controls on the Form, the KeyPress event is not spawned. Is
> this a right behaviour?
> 
> Using qt I haven't problems like these but, if it's possible, I would
> continue to develop using gtk.
> 
> Have You any ideas? I'm doing something wrong?
> 
> I hope I was understandable.
> 
> Tnx in advance.
> --
> Matteo
> 

Can you send your project?

-- 
Benoît Minisini




More information about the User mailing list