Re: Some differences between Gtk and Gtk2



goran kirra net writes:

Guillaume did not comment on the '-' vs '_' issue,
Gtk+ documentation says '-' so why use anything else?

There is no conversion done in Gtk2 that I know of; hence, for
example, the "type" field of the events are extracted and sent
back as-is, for button-press-event program will give
'button-press'. There is no point in converting to '_' since
documentation says '-' and gtk sourcecode effectively enumerates
the types with '-'.

However, please note that when inputing enums, both gtk2 (for
signal names) and gtk2-perl (for enums and flags to pass for
functions) work correctly when using either '-' or '_'.


In Perl, for signal names, I would use button_press_event rather
than the form with '-', because it allows omitting the simple or
double quotes, like:

$tree_view->signal_connect(button_press_event => sub { .. });

Perl will correctly convert the bareword to a string. Granted,
there can be confusion because when extracting the type of the
event, gtk sends it back in the '-' form, as discussed above.


-- 
Guillaume Cottenceau - http://people.mandrakesoft.com/~gc/



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]