1. How to make a connection between signal_handler_event() and my
check_button1?
The same way you do:
check_button1.toggled.connect(() => { check_button1.label = "I'm toggled!" });
You can write:
check_button1.button_press_event.connect(signal_handler_event);
Please see this example in the Vala tutorial.
An alternative is:
check_button1.button_press_event.connect(
(chk, e) {
 
    if (e.type == EventButton.2BUTTON_PRESS) {
        label.label = "Ouch!";
    }
 
    return false;
});
Do you see the imagination? I truly just copy&paste.
Actually, I just removed the parameter types.

> 2. How to solve an error: "The name `EventButton' does not exist in
> the context of `signal_handler_event'"
Add "using Gdk;" line in the first lines of your code.
When ever you see this error, suspect if you use all the needed
namespaces.
You see? This is what I meant experience is the best teacher.
Tal


> A while back I started working on a Vala GTK+ tutorial in the vein of the
> classic GTK+ tutorial for C.
> 
> You can find it on
> 
> https://github.com/abenga/valagtktutorial
>  
> I managed to work on the first 7 chapters, you can find them in the */content/
> folder.*
> 
> I've held off on posting here about the effort untilI had a reasonable
> amount of content, but I'm thinking I'll probably ask for help as I've been
> really busy recently. I recently started working on porting it to Docbook
> XML, and I hope to be done in a couple of months or so.

Very good. I think it should be added into Vala wiki.

 
On 14 August 2012 14:37, Tal Hadad <[email protected]> wrote:
 
>
> > Thanks, it's really nice, but I have a few tasks already and can't
> > find, how to solve it.
> > For eample: I need to make some control invisible,
> Not quit sure what do you mean by control. Is it SpinButton? Entry? Menu?
> and so on... Please give us the Widget type or at least screen shot.
> But "control" is a Widget, you can use the "hide()" method, or set the
> visible property into false.
>
> > I need to catch
> > double-mouse-click event and change one control to another and so one.
> > Can somebody help me?
>
> button_press_event in Widget is what you need.
> There is an Gdk.EventButton parameter, usually called "e" in Vala:
> http://valadoc.org/#!api=gdk-3.0/Gdk.EventButton
> It contains all information you need, including what type of click it was.
> This is an example method for this event:
> bool signal_handler_event(Widget widget, Gdk.EventButton e)
> {
> if (e.type==EventButton.2BUTTON_PRESS) {
> // Something
> }
>
>   return FALSE;
> }Yours
> Tal
>
> > Date: Tue, 14 Aug 2012 16:59:19 +0600
> > Subject: Re: [Vala] How can I get information about vala & gtk?
> > From: [email protected]
> > To: [email protected]
> >
> > Thanks, it's really nice, but I have a few tasks already and can't
> > find, how to solve it.
> > For eample: I need to make some control invisible, I need to catch
> > double-mouse-click event and change one control to another and so one.
> > Can somebody help me?
> >
> > 2012/8/14 Tal Hadad <[email protected]>:
> > >
> > > I'll give you the magic trick:
> > > Look at the examples and when you find some example interesting,
> > > start to twick the code.
> > > Only experience can truly teach you.
> > > It works for me, hope it will work for you.
> > >
> > > See for example, the GTK example:
> > > https://live.gnome.org/Vala/GTKSample
> > > I'll give you homework if you want with this examples:
> > > * Basic Sample: After the first click, when the text is changed into
> > > "Thank you", the next click will make the window to exit.
> > > * Synchronizing Widgets: Add a nice restore default button with blue
> background.
> > > * Creating a Dialog: Add a button with clear the text in the entry.
> > >
> > > I don't tell you how to do it, you'll have to search the web.
> > > Do what ever you want to do with them. Pick an interesting task
> > > and perform it by your need.
> > >
> > > Hope you found my response useful.
> > > Tal
> > >
> > >> Date: Tue, 14 Aug 2012 16:25:12 +0600
> > >> From: [email protected]
> > >> To: [email protected]
> > >> Subject: [Vala] How can I get information about vala & gtk?
> > >>
> > >> Hi all,
> > >> I'm extremely new in vala, I've wrote almost all documentation about
> > >> vala, sqlite and gtk etc, but still have many questions how gtk+ and
> > >> vala works. It's a newbie questions but I need to ask it somebody who
> > >> cant me  help. How can I get it?
> > >> _______________________________________________
> > >> vala-list mailing list
> > >> [email protected]
> > >> https://mail.gnome.org/mailman/listinfo/vala-list
> > >
> > >
> > > _______________________________________________
> > > vala-list mailing list
> > > [email protected]
> > > https://mail.gnome.org/mailman/listinfo/vala-list
> > >
>
>
> _______________________________________________
> vala-list mailing list
> [email protected]
> https://mail.gnome.org/mailman/listinfo/vala-list
>
>

_______________________________________________
vala-list mailing list
[email protected]
https://mail.gnome.org/mailman/listinfo/vala-list                               
          
_______________________________________________
vala-list mailing list
[email protected]
https://mail.gnome.org/mailman/listinfo/vala-list

Reply via email to