Re: Locating child-widgets (by name) without Glade-code [EOT by my side]
- From: "Waldek Maleska" <progss interia pl>
- To: <gtk-app-devel-list gnome org>
- Subject: Re: Locating child-widgets (by name) without Glade-code [EOT by my side]
- Date: Mon, 18 Aug 2003 18:24:07 +0200
From: "Gus Koppel" <gtk spamkiller bytechase cx>
Please have a look at
http://www.spamkiller.bytechase.cx/democode/widget_find_by_name.c. I
doubt a hashtable-based maintain-and-locate solution could be smaller
than my single 40-lines function. It actually achieves what I want,
without any extra resources or protocols to track / abide.
I'll take a look at your solution, it might be helpful some way :)
But if it is based on linear search - and that's what you mentioned
previously - it's definitely a reason to _not_ use it, algorithm
complexity is too high.
a) Linear search is O(n) - IMO it's definitely not enough.
b) Using a hash table should be O(n/k) or better (even O(1)).
c) Using simple local and global variables/pointers is O(1).
I'd rather use c).
Of course it's just my opinion and I'm no "mastahaka" ;-)
With a small number of widgets it can be acceptable.
I don't know much about widget's names, except for the docs:
"Widgets can be named, which allows you to refer to them from a
gtkrc file. You can apply a style to widgets with a particular name
in the gtkrc file. See the documentation for gtkrc files (on the same
page as the docs for GtkRcStyle)."
.../gtk/GtkWidget.html#gtk-widget-set-name
Glade uses them anyway. However if _Owen_ says something about
them, I believe he knows what he says :-)
Best regards,
Waldek Maleska
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]