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

Benoît Minisini gambas at ...1...
Sat Jan 23 12:10:09 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.

Apparently it's fixed in Gambas 2.19.

> * FTEST: Within FTest the Form_KeyPress Event seems to be not working at
> all, but within FMain the KeyPress event is spawned correctly.

Same thing, fixed in Gambas 2.19.

> * 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.

Fixed too!

> 
> 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?

I think it is fixed too. :-)

I suggest a Gambas upgrade. If you are an Ubuntu user, and want Gambas binary 
packages for that, I suggest some lobbying against Ubuntu for that!

Regards,

-- 
Benoît Minisini




More information about the User mailing list