Re: Gnome2::DateEdit cant turn off time section




On Jan 28, 2008, at 3:33 AM, Mitchell Laks wrote:

Now as you mention, I do not understand the flags bit at all.

In my direct trial

my $dateedit =Gnome2::DateEdit->new(0,0,0);
my $scalar = $dateedit->get_flags;
print "my scalar is $scalar \n";

I got printed out to console:

my scalar is [  ]

which is cute, but certaily cryptic to me :(.

So do you simply put an anonymous array reference [] with the selected
flags, sort of like
[ flag1, flag2, flag3 ] ie like ['show-time','24-hr','week-starts-on- monday']
turns them on and [] alone will turn them off?

(question to self: What is the corresponding structure of this in Gtk +)


Can you point out to me where flags are talked about in
/gtk2-perl/Gtk+/
documentation.

Flags are C bitfields.  Perl handles them differently.

http://gtk2-perl.sourceforge.net/doc/pod/Glib.html#This_Is_Now_That
http://gtk2-perl.sourceforge.net/doc/pod/Gtk2/api.html#Flags_and_Enums


This business with enums/properties/flags is not fully clear in my mind.

Properties are a different beast. Do not confuse them with flags or enums.


I had more trouble for instance, sort of winging it with

my $tree_store = Gtk2::TreeStore->new(qw/Glib::String Glib::String Glib::String Glib::Int /);

where I was putting an integer into the fourth column of the tree store. Thus what would i use for float or doubles if I wanted to store them in
the table?

Again, the "This is now that" section (http://gtk2-perl.sourceforge.net/doc/pod/Glib.html#This_Is_Now_That ) lists the package names corresponding to the GLib fundamental types. They're designed to be easily guessable --- double is Glib::Double, for example.


So to illustrate my ignorance.

For instance for TreeStore the pod says

treestore = Gtk2::TreeStore->new (...)
   *
     ... (list) of strings, package names

which is cryptic to me.

The strings are the names of the packages corresponding to the column types.

It's important to understand that the API reference docs are generated by parsing the bindings' code, and exist primarily to serve as a guide to how to call the methods in Perl code. Since our team has always been small, we have not attempted to duplicate all the documentation effort from gtk+.

You could argue that specific points like this need more documentation than most others, and you'd be right. However, it's simply an issue of how much time a person has.



(could we also keep it as G_TYPE_FLOAT in case we are using perl to
prototype a future gtkmm  app (for other people to implement :))
and keep ourselves sane?)

We go out of our way to hide the concept of GType from perl code, so this is unlikely to happen. The Perl package names make a direct analogue.


So I guess "is there a way to extract this info directly from within the
gtk-perl so we can 'print out all the possible good values'".

There is no way to extract all possible values for a column type, as types are dynamically registrable.

If you put in an invalid value for an enumeration or flag type, you'll already get a listing of valid values.


Can information like this be extracted in one place centrally
directly from anything online?

http://gtk2-perl.sourceforge.net/doc/pod/Glib/Object.html#list_object_or_class

Long ago i wrote an interactive object browser, which will list the properties for you.

http://asofyet.org/muppet/software/gtk2-perl/object_browser-methodscraper


With regards to enums and flags I see different widgets in the
pod have listings

Gtk2 has a single page that lists all the values of all the enums and flags types in Gtk2 itself -- Gtk2::enums -- and each autogenerated POD page attempts to list the enum and flags types used by the methods listed in that page (it sometimes misses).


3, For flags what would list them? Syntax for using them?
Thus (Using [] will
zero them - Is it simply a anonymous  array reference?)

Glib::Type->list_values() does a fine job here, too. But still, see the Gtk2::enums manpage.




--
The Master in the art of living makes little distinction between his work and his play, his labor and his leisure, his mind and his body, his education and his recreation, his love and his religion. He hardly knows which is which. He simply pursues his vision of excellence in whatever he does, leaving others to decide whether he is working or playing. To him he is always doing both.

  -- Zen Philosophy






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