Re: Placing a new box in a button at runtime
On Sat, 22 Apr 2000, Jeff Shipman wrote: > I've got a button which has a box placed in it. If I > wanted to re-create a new box and place it in the container > at runtime, what would I need to do? just gtk_widget_destroy(GTK_BIN(button)->child) and button should be ready for packing widgets into it again. > -- > +-+ > | Jeff "Shippy" Shipman E-Mail: [EMAIL PROTECTED] | > | Computer Science MajorICQ: 1786493 | > | New Mexico Institute of Mining and Technology | > | Homepage: http://www.nmt.edu/~shippy| > +-+ > > ___ > gtk-list mailing list > [EMAIL PROTECTED] > http://mail.gnome.org/mailman/listinfo/gtk-list > Best regards, -Vlad ___ gtk-list mailing list [EMAIL PROTECTED] http://mail.gnome.org/mailman/listinfo/gtk-list
Re: callback parameters
On Fri, 19 May 2000, Jeff Edwards wrote: > Could someone please explain to me why it is reasonable to connect > gtk_widget_destroy() to a button clicked signal, when > gtk_widget_destroy() takes only one parameter? > > As far as I can tell by reading the GTK+ source code, the callbacks for > button clicked signals (and every signal, for that matter) _always_ get > called with at least two arguments. Won't calling a function that > expects only one argument potentially screw up the stack? Admittedly, it > seems of work OK in actual practive, but is it really legitimate? It seems that all C compilers conform to de-facto standard of cleaning the stack by the caller, and since the caller knows how much parameters were pushed, all works fine. This de-facto standard seems to originate due to C's support of functions with variable number of arguments like printf. Seems any CPU/compiler vendor understands that so systems for which this technique will break do not exist (I hope). > Thanks, > Jeff Edwards Best regards, -Vlad ___ gtk-list mailing list [EMAIL PROTECTED] http://mail.gnome.org/mailman/listinfo/gtk-list
Re: (no subject)
On Sat, 3 Jun 2000, Cesar Suarez C. wrote: Hi > > > > Hi,! well, Im a newbie and I thought that maybe someone out there would > like to help me out. > > this is my problem. > Im using a GList that has it "data(void *) pointing to some Note objects > that I created. > I use the func g_list_nth_data that returns a gpointer. to those objects > > I declared a pointer to the Note objects pNote. > I try to do something like this: > pNote temp; > temp=(pNote)g_malloc(sizeof (struct Note)); > temp=g_list_nth_data(noteList, position); ->error line Just use temp=(pNote)g_list_nth_data(noteList, position); since g_list_nth_data returns (void*) and you assign the return value to the variable of type Pnote. > (noteList's a GList *). > > when compiling I get this error message: (compiling with g++ since gotta > compile the classes, etc). > ANSI C++ forbids implicit conversion from `void *' in assignm > ent . > Error 1. > > > dose ANYBODY knows a way to avoid this error...and WOULD like to help me > ..plz! as I said Im a newbie..and I hope my question doesnt disturbs > anybody. > > Cesar > Best regards, -Vlad ___ gtk-list mailing list [EMAIL PROTECTED] http://mail.gnome.org/mailman/listinfo/gtk-list
Re: GtkEntry Cursor
On Tue, 6 Jun 2000, Tal Rosen wrote: Hi, > Thanks for the respond, but I forgot to mention I also did > gtk_widget_set_sensitive( GtkEntry , FALSE ); > the GtkEntry cannot be selected, so there is not reason for the control to > change the cursor to GDK_XTERM! I already filed a bugreport/wishitem about the need to use another cursor for disabled GtkEntry. But the cursor for disabled GtkEntry should tell somehow that user can cut the text - so it shouldn't be usual cursor. > I even tried to gdk_window_set_cursor( GtkEntry , GDK_X ) > and it only changed the cursor for the border of the window, the inside > window is still always changed to GDK_XTERM ?! > > > > Tal Rosen. > CC to: [EMAIL PROTECTED] > >[...] Best regards, -Vlad ___ gtk-list mailing list [EMAIL PROTECTED] http://mail.gnome.org/mailman/listinfo/gtk-list
Re: Forcing focus to a GtkEntry
On Tue, 13 Jun 2000, Gian Luigi Gragnani wrote: Hi, > Hello all > I have the following problem: > I have a window with many entries and I want to validate the text in an > entry > when the focus-out signal is received, and force the focus to stay in > the same entry if its present text is not valid. > I have tried gtk_widget_grab_focus but it works when just one entry has > to be checked; instead, if the focus is passed to another entry needing > validation > the is a sort of oscillation between the two entries (both trying of > gaining focus) and the system become unusable. > Do you know a possible soluiton to this problem Seems gtk functions correctly - it behaves as you directed to it - on leaving entry the focus is returned back to it. So your approach is incorrect. I in such cases connect to "changed" signal of all entries in the form the same validating function that will validate ALL entries in the form and will disable "OK" button if any is invalid (it could change the color of the text of entries with bad content as well). Yes, it's very resource consuming compared to only checking the entry that just changed, but in total even validation of entire form on each keypress takes very small CPU time. > Thank you in advance. > > > G. L. Gragnani > -- > Gian Luigi Gragnani DIBE - University of Genoa > Via Opera Pia 11A 16145 Genova Italy > Tel. + 39 010 353 2244 Fax+ 39 010 353 2245 > mailto:[EMAIL PROTECTED] > > ___ > gtk-list mailing list > [EMAIL PROTECTED] > http://mail.gnome.org/mailman/listinfo/gtk-list > Best regards, -Vlad ___ gtk-list mailing list [EMAIL PROTECTED] http://mail.gnome.org/mailman/listinfo/gtk-list
support for passing the filename of default resource file on thecommandline
Hi, Seems this is not the proper place to post wishitems on gtk, but anyway (just want gtk developer notice this before gtk-1.4) - wouldn't it be nice if yet another commandline switch accepted by gtk_init existed (like --gtkrc=FILE) that specifies the gtk rc file (aka "theme") to be loaded instead of default? Best regards, -Vlad ___ gtk-list mailing list [EMAIL PROTECTED] http://mail.gnome.org/mailman/listinfo/gtk-list
Re: Problem w/gtk install
On Sun, 25 Jun 2000, salvador peralta wrote: > I recently set up a linux system running Mandrake 7.1. As part of the > install, I got gtk+-1.2.7.1, gtk+-devel.1.2.7-1, glib-1.2.7-1, > glib-devel-1.2.7-1. My first compile (base.c from the tutorial), kept > failing due to the following errors: > > salvador ]$ gcc base.c -o base 'gtk-config --cflags --libs' This should be gcc base.c -o base `gtk-config --cflags --libs` i.e. backticks instead of single quotes. This was the source of all your problems. >[...] Best regards, -Vlad ___ gtk-list mailing list [EMAIL PROTECTED] http://mail.gnome.org/mailman/listinfo/gtk-list
Re: Russian keyboard and arrows
On Mon, 26 Jun 2000, Ron Martin wrote: > Hello, > > I recently received an e-mail from someone that is using some software > that I have written. This person is complaining about the arrow keys > not doing anything in the program. I am not able to reproduce this > problem. However, I am using a U.S. keyboard layout and the person is > probably using some other keyboard mapping, being from Russia. Is this > a possibility? Is there something I can do to fix this? Any help would > be appreciated. Hi, I'm from Russia (though I haven't configured my X Windows for cyrillic input yet). The most common cause of such problems is when in key_press_event signal handler the exact value of GdkEventKey->state is examined, like ((*GdkEventKey)e)->state == GDK_MOD1_MASK ) instead of testing whether the corresponging bit is set, like in ((*GdkEventKey)e)->state & GDK_MOD1_MASK ) or even better ((*GdkEventKey)e)->state & GDK_MOD1_MASK ) == GDK_MOD1_MASK If your code uses the first variant of the code, it won't work as expected if any other modifier is pressed - so I suggest you to test you program with Numlock and/or Capslock pressed. Porbably when current input language is set to russian some bit in ((*GdkEventKey)e)->state) is set - so your program won't work if you used 1st variant of the code. You can contact me privately for more information if you wish. > Thanks. > > Ron Martin > [EMAIL PROTECTED] > > ___ > gtk-list mailing list > [EMAIL PROTECTED] > http://mail.gnome.org/mailman/listinfo/gtk-list > Best regards, -Vlad ___ gtk-list mailing list [EMAIL PROTECTED] http://mail.gnome.org/mailman/listinfo/gtk-list
Re: Keys in gtk 1.2.8
On Fri, 30 Jun 2000, Dennis Bjorklund wrote: > If you have a entry widget where all the text is selected and I press > right I would expect the selection to disapear and the cursor to be at > the right limit of the selection. Similary with left of course. As for GtkEntry - the selection will be cleared, but the cursor won't jump to oposite side of former selection. I think this is more intuitive than windows' behaviour (of jumping to oposite end of former selection). > If the cursor is already on the last position and I press right then > nothing happens at all. The selection does not disapear like it do if > the cursor is not on the last position. Yes, I think that selection should disappear in this case - it's more useful. > To me this looks like bugs rather then by design. > > Then I wonder if there is any keys to jump to the next word (windows > uses shift-arrow, but we select with shift-arrow). If there isn't any, > then why not? Some people are really used to move the cursor one word > at the time. What are you talking about? You can't move by words with shift-arrow under windows - you can do it using control-arrow (and this works fine with gtk too). In general, my impression is that .gtkrc syntax should be slightly extended to allow setting options (that control behaviour, not appearance). I guess this isn't done yet since authors wished to override options by widget class (using pattern matching) like other widget sets that use X resources, but that would require a lot of efforts, so the implementation of this was postponed. > -- > /Dennis > > > ___ > gtk-list mailing list > [EMAIL PROTECTED] > http://mail.gnome.org/mailman/listinfo/gtk-list > Best regards, -Vlad ___ gtk-list mailing list [EMAIL PROTECTED] http://mail.gnome.org/mailman/listinfo/gtk-list
Re: Problem
On Wed, 28 Jun 2000, Gergely Pongracz wrote: > Hi GTK and/or C++ gurus! > > Does anybody know, what is wrong, when the program is get killed > with a segmentation fault signal, and gdb says the following: > > #0 0xef246178 in realfree () > #1 0xef24699c in cleanfree () > #2 0xef245bf8 in _malloc_unlocked () > #3 0xef245b00 in malloc () > #4 0x25600 in ___builtin_new (sz=32) > #5 0x25634 in ___builtin_vec_new (sz=32) > #6 0x21cb4 in appendRow (nr=1) at gui.cc:504 > #7 0x24210 in fillConnTypeList () at gui.cc:248 > #8 0x1cbf8 in sourceOK (menuItem=0x2ac00, null=0x0) at > conntypeconf.cc:293 > #9 0xef64cb78 in gtk_marshal_NONE__NONE (object=0x7c428, > func=0x1c798 , func_data=0x0, > > args=0xefffdff0) at gtkmarshal.c:312 > #10 0xef68f0f0 in gtk_handlers_run (handlers=0x65b58, > signal=0xefffdf50, > object=0x7c428, params=0xefffdff0, after=0) at > gtksignal.c:1909 > #11 0xef68df6c in gtk_signal_real_emit (object=0x7c428, > signal_id=83, > params=0xefffdff0) at gtksignal.c:1469 > #12 0xef68afdc in gtk_signal_emit (object=0x7c428, signal_id=83) > at gtksignal.c:552 > > etc. etc. > > I just can't imagine, what is going on, because there is only an > initialization at the prompted line: > > row[0] = new char[32]; (Where row is a char *[4] structure) Most probably memory heap was corrupted so that function that was called by operator 'new' crashed - it could happen if you free same location more than once, for example. You should check all calls to memory routines (probably using debugging malloc library). If you use glibc, try setting env var MALLOC_CHECK_ to 1 - in that case malloc will print diagnostic messages for errors it can detect (see man malloc). > Thanks for any help in advance! > Bye! > > Gergely Pongracz > (Technical University of Budapest - Hungary) > > > ___ > gtk-list mailing list > [EMAIL PROTECTED] > http://mail.gnome.org/mailman/listinfo/gtk-list > Best regards, -Vlad ___ gtk-list mailing list [EMAIL PROTECTED] http://mail.gnome.org/mailman/listinfo/gtk-list
Re: Keys in gtk 1.2.8
On 30 Jun 2000, Havoc Pennington wrote: > > Vlad Harchev <[EMAIL PROTECTED]> writes: > > In general, my impression is that .gtkrc syntax should be slightly extended > > to allow setting options (that control behaviour, not appearance). I guess > > this isn't done yet since authors wished to override options by widget class > > (using pattern matching) like other widget sets that use X resources, but that > > would require a lot of efforts, so the implementation of this was postponed. > > > > .gtkrc already allows you to change key bindings, but GtkEntry doesn't > support it yet, only GtkCList. Sadly it appears this is still true in > the development version of GTK. The new text widget does support this, > however. Sorry for confusion - I meant that something behind appearance and keybinding should be controllable in .gtkrc (in my previous mail, I stated that only appearance can be controlled in it). An examples of settings that it would be nice to control in .gtkrc, that control behaviour or feel of various gtk components: * whether '.' is shown among directories in file sel window * default dimensions of filesel windows * default locale of fonts for gtk font sel widget, probably it's size * default delay for tooltips * probably default style for notebooks * a lot of other settings that are introduced by various hacks to gtk code > Havoc > Best regards, -Vlad ___ gtk-list mailing list [EMAIL PROTECTED] http://mail.gnome.org/mailman/listinfo/gtk-list
Re: Keys in gtk 1.2.8
On Sat, 1 Jul 2000, Dennis Bjorklund wrote: > On Fri, 30 Jun 2000, Vlad Harchev wrote: > > > What are you talking about? You can't move by words with shift-arrow under > > windows - you can do it using control-arrow (and this works fine with gtk > > too). > > You are right that it is control-shift, my mistake. But that doesn't work > either. I tried it in a lot of programs, for example gnumeric 0.56 and > nothing happens. No, control-shift won't work - control-arrow will. As for gnumeric - it doesn't use GtkEntry or GtkText for cells so it's completely different topic. Ask gnumeric's developers about adding control-arrow for movement by words. But control-arrow works fine for me in GtkEntry widgets (for example in entry of "Gnome foot"->"Run program.." of gnome desktop). > But I looked in the code and sure, there are code for control-shift. Maybe > sawfish or gnome or something is overiding this on my computer then. > > /Dennis > > > ___ > gtk-list mailing list > [EMAIL PROTECTED] > http://mail.gnome.org/mailman/listinfo/gtk-list > Best regards, -Vlad ___ gtk-list mailing list [EMAIL PROTECTED] http://mail.gnome.org/mailman/listinfo/gtk-list
Re: localization_gtk+
On Wed, 5 Jul 2000, klishin wrote: Hi, > Hello ALL, > We need to put to form (label) (for interface) a message on the > national (russian) Language in GTK win32 application. > Hawewer these messages is not put to form. What are possibility > reasons? How to correct this? Do you mean that the code like this gtk_box_pack_start(somebox,gtk_label_new("some text in russian"),1,1,1); adds nothing to 'somebox' gtk_box_pack_start(somebox,gtk_label_new("some text in english"),1,1,1) adds the label with text "some text in english" as expected? If yes, then clearly it's a bug in gtk-win32. Otherwise, explain your problem further. > > -- > Best regards, > klishin mailto:[EMAIL PROTECTED] > > > > ___ > gtk-list mailing list > [EMAIL PROTECTED] > http://mail.gnome.org/mailman/listinfo/gtk-list > Best regards, -Vlad ___ gtk-list mailing list [EMAIL PROTECTED] http://mail.gnome.org/mailman/listinfo/gtk-list
Re: Window decorations
On Wed, 5 Jul 2000, Omar Barneto wrote: > > How can I set window decorations different from their default? For > example, how can I eliminate borders from a TOP_LEVEL window, or how can > I add borders to a POPUP window? I'm using Enlightenment as window > manager. > I used the gtk_window_set_decoration(GdkWindow ^d > *w,GdkWMDecoration)function > but it didn't work I haven't used this function at all, but I guess you pass GtkWindow instead of GdkWindow as the 1st argument of this function. Try gdk_window_set_decorartions(GTK_WIDGET(widget)->window,GdkWMDecoration) > Thanks for any help. > > Omar. > > ___ > gtk-list mailing list > [EMAIL PROTECTED] > http://mail.gnome.org/mailman/listinfo/gtk-list > Best regards, -Vlad ___ gtk-list mailing list [EMAIL PROTECTED] http://mail.gnome.org/mailman/listinfo/gtk-list
Re: eventbox
On Fri, 7 Jul 2000, Niklas Höglund wrote: Hi, > Hi! > I have some trouble using eventbox'es. > > I create a eventbox and I connect a signal to it... > > >gtk_signal_connect (GTK_OBJECT(event_box), "button_press_event", > >GTK_SIGNAL_FUNC (gw), GINT_TO_POINTER(var)); > > but when in the gw() function print the var it is wrong... > > g_print("got: %d \n", GPOINTER_TO_INT(data)); > > (see eventbox.c that I've attached) > > Anyone have any clue what I've done wrong? Your 'gw' function is defined as follows in your code: void gw(GtkWidget *widget, gpointer data) { g_print("got: %d \n", GPOINTER_TO_INT(data)); } But for "button_press_event" signal the callback prototype expected is gboolean gw(GtkWidget *widget, GdkEventButton *event, gpointer user_data); So redeclare your 'gw' this way and all should work as expected. > //Mvh Niklas > Best regards, -Vlad ___ gtk-list mailing list [EMAIL PROTECTED] http://mail.gnome.org/mailman/listinfo/gtk-list
Re: Static compiling
On Fri, 7 Jul 2000, Nikhil Bhavadas K. wrote: > How can I statically compile a gtk based program? When I compile a simple > program having buttons error messages like > "Gtk-WARNING **: Unable to locate image file in pixmap_path:button_pressed.png > line 498" > is displayed. I didn't understand you. Do you get this message when you statically link it, and asking how to link it statically in order this message to disappear? If you link it dynamically - does it appear? Anyway, I guess this message has nothing to do with static linking - it looks like you have a broken gtk theme. Try using another one - I hope it will disappear. Other possible cause - is when you use some gnome's function for opening pixmap, and that function only looks into pixmap_path setting and doesn't find it. > What I did was to add the `static' flag to gcc. > Thanks in advance. > -- > "Once a satyâgrahi, always a satyâgrahi" > Nikhil Bhavadâs K. <[EMAIL PROTECTED]> > <[EMAIL PROTECTED]> > > ___ > gtk-list mailing list > [EMAIL PROTECTED] > http://mail.gnome.org/mailman/listinfo/gtk-list > Best regards, -Vlad ___ gtk-list mailing list [EMAIL PROTECTED] http://mail.gnome.org/mailman/listinfo/gtk-list
Re: accelerated buttons
On Tue, 11 Jul 2000, xander wrote: > > On Tue, Jul 11, 2000 at 12:20:03AM +0200, xander wrote: > > > Are accelerated buttons available? E.g. like with GtkItemFactory > > > "_OK" & "_Cancel" with gtk_label_parse_uline stuff. > > > > Yes. > > > > It's a bit of a pain in GTK+ to add that type of accelerator (they're > > called "mnemonics" in Windows and Motif, to distinguish them from > > "accelerators" not tied to a letter of the label, e.g. Ctrl+C for > > "copy", although Qt calls 'em both "accelerators" as GTK+ does). > > Cool! Between my post and yours I figured out the same thing :) > Now, here's the real pain: > > I've got a 'mnemonic' button with GDK_Delete accelerator tight the same > way you described onto the main window. > > Apparently the clist widget catches this button and I'm left with nothing > (i.e. I don't know when it's pressed). Similar situations occur with other > keys. How do I rebind these keys from clist to one of my own button in > order to get GDK_Delete to send a "clicked" signal for my button? The only way to do this is to catch "key-press-event", compare the key with GDK_Delete and manually emit "clicked" signal for that button if it's GDK_Delete. > Regards, > xander > >[...] Best regards, -Vlad ___ gtk-list mailing list [EMAIL PROTECTED] http://mail.gnome.org/mailman/listinfo/gtk-list
Re: Gtk-WARNING **: Unable to locate loadable module in module_path:"libpixmap.so"
On Wed, 12 Jul 2000, David Frascone wrote: > I have looked in all the archvies, and see a few people ask about this error, > but none of their questions were ever asked. > > The library does exist, it /usr/lib/gtk/themes/engines. I've tried pointing > module_path to it via the following line in my .gtkrc: > > module_path "/usr/lib/gtk/themes/engines" > > I've even tried adding that path to my ld.so.conf. No luck. Please tell me > what I'm doing wrong. > > gtk-version: 1.2.8 > glib-version: 1.2.8 I didn't have such problem, but is it owned by root and has access rights "rwxr-xr-x" - I recall something about linux dynamic loader that requires *.so to have execute persmissions for everybody. HTH Best regards, -Vlad ___ gtk-list mailing list [EMAIL PROTECTED] http://mail.gnome.org/mailman/listinfo/gtk-list
Re: Gtk-WARNING **: Unable to locate loadable module in module_path:"libpixmap.so"
On Thu, 13 Jul 2000, David Frascone wrote: > Wups . . got chopped. > > On Thu, Jul 13, 2000 at 08:48:59AM -0500, David Frascone wrote: > > > I didn't have such problem, but is it owned by root and has access rights > > > "rwxr-xr-x" - I recall something about linux dynamic loader that requires *.so > > > to have execute persmissions for everybody. > > > > > Here's mine :) > > [chaos@chaos chaos]$ ls -l /usr/lib/gtk/themes/engines > > : > > : > > : > > -rwxr-xr-x1 root root 784 Apr 5 07:01 libpixmap.la > > -rwxr-xr-x1 root root 216930 Apr 5 07:01 libpixmap.so > > : > > : > > : > > In original message, you've stated that you added module_path "/usr/lib/gtk/themes/engines" to your gtkrc. But it seems that you should use module_path "/usr/lib/gtk/themes/" for your file layout (I see this looking at the comments in gtkrc's of various themes). Please try this and report. If it still doesn't work: Did you compile libpixmap.so yourself (what is your distro)? If I were you, I would try the following then: 1) Get compiled libpixmap.so from any other place (i.e. from RedHat - it's in gtk-engines.rpmor something like this) and try it. 2) If 1) is not acceptable - may be your libgtk.so and libpixmap.so are compiled by different versions of gcc (and probably linked with different versions of glibc), so try to compile them with the same compiler (and probably without all optimizations). HTH > ___ > gtk-list mailing list > [EMAIL PROTECTED] > http://mail.gnome.org/mailman/listinfo/gtk-list > Best regards, -Vlad ___ gtk-list mailing list [EMAIL PROTECTED] http://mail.gnome.org/mailman/listinfo/gtk-list
Re: Gtk-WARNING **: Unable to locate loadable module in module_path:"libpixmap.so"
On Thu, 13 Jul 2000, David Frascone wrote: > Hmm . . .strange . . .seems that a theme did it. If I remove my .gtkrc, it > works fine. Here is the offensive .gtkrc If you remove .gtkrc, it seems that gtk+ will use default theme that doesn't require pixmap engine - so this is the reason the message disappears. Could you try restoring your original .gtkrc shown below, and add module_path "/usr/lib/gtk/themes/" to it and report results. > # -- THEME AUTO-WRITTEN DO NOT EDIT > include "/home/chaos/.themes/DarkMarble/gtk/gtkrc" > > style "user-font" > { > font="-adobe-helvetica-medium-r-normal-*-*-120-*-*-p-*-iso8859-1" > } > widget_class "*" style "user-font" > > include "/home/chaos/.gtkrc.mine" > > # -- THEME AUTO-WRITTEN DO NOT EDIT > > .gtkrc.mine does not exist, and DarkMarble's gtkrc does not modify the > module_path > > On Thu, Jul 13, 2000 at 07:10:45PM +0500, Vlad Harchev wrote: > > On Thu, 13 Jul 2000, David Frascone wrote: > > > > > Wups . . got chopped. > > > > > > On Thu, Jul 13, 2000 at 08:48:59AM -0500, David Frascone wrote: > > > > > I didn't have such problem, but is it owned by root and has access rights > > > > > "rwxr-xr-x" - I recall something about linux dynamic loader that requires >*.so > > > > > to have execute persmissions for everybody. > > > > > > > > > Here's mine :) > > > > [chaos@chaos chaos]$ ls -l /usr/lib/gtk/themes/engines > > > > : > > > > : > > > > : > > > > -rwxr-xr-x1 root root 784 Apr 5 07:01 libpixmap.la > > > > -rwxr-xr-x1 root root 216930 Apr 5 07:01 libpixmap.so > > > > : > > > > : > > > > : > > > > > > > > In original message, you've stated that you added > > module_path "/usr/lib/gtk/themes/engines" > > to your gtkrc. > > But it seems that you should use module_path "/usr/lib/gtk/themes/" for your > > file layout (I see this looking at the comments in gtkrc's of various themes). > > Please try this and report. > > > > If it still doesn't work: Did you compile libpixmap.so yourself (what is > > your distro)? If I were you, I would try the following then: > > > > 1) Get compiled libpixmap.so from any other place (i.e. from RedHat - it's in > > gtk-engines.rpmor something like this) and try it. > > 2) If 1) is not acceptable - may be your libgtk.so and libpixmap.so are > > compiled by different versions of gcc (and probably linked with > > different versions of glibc), so try to compile them with the same > > compiler (and probably without all optimizations). > > > > HTH Best regards, -Vlad ___ gtk-list mailing list [EMAIL PROTECTED] http://mail.gnome.org/mailman/listinfo/gtk-list
Re: Gtk-WARNING **: Unable to locate loadable module in module_path:"libpixmap.so"
On Thu, 13 Jul 2000, David Frascone wrote: > On Thu, Jul 13, 2000 at 08:44:17PM +0500, Vlad Harchev wrote: > > On Thu, 13 Jul 2000, David Frascone wrote: > > > > > Hmm . . .strange . . .seems that a theme did it. If I remove my .gtkrc, it > > > works fine. Here is the offensive .gtkrc > > > > If you remove .gtkrc, it seems that gtk+ will use default theme that doesn't > > require pixmap engine - so this is the reason the message disappears. > > > > Could you try restoring your original .gtkrc shown below, and add > > module_path "/usr/lib/gtk/themes/" > > to it and report results. > > I did that . . it didn't help You could perform steps 1) and 2) I listed in previous messages, and also execute 'file /usr/lib/gtk/themes/engines/pixmap.so" and check output - may be you've got pixmap.so for wrong CPU type (say for SPARC if you are on x86) (sorry if this offends you, but this seems to be my last idea). If you are not on linux, please state it clearly too. HTH Best regards, -Vlad ___ gtk-list mailing list [EMAIL PROTECTED] http://mail.gnome.org/mailman/listinfo/gtk-list
Re: tab order and restricting entry widgets
On Fri, 14 Jul 2000, Dave Reed wrote: > > Is there an easy method to change the focus order when you tab through > entry widgets. I've got a bunch of entry and combo widgets in a table > and I want the tab key to go down the column first rather than across > the row. I guess I could use the leave_notify signal for each widget, > but that would be a pain. As for focus order - I don't know any easy solution. > Is there a way to restrict entry widgets to only numeric (and > only dates would be great also)? No special support for this exists, but you always can connect to "changed" signal, validate the data, and act accordingly. I prefer to disable "OK" button if data is invalid; coloring the text of the entry with different color is nice too. > I skimmed the online documentation and grep'ed .h files, but couldn't > find anything. I also tried to search the list archives, but couldn't > find a search function for the archives (other than loading each month > into Netscape and using Netscape's find) - am I missing it? > > Thanks, > Dave > > ___ > gtk-list mailing list > [EMAIL PROTECTED] > http://mail.gnome.org/mailman/listinfo/gtk-list > Best regards, -Vlad ___ gtk-list mailing list [EMAIL PROTECTED] http://mail.gnome.org/mailman/listinfo/gtk-list
Re: tab order and restricting entry widgets
On Fri, 14 Jul 2000, xander wrote: > On Fri, 14 Jul 2000, Vlad Harchev wrote: > > > Date: Fri, 14 Jul 2000 16:38:10 +0500 (SAMST) > > From: Vlad Harchev <[EMAIL PROTECTED]> > > To: Dave Reed <[EMAIL PROTECTED]> > > Cc: [EMAIL PROTECTED] > > Subject: Re: tab order and restricting entry widgets > > > > On Fri, 14 Jul 2000, Dave Reed wrote: > > > > > > > > Is there an easy method to change the focus order when you tab through > > > entry widgets. I've got a bunch of entry and combo widgets in a table > > > and I want the tab key to go down the column first rather than across > > > the row. I guess I could use the leave_notify signal for each widget, > > > but that would be a pain. > > > > As for focus order - I don't know any easy solution. > > > > > Is there a way to restrict entry widgets to only numeric (and > > > only dates would be great also)? > > > > No special support for this exists, but you always can connect to "changed" > > signal, validate the data, and act accordingly. > > That is an easy solution. Connect the signal "changed" in this case for > each widget and supply the next widget as extra data. In the callback, > use gtk_widget_grab_focus((GtkWidget*)data) and this should do the trick. Yes, but this requires a lot of handwork. It would be nice to hack glade to do this. As for original case - I think the following nice hack will work: create hbox, pack vboxes into it and make each vbox contain the widgets that a column of your table contained. In this case, pressing tab will first switch to next entry in column, then to next column. > > I prefer to disable "OK" > > button if data is invalid; coloring the text of the entry with different color > > is nice too. > > You mean selecting the whole entry text which is faulty? That is imo a > nice solution. No, I meant coloring the text with another color, not selecting it as with shift-arrow. When the entry content becomes valid again, restore the color. > > -- > A skunk sat on a stump and thunk the stump stunk, > but the stump thunk the skunk stunk. > Best regards, -Vlad ___ gtk-list mailing list [EMAIL PROTECTED] http://mail.gnome.org/mailman/listinfo/gtk-list
Re: GtkClist and tooltips HELP!
On Fri, 14 Jul 2000, Dimitri Androutsos wrote: Hi, Just a guess: may be calling gtk_clist_column_titles_active(list_clist) somewhere before solve the problem? > > Hi, > > For th elife of me, I can't get tooltips to pop up on a button on the > title bar of a GtkClist . > > Here's the tooltips set command I use: > > gtk_tooltips_set_tip(cliptooltips, > gtk_clist_get_column_widget(list_clist, 0), "tooltip message", NULL); > > Am I overlooking something? > > Dimitri > > > ___ > gtk-list mailing list > [EMAIL PROTECTED] > http://mail.gnome.org/mailman/listinfo/gtk-list > Best regards, -Vlad ___ gtk-list mailing list [EMAIL PROTECTED] http://mail.gnome.org/mailman/listinfo/gtk-list
Re: keeping modal dialogs visible (on top)
On Fri, 14 Jul 2000, Sharp, Peggy wrote: > i've not been able to find a way to keep modal dialogs on top of any others > that are visible. it this possible, and if so, please send instructions. > thanks! There is a function in libgnomeui (i.e. the part of gnome): gnome_win_hints_set_layer(GtkWidget* w,GnomeWinLayer layer); Where typedef enum { WIN_LAYER_DESKTOP = 0, WIN_LAYER_BELOW = 2, WIN_LAYER_NORMAL = 4, WIN_LAYER_ONTOP = 6, WIN_LAYER_DOCK= 8, WIN_LAYER_ABOVE_DOCK = 10 } GnomeWinLayer; So you should use: gnome_win_hints_set_layer(GtkWidget* w, WIN_LAYER_ONTOP); If you don't want to depend on Gnome, just reimplement gnome-libs-1.0.5/libgnomeui/gnome-winhints.c:gnome_win_hints_set_layer and you are done. Note: this will work only with GNOME-compatible window managers ( E, WM and Sawfish included, and probably KWM). > ___ > gtk-list mailing list > [EMAIL PROTECTED] > http://mail.gnome.org/mailman/listinfo/gtk-list > Best regards, -Vlad ___ gtk-list mailing list [EMAIL PROTECTED] http://mail.gnome.org/mailman/listinfo/gtk-list
Re: Can't get ./configure to work.
On 14 Jul 2000, Havoc Pennington wrote: > > tomi striano <[EMAIL PROTECTED]> writes: > > >From within the gtk+1.2.8 directory when I run ./configure it goes as far > > as "checking for glib version >= 1.2.8" it always returns no for this > > check. I've edited the /etc/ldso.conf so that it pointed to > > /usr/local/bin/glib-config and ran ldconfig and still no joy. I edited > > the line within glib-config > > --version) > > echo 1.2.8 > > exit 0 > > ;; > > > > to see if that made a difference. All that I found was that it was > > reading this section when I did some bazaar things but it could not get > > 1.2.8 into ./configure program. > > > > Any suggestions? Obliged John. > > > > First suggestion, as always, is to get a nice binary package in RPM or > deb format rather than compile it yourself. But, failing that: > > The file config.log will contain the exact reason the check for glib > failed. Possibly you added the wrong thing to ld.so.conf - it should > be /usr/local/lib, not /usr/local/bin/glib-config. Also make sure you add --with-glib-prefix=/usr/local to your ./configure commandline. > Havoc > > ___ > gtk-list mailing list > [EMAIL PROTECTED] > http://mail.gnome.org/mailman/listinfo/gtk-list > Best regards, -Vlad ___ gtk-list mailing list [EMAIL PROTECTED] http://mail.gnome.org/mailman/listinfo/gtk-list
Re: border style in Containers
On Tue, 18 Jul 2000, Fabiano Fantini Vitale wrote: > hello, > I want to know if exists border styles in GtkContainers. > this, to have visual effect of layers when a container is upper of the other > (the same in Delphi - bevel in, bevel out) Hi, Use GtkFrame for it with empty label. You can set the "border style" using gtk_frame_set_shadow_type(frame,shadow), where shadow can be one of the following: GTK_SHADOW_NONE, GTK_SHADOW_IN, GTK_SHADOW_OUT, GTK_SHADOW_ETCHED_IN, GTK_SHADOW_ETCHED_OUT > thanks > -- > Fabiano Fantini Vitale <[EMAIL PROTECTED]> > Conectiva S.A. > > ___ > gtk-list mailing list > [EMAIL PROTECTED] > http://mail.gnome.org/mailman/listinfo/gtk-list > Best regards, -Vlad ___ gtk-list mailing list [EMAIL PROTECTED] http://mail.gnome.org/mailman/listinfo/gtk-list
Re: GtkFixed background
On Tue, 18 Jul 2000, Scott Lindsey wrote: > I'm seeing some behavior which seems slightly similar to the the > problem I mentioned a week or so ago (wrt GtkDrawingArea). However, > this behavior varies depending on the current theme. > > If I put a GtkFixed into a window, some themes (Cheese, BlueBrushed) > draw their background texture. Others (Gradient-Blue, marble3D, > Ganymede, Aqua) don't, only drawing a comparable background color. > > Is this something I can (or should) work around? Of course theme controls this (so probably this is a decision of theme author), so I think you have several choices: 1) hack each theme you need (just add lines pointing to correct pixmaps, like these bg_pixmap[NORMAL] = "brushed2.xpm" bg_pixmap[INSENSITIVE] = "brushed2.xpm" bg_pixmap[ACTIVE] = "brushed2-dark.xpm" bg_pixmap[PRELIGHT] = "brushed2-light.xpm" near the lines looking like bg[NORMAL] = { 0.77, 0.77, 0.77 } bg[SELECTED] = { 0.67, 0.67, 0.67 } bg[INSENSITIVE] = { 0.77, 0.77, 0.77 } bg[ACTIVE] = { 0.67, 0.67, 0.67 } bg[PRELIGHT] = { 0.80, 0.82, 0.84 } in gtkrc of the particular themes). 2) Manually apply style to given GtkFixed you need using various gtk function. But in general, the use of GtkFixed is a bad thing (unless you automatically translate code written for other widgeset) - use tables and boxes for layout. > -- > Scott Lindsey <[EMAIL PROTECTED]> > > ___ > gtk-list mailing list > [EMAIL PROTECTED] > http://mail.gnome.org/mailman/listinfo/gtk-list > Best regards, -Vlad ___ gtk-list mailing list [EMAIL PROTECTED] http://mail.gnome.org/mailman/listinfo/gtk-list
Re: Glib Unicode regex (was: Gtk::Text widget)
On Wed, 19 Jul 2000, Derek Simkowiak wrote: > -> > Somebody posted a Glib-ized regex to the list a few weeks ago, and > -> > it got some feedback and went through a couple of iterations. Is there > -> > any reason not to add it to Glib? I think it would be very useful to > -> > have. > -> > -> No Unicode support. > > Mark Leisher has developed a regex library hat uses UTF-16 > internally. It can be found at > > http://crl.nmsu.edu/~mleisher/ > > I think a Glib regex would be very cool to have, for the text > widget and for general use. > > Is anyone interested in porting this into the Glib style? And, > would people be willing to consider it for Glib 2.0? (I don't have time > to work on this right now, just trying to get the project going) > > Outstanding issues: > > * Does "UTF-16 internally" mean that it will only work on a UTF-16 > encoded buffer? > > * Will the GTK+ team insist on a regex lib that uses UTF-8 internally? > > * Are there any other Unicode-supporting regex libs we can look at? I think new perl regex stuff could be considered since recent perl supports Unicode (in regexes too), though I afraid it's tightly integrated with the language. But probably Mark's lib is better. > > Thanks, > Derek > Best regards, -Vlad ___ gtk-list mailing list [EMAIL PROTECTED] http://mail.gnome.org/mailman/listinfo/gtk-list
Re: GHashTable memory usage
On Thu, 20 Jul 2000, Slava Poliakov wrote: Hi, I would recommend trying other means for this, for example the following: * hashtable from C++ STL by SGI (provided with gcc) - seems it should be faster since some code will be inlined (such as comparation functions, hash functions, and your own allocator - all this can be inlined if you write it in a special way) - see hash{_map,_set,table}.h I don't know about its behaviour with such amounts of data (but at least you will be able to store the "value" structrure *inside* the hash item, not the pointer to it like in glib - this can cause less fragmentation (and you can use your own allocator!). Also, hash_multimap is also available (look in hash_map). On most linuxes, these files are in /usr/include/g++-2 In general, write and use C++ templates - it's faster, flexible and powerfull than it could be done in C with the same level of flexibility. * probably using some database (like Postgressql or db*). Feel free to contact me for discussion. > Hi, > > I am currently using the GLIB library within my program for the purpose > of creating search engine based on Hash Tables. For that purpose I'm > using the GLIB functions such g_hash_table_*. Through my usage of those > functions I had noticed a peculiar behavior, after loading a fairly > large data file my program takes up approximately 331 Megs of memory > which really pushes the limits of my system which currently has only 256 > of physical memory. What happens is that for some reason it seems that > when the system reaches a very high load the hash table seems to get > compressed by a fairly large amount (150-70 megs) which generally causes > the program to reduce it own memory usage down to 184 megs or so. > Unfortunately when I add additional RAM to the system this optimization > doesn't seem to occur and I have not been able to consistently replicate > the conditions which cause this optimization, other then the time when > it seems the system is running out of physical memory. I was wondering > if perhaps Hash Table functions inside glib have some internal > optimization functions which cause this to occur. What I would really > like to know if it is possible to replicate usage of those functions > without the system coming close to dying. > > The current system config is as follows: > Dual Celeron 433 > 256 megs of Ram > Linux 2.2.16 [Slackware] > > ___ > gtk-list mailing list > [EMAIL PROTECTED] > http://mail.gnome.org/mailman/listinfo/gtk-list > Best regards, -Vlad ___ gtk-list mailing list [EMAIL PROTECTED] http://mail.gnome.org/mailman/listinfo/gtk-list
Re: [Q] Usage of g_new and g_new0 function...
On Fri, 21 Jul 2000, Woo-Sick Choi wrote: > Hi~ > > I want to know Usage of g_new function. > > I found g_new function in gtk/*.h and in Manual. > But, I can't find any document for g_new. > > pls Help me. > > for exam) > > table = g_new0(Table,1) > > What this mean?? > The Reference Documentation Project contains description of functions and macros in glib, here is an documentaton for g_new and g_new0 #define g_new(type, count) Allocates count elements of type type. The returned pointer is cast to a pointer to the given type. If count is 0 it returns NULL. type : the type of the elements to allocate. count : the number of elements to allocate. Returns : a pointer to the allocated memory, cast to a pointer to type. #define g_new0(type, count) Allocates count elements of type type, initialized to 0's. The re- turned pointer is cast to a pointer to the given type. If count is 0 it returns NULL. type : the type of the elements to allocate. count : the number of elements to allocate. Returns : a pointer to the allocated memory, cast to a pointer to type. > > > ___ > gtk-list mailing list > [EMAIL PROTECTED] > http://mail.gnome.org/mailman/listinfo/gtk-list > Best regards, -Vlad ___ gtk-list mailing list [EMAIL PROTECTED] http://mail.gnome.org/mailman/listinfo/gtk-list
Re: Updating a statusbar widget
On Sun, 23 Jul 2000, Nicholas wrote: Hi, See FAQ - Q4.12 The A is to insert the loop of sub_rout1 the following: while (gtk_events_pending()) gtk_main_iteration(); > hi people > > imagine the following lines: > > --- > int > main(arg--etc) { > > gtk_init (&argc, &argv); > > window --bla-bla-- > > /* i create a statusbar */ > > status_bar = gtk_statusbar_new(); > gtk_box_pack_start (GTK_BOX (vbox), status_bar, TRUE, TRUE, 0); > gtk_widget_show (status_bar); > > context_id = gtk_statusbar_get_context_id( > GTK_STATUSBAR(status_bar), "Statusbar example"); > > > sub_rout1();// i call a subroutine > > gtk_widget_show (window); > gtk_main (); > return(0) > > } > > void sub_rout1 { > /* here is a loop */ > for (bla bla) { > do smth; > sub_rout2(); > } > } > > void sub_rout2 { > /* in here i'm trying to update the text in 'statusbar' widget */ > gtk_statusbar_push( GTK_STATUSBAR(status_bar), GPOINTER_TO_INT(data), > buff) > return; > } > > -- > Well it doesn't work... exept when it exits from the loop the > statusbar gets the last value. > > Any way how to make the updated contents of the statusbar > visible while in the loop? > > thanks > > N > > > > > ___ > gtk-list mailing list > [EMAIL PROTECTED] > http://mail.gnome.org/mailman/listinfo/gtk-list > Best regards, -Vlad ___ gtk-list mailing list [EMAIL PROTECTED] http://mail.gnome.org/mailman/listinfo/gtk-list
Re: Style
On Wed, 26 Jul 2000, Denis Serebro wrote: Hi Denis, Just remove line with gtl_style_unref(button->style); gtk_widget_set_style() does this itself. When I tried your code, the program didn't segfaulted though (I use gtk+-1.2.3). >Hello, All. > >Sorry for my English. When i try create and destroy widget with changed style, I >get >Gtk-CRITICAL **: file gtkstyle.c: line 606 (gtk_style_ref): assertion >`style->ref_count > 0' failed. > >What's wrong ? See my code: >[...] Best regards, -Vlad ___ gtk-list mailing list [EMAIL PROTECTED] http://mail.gnome.org/mailman/listinfo/gtk-list
Re: Glib + glib-config
On Sun, 16 Jul 2000, jerrud wrote: Hi, > Hi, > I`m installing GTK+ 1.2.8 and in order to do that i have to install glib > 1.2.8. > > My problem rests in that I have glib 1.2.6 installed from my > distrobution`s install. (I`m running Storm Linux, Debian 2.2 based) > > So my question to you guys is:: How do i install over this older glib > version (or uninstall, if need be) in order to install GTK+ ? It looks like glib-1.2.8 and 1.2.6 coexist. It looks like glib-1.2.8 is installed in /usr/local/lib. If you wish all already installed apps to use new glib and gtk, you should have erase glib-1.2.8, erase gtk-1.2.6 and glib-1.2.6 using package management software (apt?), and then you should build glib-1.2.8 and gtk-1.2.8. To do this properly, run 'configure --prefix=/usr' for each package, then make glib, install it, then make gtk, install it. But even better, try to get precompiled debs from somewhere. > The error that ./configure produces is (from GTK):: > > glib-config --version returned 1.2.8, but GLIB (1.2.6) was found! > > Then it procedes to tell me how to fix this problem, but I do not know > how to do so... > > All help appreciated > > Jerrud. > > > > > > ___ > gtk-list mailing list > [EMAIL PROTECTED] > http://mail.gnome.org/mailman/listinfo/gtk-list > Best regards, -Vlad ___ gtk-list mailing list [EMAIL PROTECTED] http://mail.gnome.org/mailman/listinfo/gtk-list
Re: locale
On Thu, 27 Jul 2000 [EMAIL PROTECTED] wrote: > Hi *, > if I try to run a program that uses gtk, I got the following message: > > > Gdk-WARNING **: locale not supported by C library > Speicherzugriffsfehler//segmentation fault > > I'm running a SuSE 6.2 linux. I got this program running well on a SuSE6.1 but > not > on a SuSE6.4; on this systm, the first window starts but then the progrm hangs > and with it the whole x-server. > > Compiling this program is not the problem on any system! I think, this is not > only a gtk-problem, I think it's caused by the glibc, but I'm not shure and: > I don't know, what to do. Any suggestions? First of all, try running your program with default (non-localized) message set. To do this, type set the environment variable LC_MESSAGES to "C" and export it, and then run your program. For example, in xterm type LC_MESSAGES=C; export LC_MESSAGES; your-program-name You need to type the 1st string only once in the given xterm. If your program behaves incorrectly, than it's broken message set used by glibc/gtk/your-program. > olaf > > ___ > gtk-list mailing list > [EMAIL PROTECTED] > http://mail.gnome.org/mailman/listinfo/gtk-list > Best regards, -Vlad ___ gtk-list mailing list [EMAIL PROTECTED] http://mail.gnome.org/mailman/listinfo/gtk-list
Re: Updating a statusbar widget
On Wed, 26 Jul 2000, Tony Denault wrote: Hi, > On Sun, 23 Jul 2000, Vlad Harchev wrote: > > > > > while (gtk_events_pending()) > > gtk_main_iteration(); > > > > > I am doing this, see my print_status function to write text > status to a label: > > int print_status( char *fmt, ... ) > { >char buf[256]; >va_list argptr; > >va_start( argptr, fmt); >vsprintf( buf, fmt, argptr); >va_end( argptr ); > >/* update single line feedback widget on main screen */ >gtk_label_set_text( GTK_LABEL(Feedback_search_w), buf ); > >/* force update of widgets */ >while ( gtk_events_pending() ) > gtk_main_iteration(); >// while ( gtk_main_iteration()); <- this one from the FAQ don't work! > >return ERR_NONE; > } > > Some problems: > > 1. The suggested code from the FAQ doesn't work: > "while (gtk_main_iteration(FALSE));" >I am using GTK 1.2.7. Is the FAQ out of date with the GTK release? Probably it should be while gtk_main_iteration_do(FALSE) since gtk_main_iteration() doesn't accept any arguments. If it's really bug in FAQ, please submit bug report somewhere :) > 2. Worse, this solution does more than just drawing updates. It also >processing other events on the queue. If I call print_status(), any >user input to widget and their call backs are called, expired timers >call backs get called, etc This make the cure, worse that the problem. As for timers - it looks like the right thing to call them. As for everything else: if you call print_status in some long loop (that can last rather long in average), in order to prevent user interacting with other widgets you can instead pop modal window with just one message "Please wait, %d%% done". > Is there a better method to handle this situation? > I think this is the best gtk 1.2.x can do. Will 1.4.x work better? Yes, it looks like the best gtk 1.2.x can do. I don't know for 1.4.x > Tony > > /-\ > | Tony Denault| Internet: [EMAIL PROTECTED] | > | NASA IRTF, Institute of Astronomy | Phone: (808) 974-4206 | > | 1175 Manono St., Bldg 393 | Fax: (808) 974-4207 | > | Hilo, Hawaii 96720 | | > \-/ > > > Best regards, -Vlad ___ gtk-list mailing list [EMAIL PROTECTED] http://mail.gnome.org/mailman/listinfo/gtk-list
Re: Where can i get gtk 1.3.1
On Wed, 2 Aug 2000, M.N.S.S.K.Pavan Kumar wrote: Hi, > > Hi, > I have been reading the mails where reference to gtk1.3.1 is made. > I did not even recieve any info about its release. Can you please tell me > where I can get the new release if it is released. Here are locations: GLib-1.3.1 and GTK+-1.3.1 are available from: ftp://ftp.gtk.org/pub/gtk/v1.3/dependencies RPM packages of the unstable versions of GLib, FriBidi, Pango, and GTK+ are available from: ftp://ftp.gtk.org/pub/gtk/v1.3/binary/RedHat-6.2/ Included are i386 RPMS and SRPMS for Red Hat 6.2. (The SRPMS will most likely work on similar systems, the RPMS may work on similar systems.) Inm general, this list is searchable (via google :) and also has list archive, so you can scan message index for July and get the message with announcement. > > Pavan Best regards, -Vlad ___ gtk-list mailing list [EMAIL PROTECTED] http://mail.gnome.org/mailman/listinfo/gtk-list
Re: selecting text area
On Tue, 1 Aug 2000 [EMAIL PROTECTED] wrote: Hi, > hello all, > just needed a signal to be emitted whenever region of text is selected > by keyboard or mouse > pressing (in a object of type GTK_TEXT), couldn't find one such type. > just wanted to know if or how that is done. Here is how I would try to do this (I didn't try this :) : connect to key_press_event, key_release_event, button_press_event, "motion-notify-event" (I don't know what is it - probably it issued when mouse is moving) to the area on which selections you want to monitor. After each invokation of the signal handler, check the values of GTK_EDITABLE(textarea)->selection_start_pos and GTK_EDITABLE(textarea)->selection_end_pos. If they are changed (comparing with the values stored on previous call), than visual selection is changed. Also note, that gtk itself uses the following code for getting selection: selection_start_pos = MIN (editable->selection_start_pos, editable->selection_end_pos); selection_end_pos = MAX(editable->selection_start_pos, editable->selection_end_pos); Probably you should also use the same for detecting real start and end positions of selection. > rinu > Best regards, -Vlad ___ gtk-list mailing list [EMAIL PROTECTED] http://mail.gnome.org/mailman/listinfo/gtk-list
Re: gtk_widget_set_style() and themes
On Tue, 1 Aug 2000, Omar Barneto wrote: > How can I change a button's selected and prelight color and keep the > original theme appearance for the normal color? What I'm doing is use > gtk_widget_get_style(), set the two colors on the style and then > gtk_widget_set_style(). When I do that, the three colors are apparently > set and the theme appearance is lost. I'm running under Enlightenment. I You write that you set two colors, and then your write that 3 colors are set... The fact that you're running under E doesn't matter. Do you mean that all buttons in your app changed the color or what? If yes, you should use gtk_style_copy and modify the returned style. Also note, that some themes use pixmaps for drawing widgets, so even if you've chnaged the color in some states, appearance of the widget won't change (try your code with brushedmetal theme for example). > found a few probably related functions like gtk_theme_engine_get() etc., > but couldn't find any documentation on them. Is there any documentation > or examples available about how to use this themes API? I don't know about documentation on this - but you can look at the gtk source and at the source of some theme engines (namely pixmap). You cna also modify gtkrc for your application (you can name the buttons using gtk_widget_set_name and then bind particular style in your gtkrc to the widgets with that name), and then load modified gtkrc using gtk_rc_set_default_files or gtk_rc_add_default_file. > Thank you and regards, > > Omar. > > > ___ > gtk-list mailing list > [EMAIL PROTECTED] > http://mail.gnome.org/mailman/listinfo/gtk-list > Best regards, -Vlad ___ gtk-list mailing list [EMAIL PROTECTED] http://mail.gnome.org/mailman/listinfo/gtk-list
Re: gtk_widget_set_style() and themes
On Wed, 2 Aug 2000, Omar Barneto wrote: > Thank you Vlad. The problem is as follows: I change the color for two states in > only one button. The rest of the buttons remain with their original theme > appearance. I would like that this button keeps its original appearance for the > other states, but instead it seems that all the states of the button get the > colors changed. Those states for which I did not set the color apparently get > default colors. The theme dissapears in all the states. It looks like in the > sequence get_syle - modify style - set_style the theme is lost (but only in this > button). The question is how to avoid this and keep the original theme, at least > for the states for which I do not set new colors? Please post a piece of code you use. Also, you didn't answer - do you run pixmap-based theme? Does your code works as expected if default gtk theme is used (i.e. light gray widgets with black text)? > Best regards, > > Omar. > > Vlad Harchev wrote: > > > On Tue, 1 Aug 2000, Omar Barneto wrote: > > > > > How can I change a button's selected and prelight color and keep the > > > original theme appearance for the normal color? What I'm doing is use > > > gtk_widget_get_style(), set the two colors on the style and then > > > gtk_widget_set_style(). When I do that, the three colors are apparently > > > set and the theme appearance is lost. I'm running under Enlightenment. I > > > > You write that you set two colors, and then your write that 3 colors are > > set... The fact that you're running under E doesn't matter. > > > > Do you mean that all buttons in your app changed the color or what? If yes, > > you should use gtk_style_copy and modify the returned style. Also note, that > > some themes use pixmaps for drawing widgets, so even if you've chnaged the > > color in some states, appearance of the widget won't change (try your code > > with brushedmetal theme for example). > > > > > found a few probably related functions like gtk_theme_engine_get() etc., > > > but couldn't find any documentation on them. Is there any documentation > > > or examples available about how to use this themes API? > > > > I don't know about documentation on this - but you can look at the gtk > > source and at the source of some theme engines (namely pixmap). > > > > You cna also modify gtkrc for your application (you can name the buttons > > using gtk_widget_set_name and then bind particular style in your gtkrc to the > > widgets with that name), and then load modified gtkrc using > > gtk_rc_set_default_files or gtk_rc_add_default_file. > > > > > Thank you and regards, > > > > > > Omar. > > > Best regards, -Vlad ___ gtk-list mailing list [EMAIL PROTECTED] http://mail.gnome.org/mailman/listinfo/gtk-list
Re: Changing pixmaps on-the-fly
On Wed, 2 Aug 2000, Kristopher Kycia wrote: Hi, > Hello all, > > I was wondering if anybody had ideas about how to dynamically change > pixmaps on-the-fly. I have a button on which I have a pixmap and I > would like to change the pixmap each time you click on the button. BTW > my button is packed with a HBox containing 3 columns: A label, the > pixmap and another label. > > I'm not too sure how to do this because I am using Glade as a GUI > builder. If I was to code this up, I guess it would definetely be > easier. Unfortunatly then the design of the windows would take much > more time. Anybody have any ideas? gtk_pixmap_set allows you to change the image and mask used in GtkPixmap. So, in you "clicked" handler, get the GtkPixmap widget in the button (using lookup_widget(window,"button_name")) and call gtk_pixmap_set on it with another GdkPixmap. > > Kristopher Kycia > > > ___ > gtk-list mailing list > [EMAIL PROTECTED] > http://mail.gnome.org/mailman/listinfo/gtk-list > Best regards, -Vlad ___ gtk-list mailing list [EMAIL PROTECTED] http://mail.gnome.org/mailman/listinfo/gtk-list
Re: gtk_widget_set_style() and themes
On Wed, 2 Aug 2000, Omar Barneto wrote: Omar, > Vlad, > > I am attaching a short program to show the problem. In this program I create two > buttons and change the normal state color of the first one. As you can see, the theme > dissapears from the prelight and clicked states as well. This can be easily seen >using > a theme like etheme, which puts a graded shadow on the button. I've tried it with > several other themes with the same behavior. I played with it a lot - and I should say it's nearly impossible to do what you want if you use pixmap-based engine. Even if you don't change any color in the style, the engine won't be used after you set_style on that widget (or you have to GTK_WIDGET_SET_FLAGS (w, GTK_RC_STYLE); to engage theme again, but then the colors you've changed won't be used). Even doing that hack in "state-changed" signal (setting/unsetting that flag for different values of GTK_WIDGET_STATE(w)) doesn't work as expected (yes, I tried it, but didn't find working solution). If your GUI design guidelines force you to make the button very distinguishable from other, you can resort to sticking fancy pixmap on that button. > Cheers, > > Omar. > > Best regards, -Vlad ___ gtk-list mailing list [EMAIL PROTECTED] http://mail.gnome.org/mailman/listinfo/gtk-list
Re: Gtk_CTree : Help please
On Thu, 3 Aug 2000, Florent. Devin wrote: Hi, > Hi, > I was using gtk_tree to figure a tree structure from a program. > In this tree, I set for each item a key (with this key I had access to > the > program and something). > gtk_object_set_data (GTK_OBJECT (item), "key", key); > And also for each kind of item I set a drop destination and drag > source. > When I want to do the same thing with a Gnome MDI environnement, Havoc > says > that I have to use Gtk_CTree because Gtk_Tree was obsolete/deprecated. > So I change my tree to a ctree one. Now it work fine but : > > How can I set a key for an item in a gtk_ctree ? > I can't use gtk_object_set_data (GTK_OBJECT (item),...) because Gtk > can't > convert a GtkCTreeNode to an GtkObject (the GtkCTreeNode is opaque...). > And a second question which is the same thing I think. > How can I set a drag source and a dest drop for a specific item ? > > I've got this warning when I run my program. > Gtk-WARNING **: invalid cast from `(unknown)' to `GtkObject' > > Gtk-CRITICAL **: file gtkobject.c: line 1034 (gtk_object_set_data): > assertion `GTK_IS_OBJECT (object)' failed. > > This warning is done by this code : > noeud = gtk_ctree_insert_node (GTK_CTREE (root_tree), tree, NULL, > texte, 8, > image->pixmap, image->mask, > image->pixmap, image->mask, > FALSE, FALSE); > gtk_object_set_data (GTK_OBJECT (noeud), "nom", key); It looks like node is not an ancestor of GtkObject. What I would do, is to gtk_ctree_node_set_row_data_full(GTK_CTREE(root_tree),noeud, g_hash_table_new(g_str_hash,g_str_equal),g_hash_table_destroy); And then use the following: g_hash_table_insert((GHashTable*) gtk_ctree_node_get_row_data(GTK_CTREE(root_tree),noeud)),"nom",key); instead of gtk_object_set_data(). The hash will be destoyed automatically when the node dies. Or you can try to represent all data you wish to associate with a node via a single pointer and use gtk_ctree_node_{s,g}et_row_data() > -- > Florent DEVIN > > ___ > gtk-list mailing list > [EMAIL PROTECTED] > http://mail.gnome.org/mailman/listinfo/gtk-list > Best regards, -Vlad ___ gtk-list mailing list [EMAIL PROTECTED] http://mail.gnome.org/mailman/listinfo/gtk-list
RE: Newbie question regarding gtk_signal_connet
On Thu, 3 Aug 2000, Nghia wrote: > > Ok, I was advised to use structures to solve the problem which I almost > did except for a segmentation fault during the passing the structure to > gtk_singal_connect. Here is what I used > > struct widget { > GtkWidget *intput; > GtkWidget *output; > }; > void button_one_clicked(GtkWidget *button, struct widget > *widget_holder){ > } > gtk_signal_connect(GTK_OBJECT(button_one, "clicked", > GTK_SIGNAL_FUNC(button_one_clicked), widget_holder); > > But the moment the function button_one_clicked is run it crashes, even > before it loads any variables (I've checked this by making the function > empty). Your pieces of code looks innocent (well, we don't know the type of 'widget_holder', but since gcc didn't warn, it looks like it was a pointer). You should post reduced version of your code for us being able to help you. > Is there something I did wrong? gcc didn't return any errors. > > Nghia Best regards, -Vlad ___ gtk-list mailing list [EMAIL PROTECTED] http://mail.gnome.org/mailman/listinfo/gtk-list
Re: Gtk_CTree : Help please
On Thu, 3 Aug 2000, Florent. Devin wrote: > Vlad Harchev a écrit : > > > > On Thu, 3 Aug 2000, Florent. Devin wrote: > >[...] > This is a good way to do what I want and it feet great. I try it, I run > it, > I like it... Thanks > But with this method, I can not still handle signal for different > gtk_ctree_node ? If I can not handle signal, I can not do drag and drop > from > another widget to a particular node. If you mean that you want to be able to drag something from other widget (other ctree for example) to given ctree - yes, seems some tricky things will be required to do this. Look at testdnd.c supplied in gtk sources. You will have to do just the same (using "drag_drop" and "drag-data-received"), and in handler for "drag-data-received" you will have to compute the row number of the target it using int row, column; gtk_clist_get_selection_info(GTK_CLIST(root_ctree),x,y,&row,&column); After that you can (I guess) get the target CTreeNode using gtk_ctree_node_nth(GTK_CTREE(root_ctree),row) Please report whether this really works. If you need only dragging from nodes of that ctree to nodes of the same ctree (better called reordering) - then it's easily doable (look at testgtk.c). > There is one function that may help me but I do not know what it is for > : > gtk_ctree_set_drag_compare_func > Or is there a way to handle drag and drop signal ? > Is there a way to handle at least signal from gtk_widget ? > > -- > Florent DEVIN > > ___ > gtk-list mailing list > [EMAIL PROTECTED] > http://mail.gnome.org/mailman/listinfo/gtk-list > Best regards, -Vlad ___ gtk-list mailing list [EMAIL PROTECTED] http://mail.gnome.org/mailman/listinfo/gtk-list
Re: Gtk_CTree : Help please
On Fri, 4 Aug 2000, Florent. Devin wrote: > Vlad Harchev a écrit : > > > > But with this method, I can not still handle signal for different > > > gtk_ctree_node ? If I can not handle signal, I can not do drag and drop > > > from > > > another widget to a particular node. > > > > If you mean that you want to be able to drag something from other widget > > (other ctree for example) to given ctree - yes, seems some tricky things will > > be required to do this. Look at testdnd.c supplied in gtk sources. You will > > have to do just the same (using "drag_drop" and "drag-data-received"), and in > > handler for "drag-data-received" you will have to compute the row number of > > the target it using > > > > int row, column; > > gtk_clist_get_selection_info(GTK_CLIST(root_ctree),x,y,&row,&column); > > After that you can (I guess) get the target CTreeNode using > > gtk_ctree_node_nth(GTK_CTREE(root_ctree),row) > > > > Please report whether this really works. > > > > If you need only dragging from nodes of that ctree to nodes of the same ctree > > (better called reordering) - then it's easily doable (look at testgtk.c). > > > > > There is one function that may help me but I do not know what it is for > > > : > > > gtk_ctree_set_drag_compare_func > > > Or is there a way to handle drag and drop signal ? > > > Is there a way to handle at least signal from gtk_widget ? > > > > What I have to do is : > - To drag a particular node from a ctree to another ctree or to the > same > but in another location (changing the parent...) > - To drag from a canvas and drop onto a particular node In this case all you can use is native gtk drag-n-drop capabilities (as I described in the message you've quoted). > - To drag from ctree to my canvas. > So I can handle the signal from "drag-data-received" but how can I be > sure that the current selected item is the item I what to drag ? Of course you'll have to handle "drag-drop" - in which you can cancel drop operation (don't request for data that will cause emission of "drag-data-received") > How can I know where I drop my drag object ? Handlers for both "drag-data-received" and "drag-drop" receive the coordintaes of the drop. This should be enough :) See testdnd.c for more ideas. > I had a similar problem in canvas, where gnome-canvas-image are not from > GtkWidget, the thing I have to do is to handle signal from the canvas > itself and react if I was on an image or not. This was possible because > gnome-canvas had function to know what we have under the pointer ? > > -- > Florent DEVIN > Best regards, -Vlad ___ gtk-list mailing list [EMAIL PROTECTED] http://mail.gnome.org/mailman/listinfo/gtk-list
Re: GtkClist signals and double click
On Fri, 4 Aug 2000, Salvador Ramirez wrote: Hi, > Hi, > > I would like to know why the double click event is not implemented > as a signal in some GTK+ widgets? I tried to make a GtkClist in which > the user could select a row either with a simple selection and then > pressing a button and with a double click over the row. It would be > far simpler to connect a supposed "double_click" signal with the same > callback (for example) connected to the button. But as this is not > so you have to connect the "button_press_event" with a more complex > callback where you have to ask for some other low level events (as > explained on the GTK+ FAQ). As for non-existance of "double-clicked": it's obvious that double click consists of two clicks, so in case of supporting "double-clicked" signal all mouse clicks would have to be handled with a doubleclick delay (in order gtk was able to determine what click it was - single click or double click). As I understand, gtk developers decided that this was not the right thing to do (I think they were right too). As for CList - in most selection modes (except GTK_SELECTION_SINGLE) it seems to me that double click will have the same effect as single click - so you shouldn't worry about handling it separately. > Well, I am still trying to get this working. I know GtkClist elements > have a member structure called selection of type GList. When there is > nothing selected, selection is NULL? selection have a pointer called > data, this data is the data available on the selected row? what is > its format? I tried to print out this data pointer casted to (char *) > but I got a segmentation fault. > Any help will be very appreciated, See FAQs. As I remember, 'selection' is NULL if nothing is selected, if it's not NULL, then if selection mode is SINGLE or BROWSE, then selection->data is the index of selected row, otherwise it or the very 'selection' is a GList* of selected row indices. See documentation. > thanks in advance! > > ---sram > > ___ > gtk-list mailing list > [EMAIL PROTECTED] > http://mail.gnome.org/mailman/listinfo/gtk-list > Best regards, -Vlad ___ gtk-list mailing list [EMAIL PROTECTED] http://mail.gnome.org/mailman/listinfo/gtk-list
Re: Closing a gtk app from a menu
On Sat, 5 Aug 2000, Ian Thompson-Bell wrote: > In a simple App it is easy to exit a programme either via the window > close button or a menu option named quit which is connected to > gtk-main-quit(). However, in most apps it is desirable to check the > user actually wants to exit before shutting down the programme. Via the > window close button this is straightforward - you just connect a > callback to the delete event and return true or false as appropriate. > gtk_main_quit can then be connected to the destroy event which I > understand is sent if the delete event callback returns FALSE. The > question I have is how to achieve the same behaviour from a menu > selection. I cannot connect it directly to the dlelete event callback > because the event has not happened and the subsequent destroy event does > not occur. I just don't get your problem - connect a handler for activation of menuitem that will call the function you connected to be invoked for "delete-event", check return value and invoke gtk_main_quit() if it returned FALSE. > Ian Best regards, -Vlad ___ gtk-list mailing list [EMAIL PROTECTED] http://mail.gnome.org/mailman/listinfo/gtk-list
Re: GtkClist signals and double click
On Sun, 6 Aug 2000, Salvador Ramirez wrote: > Vlad Harchev wrote: > > > Well, I am still trying to get this working. I know GtkClist elements > > > have a member structure called selection of type GList. When there is > > > nothing selected, selection is NULL? selection have a pointer called > > > data, this data is the data available on the selected row? what is > > > its format? I tried to print out this data pointer casted to (char *) > > > but I got a segmentation fault. > > > Any help will be very appreciated, > > > > See FAQs. As I remember, 'selection' is NULL if nothing is selected, if it's > > not NULL, then if selection mode is SINGLE or BROWSE, then selection->data is > > the index of selected row, otherwise it or the very 'selection' is a GList* of > > selected row indices. See documentation. > > I couldn't find documentation on what information contain > selection->data. The GTK+ > manual does not cover this. Where can I find information on this? I mean > on how > to get the index (or data itself) of the selected row of a gtk_clist > double click? See in GTK FAQ how to detect double clicks. As for selections - I already told you what the value of clist->selection means for several selection modes. As for others - just do a small guesswork (coupled with a testsuite) and you'll discover what it means. > I tried to write a callback for the select_row and unselect_row signal > where I > keep the selected row index on a variable but the problems arises when I > have > already selected a row on the gtk_clist and then do the double click on > the same > row because with the first click I unselect the already selected row. Don't use this approach. > Thanks > > ---sram > Best regards, -Vlad ___ gtk-list mailing list [EMAIL PROTECTED] http://mail.gnome.org/mailman/listinfo/gtk-list
Re: window visibility notification
On Sat, 5 Aug 2000, Ben K wrote: > i have a program that updates a few labels very frequently based on some > system stuff. there is an idle function that uses up a great deal of > processing power. what i want to do is only have it update when it is on > the screen, thereby reducing the amount of processor it takes up; if i want > it to stop sucking resources, i'll just collapse it or move it to another > desktop etc. > > i looked at GDK_VISIBILITY_NOTIFY_MASK, but it seems like i would have to > make a lot of assumptions in order to use this. if i collapse the window, > it creates two of these events, if i move to another desktop it only makes > one. my initial idea was to have a counter that increments each time the > visibility function is called, and it would toggle the updating based on the > parity of the counter. I don't think that not performing drawing on labels of invisble window and performing drawing will differ that much in CPU utilization (the only exception is when strings drawn in labels differ in size greatly, that leads to constant resizing of the window). If I were you, I wouldn't bother with it at all. As for checking the visibility of widget - may be GTK_WIDGET_VISIBLE() will be the solution (I don't know what it returns)? > if anyone has any ideas about this, of has done it before, thanks for your > response. > -ben k. > > > Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com > > > ___ > gtk-list mailing list > [EMAIL PROTECTED] > http://mail.gnome.org/mailman/listinfo/gtk-list > Best regards, -Vlad ___ gtk-list mailing list [EMAIL PROTECTED] http://mail.gnome.org/mailman/listinfo/gtk-list
Re: Question about libglade
On Sun, 6 Aug 2000, Juan Pablo Romero wrote: Hi, > Hi > > I have defined a callback for the `realize' signal > within glade. When I use the generated code > everything is ok, but when I use libglade, the > callback is never called. Is there something I'm > missing? Is you handler static or not? It shouldn't be static (otherwise libglade won't be able to find out the pointer to that function at runtime - though it should issue a warning). Anyway - this is not the right list to discuss this. > Thanks. > Best regards, -Vlad ___ gtk-list mailing list [EMAIL PROTECTED] http://mail.gnome.org/mailman/listinfo/gtk-list
Re: installing gtk+1.1.9
On Fri, 4 Aug 2000, John Kofi Dogbe wrote: Hi, This is very old version of gtk+ - current is 1.2.8. Try compiling it. > I'm having a problem installing gtk+-1.1.9 on Irix 6.5. I did > ./configure which apparently did not make any complains and ended up > with the following errors during make (I'm copying everything I got when > make started and terminated with the error): > make all-recursive > Making all in po > don't know how to make deNONE (bu42). > *** Error code 1 (bu21) > *** Error code 1 (bu21) > > Any help? The INSTALL instructions tells me it should be straight > forward, so what am I missing? > thanks, > John > Best regards, -Vlad ___ gtk-list mailing list [EMAIL PROTECTED] http://mail.gnome.org/mailman/listinfo/gtk-list
Re: gtk file browser
On Tue, 25 Jul 2000 [EMAIL PROTECTED] wrote: Hi, >Hi all >Many recent applications use the gtk, in particular the gtk > widget file browser, for ex. mozilla, gvim, gedit, spruce, ... But I > have a problem with this widget: it doesn't display hidden files and > directories (whose names begins with a dot). Thus it is impossible to > chose such a file. I wouls like to ask if this is a known defficiency > of gtk, since it has been there since there from the first version of > gtk and no one seems to care. But it is very frustrating to me, for > example, how can I browse and load files in a directory such as .gimp, > .netscape or .spruce ? > I would like very much to put this feature on the wish list > but don't know how. Or perhaps there is way to enter the directory > .something after all but is not documented. It seem rather strange to > me that a modern widget set such as gtk lack such an elementary > feature. > Please answer to me directy because I am not subscribing to > the list. I am writing to this list because I am very frustrated at > the lack of this feature and can't find any other way to raise this > point. I have thought that may be gtk-1.2 would have it, but I am > wrong so if I don't raise this point may be gtk-1.3, gtk-1.4 still > dont allow displaying hiden files and directories. >Thanks for any information. Yes, I would like to have ability to directly select dotfiles in GtkFile selection menu too. Currently, the following works: put the dot in the entry and press tab - all dot-directories and dot-files will be shown. If you are app developer, you can recommend this hack to the users. > -- > PHAM Dinh Tuan | e-mail: [EMAIL PROTECTED] > Laboratoire de Modelisation et Calcul | Tel: +33 4 76 51 44 23 > BP 53, 38041 Grenoble cedex 9 (France) | Fax: +33 4 76 63 12 63 Best regards, -Vlad ___ gtk-list mailing list [EMAIL PROTECTED] http://mail.gnome.org/mailman/listinfo/gtk-list
Re: GTK+ installation error
On Mon, 7 Aug 2000, Ibrahim El-Shafei wrote: Hi, > Dear sir, > > When I was trying to install GTK+-1.2.8, I received a message when I > wrote ./configure saying that glib-1.2.8 is found, but the glib (1.2.3) is > still on my computer, ok. When I tried to uninstall glib-1.2.3 I received an > error. the error is attached with this e-mail (log file). What can I do? > Thanks for your help. You should specify location of installed glib you want to use using argument --with-glib-prefix=PATH of 'configure' for gtk. Also make sure that you've called 'ldconfig' after installing glib. > Yours, > Ibrahim El-Shafei > Best regards, -Vlad ___ gtk-list mailing list [EMAIL PROTECTED] http://mail.gnome.org/mailman/listinfo/gtk-list
Re: GtkClist signals and double click
On Sun, 6 Aug 2000, Salvador Ramirez wrote: > Vlad Harchev wrote: > [deleted] > > > I couldn't find documentation on what information contain > > > selection->data. The GTK+ > > > manual does not cover this. Where can I find information on this? I mean > > > on how > > > to get the index (or data itself) of the selected row of a gtk_clist > > > double click? > > > > See in GTK FAQ how to detect double clicks. > > As I already said, in the GTK+'s faq is only a very simple example > explaining > how to catch the double click but never how to retrieve the information > of > the row double clicked. I still can't figure out how to do that. Use the gtk_clist_get_selection_info - pass it the coordinates of the button-press-event and it will return the row and column number. > > As for selections - I already told you what the value of clist->selection > > means for several selection modes. As for others - just do a small guesswork > > (coupled with a testsuite) and you'll discover what it means. > > Sorry, I am quite newbie on GTK+. Could you please give an example with > some > code? What exactly it should demonstrate? Have you seen examples supplied with gtk source code? As for selections - do you really need the selection modes (GTK_SELECTION_MULTIPLI E or GTK_SELECTION_EXTENDED) for which I failed to describe the meaning of 'selection->data'? > > > I tried to write a callback for the select_row and unselect_row signal > > > where I > > > keep the selected row index on a variable but the problems arises when I > > > have > > > already selected a row on the gtk_clist and then do the double click on > > > the same > > > row because with the first click I unselect the already selected row. > > > > Don't use this approach. > > Yes, I knew that, but I have to solve this problem someway.. > > Thanks a lot for you patience, > > ---sram > Best regards, -Vlad ___ gtk-list mailing list [EMAIL PROTECTED] http://mail.gnome.org/mailman/listinfo/gtk-list
Re: Images.
On Mon, 7 Aug 2000, Gonzalo Montesdeoca wrote: > > How can draw a image (RGB) only with GTK+ without use GDK ? It seems that drawing images without the use of GDK is very tricky. Why do you want not to use GDK for drawing images? GTK uses it itself - why you can't? > Thanks. > > Gonzalo Montesdeoca Best regards, -Vlad ___ gtk-list mailing list [EMAIL PROTECTED] http://mail.gnome.org/mailman/listinfo/gtk-list
Re: How to "grey out" items?
On Mon, 7 Aug 2000, David J. Topper wrote: > Hi all, > > Getting back into GTK again. Trying to expand my little application > into different windows and such. I'm trying to create a "main" window > which, among other things, establishes a connection to a server > process. But once the user clicks on "connect" I want all the other > widgets (eg., text boxes, range widgets, pulldowns) to be "greyed out" > so that you can still see values but not edit anything. > > Is this possible? > > Email responses preferred. Others already replied that you can use gtk_widget_set_sensitive. Also you can simply pop up the modal window with message something like "please, wait". > Thanks, > > DT > -- > Technical Director - Virginia Center for Computer Music > http://www.people.virginia.edu/~djt7p > Best regards, -Vlad ___ gtk-list mailing list [EMAIL PROTECTED] http://mail.gnome.org/mailman/listinfo/gtk-list
Re: X-Display properties
On Tue, 8 Aug 2000, Joachim Backes wrote: > Question: How to get info about the X-Window display properties such as > screen dimensions, resolution, visuals? As for visuals: voidgdk_query_depths(gint **depths, gint *count); voidgdk_query_visual_types (GdkVisualType **visual_types, gint *count); GList* gdk_list_visuals(void); gintgdk_visual_get_best_depth (void); GdkVisualType gdk_visual_get_best_type (void); GdkVisual* gdk_visual_get_system (void); GdkVisual* gdk_visual_get_best (void); GdkVisual* gdk_visual_get_best_with_depth (gint depth); GdkVisual* gdk_visual_get_best_with_type (GdkVisualType visual_type); GdkVisual* gdk_visual_get_best_with_both (gint depth, GdkVisualType visual_type); As for screen: gchar* gdk_get_display (void); gintgdk_screen_width(void); gintgdk_screen_height (void); gintgdk_screen_width_mm (void); gintgdk_screen_height_mm(void); > Regards > > Joachim Backes > > -- > > Joachim Backes <[EMAIL PROTECTED]> | Univ. of Kaiserslautern > Computer Center, Supercomputing Division | Phone: +49-631-205-2438 > D-67653 Kaiserslautern, PO Box 3049, Germany | Fax: +49-631-205-3056 > -+ > WWW: http://hlrwm.rhrk.uni-kl.de/home/staff/backes.html > > > ___ > gtk-list mailing list > [EMAIL PROTECTED] > http://mail.gnome.org/mailman/listinfo/gtk-list > Best regards, -Vlad ___ gtk-list mailing list [EMAIL PROTECTED] http://mail.gnome.org/mailman/listinfo/gtk-list
RE: Images.
On Tue, 8 Aug 2000, Gonzalo Montesdeoca wrote: Hi Gonzalo, > > On Mon, 7 Aug 2000, Gonzalo Montesdeoca wrote: > > > > > How can draw a image (RGB) only with GTK+ without use GDK ? > > It seems that drawing images without the use of GDK is very tricky. > Why do you want not to use GDK for drawing images? GTK uses it itself - why > you can't? > > > Thanks. > > > > Gonzalo Montesdeoca > > Best regards, > -Vlad > > Hi Vlad : > > I want to use GTK+ because looking for the functions that i use to view > images, GIMP don't use it. GIMP use a widget preview and i don't know how to > use. My problem is that in Win32, the image is black on the screen, and i > don't know why and GIMP do it. if you know why i am grateful that you write > me a e-mail. > Sorry for my poor english and thanks. If you need only to show some not very big image and don't care about performance, you could convert an image from any format to xpm format and then show it using gdk - that should work anyway even on win32. If it doesn't, then it's a bug in gtk/gdk (or it's not implemented yet). I've attached a sample file that show xpm file (it could also be found in the source tree of gtk, in /examples/pixmap/pixmap.c). You could use the same approach. If even that example doesn't work (I don't expect this :), submit a bugreport with details of your configuration. > >Gonzalo Montesdeoca > Best regards, -Vlad /* example-start pixmap pixmap.c */ #include /* XPM data of Open-File icon */ static const char * xpm_data[] = { "16 16 3 1", " c None", ". c #", "X c #", "", " .. ", " .XXX.X. ", " .XXX.XX. ", " .XXX.XXX.", " .XXX.", " .XXX.", " .XXX.", " .XXX.", " .XXX.", " .XXX.", " .XXX.", " .XXX.", " .", "", ""}; /* when invoked (via signal delete_event), terminates the application. */ void close_application( GtkWidget *widget, GdkEvent *event, gpointer data ) { gtk_main_quit(); } /* is invoked when the button is clicked. It just prints a message. */ void button_clicked( GtkWidget *widget, gpointer data ) { printf( "button clicked\n" ); } int main( int argc, char *argv[] ) { /* GtkWidget is the storage type for widgets */ GtkWidget *window, *pixmapwid, *button; GdkPixmap *pixmap; GdkBitmap *mask; GtkStyle *style; /* create the main window, and attach delete_event signal to terminating the application */ gtk_init( &argc, &argv ); window = gtk_window_new( GTK_WINDOW_TOPLEVEL ); gtk_signal_connect( GTK_OBJECT (window), "delete_event", GTK_SIGNAL_FUNC (close_application), NULL ); gtk_container_set_border_width( GTK_CONTAINER (window), 10 ); gtk_widget_show( window ); /* now for the pixmap from gdk */ style = gtk_widget_get_style( window ); pixmap = gdk_pixmap_create_from_xpm_d( window->window, &mask, &style->bg[GTK_STATE_NORMAL], (gchar **)xpm_data ); /* a pixmap widget to contain the pixmap */ pixmapwid = gtk_pixmap_new( pixmap, mask ); gtk_widget_show( pixmapwid ); /* a button to contain the pixmap widget */ button = gtk_button_new(); gtk_container_add( GTK_CONTAINER(button), pixmapwid ); gtk_container_add( GTK_CONTAINER(window), button ); gtk_widget_show( button ); gtk_signal_connect( GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(button_clicked), NULL ); /* show the window */ gtk_main (); return 0; } /* example-end */
Re: row in the clist
On Tue, 8 Aug 2000, Fabiano Fantini Vitale wrote: Hi, > Hi , > > I want to know if exists a function wich return the number > of the current selected row. > I try //return (gint)clist->selected->data//, but returned a strange number Such function doesn't exist since there are selection modes in which several rows could be selected. If it's not the case for you (i.e. you have the list with selection modes GTK_SELECTION_{SINGLE,BROWSE}), then the following could be used as a function (returns -1 if nothing is selected): int selected_row(GtkWidget* l) { GList* sel = GTK_CLIST(l)->selection; return sel ? int(sel->data) : -1; }; > thanks > -- > Fabiano Fantini Vitale <[EMAIL PROTECTED]> > Conectiva S.A. > > ___ > gtk-list mailing list > [EMAIL PROTECTED] > http://mail.gnome.org/mailman/listinfo/gtk-list > Best regards, -Vlad ___ gtk-list mailing list [EMAIL PROTECTED] http://mail.gnome.org/mailman/listinfo/gtk-list
Re: forcing immediate redraws?
On Tue, 8 Aug 2000, Gary Scavone wrote: Hi, You should add the following after each of gtk_widget_set_state: while (gtk_events_pending()) gtk_main_iteration(); Note: user will be able to interact with other widgets then (i.e. press other button), so probably you will have to disable them! > > I have an app in which buttons are associated with sounds. I need to > offer a feature such that a sound is played and its corresponding > button is "highlighted" during playback only. > > I have a little routine that looks roughly like this: > > gtk_widget_set_state ( button, GTK_STATE_ACTIVE ); > play_button_sound ( button ); > gtk_widget_set_state ( button, GTK_STATE_NORMAL ); > > Unfortunately, the drawing of the button doesn't seem to happen until > I leave my routine and return to the gtk_main() loop. Is there a way > to force the redraw to happen immediately? > > Best regards, -Vlad ___ gtk-list mailing list [EMAIL PROTECTED] http://mail.gnome.org/mailman/listinfo/gtk-list
Re: GTK+ installation error
On Tue, 8 Aug 2000, Ibrahim El-Shafei wrote: > Thank you very much for your help, I think I succeded in removing the > GLIB-1.2.3 because I got a new error message (Attached). I uninstalled the > old version of GTK+, but the error is still there. What to do next? Are you sure that your dynamic linker is allowed to search for libraries in the directory where glib is installed? If it's linux, I guess it's installed in /usr/local/lib - in this case insure that file /etc/ld.so.conf has a line "/usr/local/lib" in it. If it doesn't have this line, add it and run 'ldconfig' as root. > ----- Original Message - > From: "Vlad Harchev" <[EMAIL PROTECTED]> > To: "Ibrahim El-Shafei" <[EMAIL PROTECTED]> > Cc: "GTK+ Mailing List" <[EMAIL PROTECTED]> > Sent: Monday, August 07, 2000 10:26 AM > Subject: Re: GTK+ installation error > > > > On Mon, 7 Aug 2000, Ibrahim El-Shafei wrote: > > > > Hi, > > > > > Dear sir, > > > > > > When I was trying to install GTK+-1.2.8, I received a message when I > > > wrote ./configure saying that glib-1.2.8 is found, but the glib (1.2.3) > is > > > still on my computer, ok. When I tried to uninstall glib-1.2.3 I > received an > > > error. the error is attached with this e-mail (log file). What can I do? > > > Thanks for your help. > > > > You should specify location of installed glib you want to use using > argument > > --with-glib-prefix=PATH of 'configure' for gtk. Also make sure that you've > > called 'ldconfig' after installing glib. > > > > > Yours, > > > Ibrahim El-Shafei > > > > > > > Best regards, > > -Vlad > > > > > > ___ > > gtk-list mailing list > > [EMAIL PROTECTED] > > http://mail.gnome.org/mailman/listinfo/gtk-list > Best regards, -Vlad ___ gtk-list mailing list [EMAIL PROTECTED] http://mail.gnome.org/mailman/listinfo/gtk-list
Re: A queer problem
On Thu, 10 Aug 2000, Nikhil Bhavadas K. wrote: Hi, > I had written an application having a progress bar in a dialog window. > As an illustration, I am sending a small GTK program that has a button, clicking > on which a dialog window with a progress bar appears. > My first problem might be very common. How to force response on a > dialog window? A quick look of FAQ did not reveal much details. In my > program, every time you click on the button separate dialog windows appear. My > requirement is that when a dialog window appears, a person should be able to > click only on the dialog window and any click on the parent window should not > have any affect. Let me say that many GTK+/GNOME programs show this behavior. > My version of gnome-games(1.0.51) have some games like Same Gnome that show > dialog windows every time you click on the close button on the top right > window. Some programs like gEdit crashed when I clicked on the close button > twice. Use gtk_window_set_modal (GTK_WINDOW(dialog),TRUE) for making window modal - i.e. only that window will receive mouse and key events. As for bug in gedit you've described - report that bug on bugs.gnome.org please. > A queer problem seen when compiling and running this program is that > when you create many dialog windows by clicking on the button, and killed some > of them, error messages like > > Gtk-CRITICAL **: file gtkprogress.c: line 554 (gtk_progress_set_value): > > assertion `GTK_IS_PROGRESS (progress)' failed. Because you timeout function gets called, and it tries to use non-existing progress bar. > > Gtk-WARNING **: invalid cast from `(unknown)' to `GtkProgress' > > appears. Now when trying to create another dialog window by clicking once more, > the program segfaults with the message > > Gtk-WARNING **: invalid cast from `GtkDialog' to `GtkProgress' This happens because malloc call returns the same memory location that was occupied with already-destroyed progress bar. > The behavior is unpredictable. Sometimes this occurs when we just move the mouse > over the button. This happens because mallocs happen when you move the mouse (tooltips?). > What is this `cast' problem? Where have I gone wrong? Or is this some > bug? Sorry if the mail has become too long. I just wanted to state my > problem clealry. > Thanks! > Regards, >Nikhil. > -- > "Once a satyâgrahi, always a satyâgrahi" > Nikhil Bhavadâs K. <[EMAIL PROTECTED]> > <[EMAIL PROTECTED]> > Best regards, -Vlad ___ gtk-list mailing list [EMAIL PROTECTED] http://mail.gnome.org/mailman/listinfo/gtk-list
Re: Stalls in idle loop
On Wed, 9 Aug 2000, Nick Matsakis wrote: > > I'm having a problem with a GTK-based application. Simply, I have written > a program which makes extensive use of an idle function, installed with > gtk_idle_add(). Periodically, for no apparent reason, the GTK main loop > ceases to run the idle function. Moving the mouse, pressing a key on the > keyboard, or otherwise sending an event to the program causes the idle > loop to be run again. My questions, therefore, are: > > 1) Is this a known problem? > 2) Is there an elegant solution? > 3) If not, is there an inelegant solution? My one thought is to send some > sort of "null event" at the end of the idle loop, ensuring that there is > always an event in the queue whenever the idle loop ends. I don't know > why that might work, but it seems to me that if moving the mouse fixes > the problem, this might too. > 4) On a related note, is there a bug list for GTK on the web somewhere? I > couldn't find one. All gtk bugs could be browsed/added on http://bugs.gnome.org (choose gtk+ category). Also, you didn't specify the version of gtk you are using (the recent is 1.2.8). Also, I think you can explore the problem by stracing or ltracing the gtk program when iddle function is ceased to run - may be it's not gtk (more precisely, glib) problem but the problem with your X server/Xlib/glibc - in what function program stays when the problem happens? Also, how often that iddle function stalls? Does plain waiting "unstalls" it? > Nick Matsakis Best regards, -Vlad ___ gtk-list mailing list [EMAIL PROTECTED] http://mail.gnome.org/mailman/listinfo/gtk-list
Re: setting button INSENSITIVE
On Wed, 9 Aug 2000, Gary Scavone wrote: Hi Gary, > > I have a button that calls a routine. If a certain condition exists > in that routine, I want to set the button state to INSENSITIVE. When > I do this, however, my whole application becomes insensitive ... I > suspect that the button routine is not returning properly after > changing its state. If this happens on a regular basis, then it's a bug in your program. Do you use gtk_widget_set_sensitive() to disable widget? Also, when your application becomes insensitive, does it change to the look insensitive widgets have (greyed out or what) or it just doesn't receive any mouse input? (If yes, this could be a pointer/keyboard/server grab - some widget grabs pointer - i.e. no mouse events reach other widgets expect that one) (I had this problem when trying to pop up the window from the either select_row event or button_press_event on CList). In this case, people recommend to use one-shot idle function (gtk_idle_add) that will run only once and that will do the things you want. > What would be the proper way to go about this? Thanks. > > *** > * Gary Scavone* > * Center for Computer Research in Music & Acoustics * > * Stanford University * > * [EMAIL PROTECTED] * > * http://www-ccrma.stanford.edu/~gary/* > *** > > > ___ > gtk-list mailing list > [EMAIL PROTECTED] > http://mail.gnome.org/mailman/listinfo/gtk-list > Best regards, -Vlad ___ gtk-list mailing list [EMAIL PROTECTED] http://mail.gnome.org/mailman/listinfo/gtk-list
Re: Splash screen.
On Wed, 9 Aug 2000, Naba Kumar wrote: > Thanks Steve. The idea of producing a splash screen > was great. But it uses xpm file for the image. As I > have already told the image is going to be anything > other than xpm. Can there be some way to display other > file formats (eg. jpg formate)in the given function? If you don't mind using gnome libs, then use gnome pixmap + imlib (this way you will be able to use a multitude of file formtas imlib understands) and this function (note: it's C++ - you will have to reorder things a little) GtkWidget* load_image(char* file) { GdkImlibImage* im = gdk_imlib_load_image(file); if (!im) return NULL; int imw = im->rgb_width, imh=im->rgb_height; GtkWidget* ret = gnome_pixmap_new_from_imlib_at_size(im,imw,imh); gdk_imlib_destroy_image(im); return ret; } Also you can use plain implib for loading, but it's trickier as I remember. Imlibg supports jpg, gif, png, tiff, xpm, xbm and probably some others. > --- Steve Ramsay <[EMAIL PROTECTED]> wrote: > > > // show the splash screen > > void splash_screen(void) > > { > > // make a window for splash scrren, make it a popup > > so it will stay on > > // top of everything. > > GtkWidget *MainFrame = gtk_window_new > > (GTK_WINDOW_POPUP); > > gtk_object_set_data (GTK_OBJECT (MainFrame), > > "Caris", > > MainFrame); > > > > // set the size to that of our splash image. > > gtk_widget_set_usize (MainFrame, 428, 314); > > gtk_window_set_title (GTK_WINDOW > > (MainFrame), "Caris"); > > // center it on the screen > > gtk_window_set_position(GTK_WINDOW > > (MainFrame), > > GTK_WIN_POS_CENTER); > > > > // set up key and mound button press to hide splash > > screen > > > > > gtk_signal_connect(GTK_OBJECT(MainFrame),"button_press_event", > > > > GTK_SIGNAL_FUNC(splash_button_pressed),NULL); > > > > > gtk_signal_connect(GTK_OBJECT(MainFrame),"key_press_event", > > > > GTK_SIGNAL_FUNC(splash_key_pressed),NULL); > > gtk_widget_add_events(MainFrame, > > GDK_BUTTON_PRESS_MASK| > > > > GDK_BUTTON_RELEASE_MASK| > > GDK_KEY_PRESS_MASK); > > > > // make the image for the splash screen > > GtkWidget* pixmap = > > create_pixmap_from_data(MainFrame, > > splash_xpm); > > > > gtk_container_add (GTK_CONTAINER > > (MainFrame),pixmap); > > gtk_widget_show(pixmap); > > gtk_widget_show(MainFrame); > > > > // force it to draw now. > > gdk_flush(); > > > > // go into main loop, processing events. > > while(gtk_events_pending() || > > !GTK_WIDGET_REALIZED(pixmap)) > > gtk_main_iteration(); > > > > // after 3 seconds, destroy the splash screen. > > gtk_timeout_add( 3000, splash_screen_cb, > > MainFrame ); > > } > > > __ > Do You Yahoo!? > Kick off your party with Yahoo! Invites. > http://invites.yahoo.com/ > > ___ > gtk-list mailing list > [EMAIL PROTECTED] > http://mail.gnome.org/mailman/listinfo/gtk-list > Best regards, -Vlad ___ gtk-list mailing list [EMAIL PROTECTED] http://mail.gnome.org/mailman/listinfo/gtk-list
Re: spacebar accelerator key?
On Thu, 10 Aug 2000, Gary Scavone wrote: Hi Gary, > > This is probably a stupid question, but how does one specify that the > spacebar be used as an accelerator key for a menu item (using > GtkItemFactoryEntry)? Thanks. I have an impression that it's impossible to have plain characters without modifiers to be used as accelerators for menu items. I hope someone will correct me if I'm wrong. You can fake accelerator by connecting to button_press_event on your window, checking for space, and if it was space pressed, calling your action and returning TRUE. > *** > * Gary Scavone* > * Center for Computer Research in Music & Acoustics * > * Stanford University * > * [EMAIL PROTECTED] * > * http://www-ccrma.stanford.edu/~gary/* > *** Best regards, -Vlad ___ gtk-list mailing list [EMAIL PROTECTED] http://mail.gnome.org/mailman/listinfo/gtk-list
Re: selected line in a GtkCtree
On Thu, 10 Aug 2000, Fabiano Fantini Vitale wrote: > Hi, > > I want to know how I can get the GtkCTreeNode* which is in a > selected line in a GtkCTree > I try //GTK_CLIST(ctree)->selection->data// but this segment > return a GtkCTreeRow *. Use gtk_ctree_find_node_ptr for getting GtkCTreeNode* from that GtkCTreeRow*. > thanks > -- > Fabiano Fantini Vitale <[EMAIL PROTECTED]> > Conectiva S.A. Best regards, -Vlad ___ gtk-list mailing list [EMAIL PROTECTED] http://mail.gnome.org/mailman/listinfo/gtk-list
Re: Stalls in idle loop
On Thu, 10 Aug 2000, Nick Matsakis wrote: > > On Thu, 10 Aug 2000, Vlad Harchev wrote: > > > Also, you didn't specify the version of gtk you are using (the recent is > > 1.2.8). > > I'm not sure which version I am using. How can I find this out? The following ints descibe gtk version: gtk_major_version gtk_minor_version gtk_micro_version So report their values here. Also it would be nice if you've said what OS do you use, kernel version (that can matter if it's very ancient), and a version of X too. > > Also, I think you can explore the problem by stracing or ltracing the gtk > > program when iddle function is ceased to run - may be it's not gtk (more > > precisely, glib) problem but the problem with your X server/Xlib/glibc - in > > what function program stays when the problem happens? > > It's hard to say. The program displays live video, captured from a frame > grabber, so 30 times a second it gets a signal indicating a new What signal - it is OS signal like SIGUSR1? Or is it timeout function? > frame. The signal handler continues to be run in the stalled state. Is > there any way to use GDB (or some other utility) to stop a program at a > particular time and print a stack trace? I can't set a break point > because I don't know where the function is during that time. Run your program from the xterm, in foreground. Get it's PID (may be using 'ps -C program-name'). Remember it:). Then invoke gdb while in the directory where your program binary resides. Type the following in gdb prompt: file program-name at pid-of-your-program c The program will continue execution. When it stalls, press Control-C in the xterm from which you've run the program (but don't try to send any events to your program - i.e. don't move your mouse over it, etc). After pressing Control-C, your program will be frozen and you will be able to inspect it in gdb. So, switch to gdb, type 'bt' - it will print the name of the functions it's in. It would be nice if you posted it here. To resume execution of your program, type c again. > > Also, how often that idle function stalls? Does plain waiting "unstalls" it? > > The stalls are erratic, and waiting doesn't seem to unstall it, but I've > waited at most 22 seconds before sending some input to the computer. > Also, could you add another idle function that will print something (or in any other way will prove that it's get called). Does the second idle function stalls with first or not? > Nick Matsakis > > > Best regards, -Vlad ___ gtk-list mailing list [EMAIL PROTECTED] http://mail.gnome.org/mailman/listinfo/gtk-list
Re: spacebar accelerator key?
On Fri, 11 Aug 2000, Vlad Harchev wrote: Just small fix. > On Thu, 10 Aug 2000, Gary Scavone wrote: > > Hi Gary, > > > > > This is probably a stupid question, but how does one specify that the > > spacebar be used as an accelerator key for a menu item (using > > GtkItemFactoryEntry)? Thanks. > > I have an impression that it's impossible to have plain characters without > modifiers to be used as accelerators for menu items. I hope someone will > correct me if I'm wrong. > > You can fake accelerator by connecting to button_press_event on your window, ^key_press_event of course. > checking for space, and if it was space pressed, calling your action and > returning TRUE. > > > *** > > * Gary Scavone* > > * Center for Computer Research in Music & Acoustics * > > * Stanford University * > > * [EMAIL PROTECTED] * > > * http://www-ccrma.stanford.edu/~gary/* > > *** > > Best regards, > -Vlad > > Best regards, -Vlad ___ gtk-list mailing list [EMAIL PROTECTED] http://mail.gnome.org/mailman/listinfo/gtk-list
Re: GtkNotebook signal: switch_page
On Thu, 10 Aug 2000 [EMAIL PROTECTED] wrote: > > I cannot seem to get the switch_page signal to work at all in my > application. Hrmm... > > Just as a simple test I have connected a callback to that signal on one of > my notebooks with a simple printf statement... and nothing happens when I > switch tabs within the interface... Most probably you don't see output of your handlers because of the IO buffering. Just add "\n" to the end of printf format string, so libc will flush buffers after each printf call. > Any help would be greatly appreciated. > > > Leeman Strout > [EMAIL PROTECTED] > > here's the relevant stuff... > > > interface.c: > notebook1 = gtk_notebook_new (); > gtk_widget_set_name (notebook1, "notebook1"); > gtk_widget_ref (notebook1); > gtk_object_set_data_full (GTK_OBJECT (bfgmj), "notebook1", notebook1, > (GtkDestroyNotify) gtk_widget_unref); > gtk_widget_show (notebook1); > gtk_box_pack_start (GTK_BOX (vbox1), notebook1, TRUE, TRUE, 0); > > > > gtk_signal_connect (GTK_OBJECT (notebook1), "switch_page", > GTK_SIGNAL_FUNC (notebook1_switch_page), > GTK_NOTEBOOK(notebook1)); > > > callbacks.c: > > void > notebook1_switch_page (GtkNotebook *notebook, > GtkNotebookPage *page, > gint page_num, > gpointer user_data) > { gint i; > i = gtk_notebook_get_current_page (GTK_NOTEBOOK(user_data)); > printf ("current page: %d", i); > } > > > > ___ > gtk-list mailing list > [EMAIL PROTECTED] > http://mail.gnome.org/mailman/listinfo/gtk-list > Best regards, -Vlad ___ gtk-list mailing list [EMAIL PROTECTED] http://mail.gnome.org/mailman/listinfo/gtk-list
Re: Xlib error!
On Sun, 13 Aug 2000, Ben K wrote: There are two cases: you login to X as one user and try to start programs as another user, or something with X server is really broken. In the 1st case, you have to allow that user to connect to 1st user's X server by issuing xhost +ANOTHER-USER-NAME as the 1st user. Anyway, it's not a gtk problem - any of your X apps should refuse to start (try 'xterm' for example). > recently i've been getting this error whenever i try to run my gtk+ > programs! it does not happen all the time, but if it happens once, i cannot > get *any* X programs to run until i've restarted X. > > Xlib: connection to ":0.0" refused by server > Xlib: Client is not authorized to connect to Server > > Gtk-WARNING **: cannot open display: :0.0 > > help me please!! > -bennyk > Best regards, -Vlad ___ gtk-list mailing list [EMAIL PROTECTED] http://mail.gnome.org/mailman/listinfo/gtk-list
Re: Stalls in idle loop
On Mon, 14 Aug 2000, Nick Matsakis wrote: > > On Fri, 11 Aug 2000, Vlad Harchev wrote: > > > So report their values here. Also it would be nice if you've said what OS do > > you use, kernel version (that can matter if it's very ancient), and a version > > of X too. > > Ok, so I am running Red Hat Linux 6.2 (Zoot) with kernel 2.2.14-5.0 on an > i686. My GTK version is 1.2.6. I presume I'm using Xfree86 X11R6.3. > > > What signal - it is OS signal like SIGUSR1? Or is it timeout function? > > SIGUSR2, actually. I can't figure out how to tell gdb to run my program > normally, and not halt on signals. The continue command with a numeric Use 'handle' command for that (and 'help' for help :). > argument seems to only work with breakpoints. In any case, what I have > done is run my program until the bug/feature manifests itself, and the > attach gdb to the process and print out a stack trace. I did this four > times. Invariably, I get something that looks like this: > > #0 0x4031d17e in __select () from /lib/libc.so.6 > #1 0x40251dd8 in ?? () from /usr/X11R6/lib/libX11.so.6 > #2 0x401e18f8 in _XRead () from /usr/X11R6/lib/libX11.so.6 > #3 0x401e135d in _XEventsQueued () from /usr/X11R6/lib/libX11.so.6 > #4 0x401d58ea in XPending () from /usr/X11R6/lib/libX11.so.6 > #5 0x40153359 in gdk_event_prepare () from /usr/lib/libgdk-1.2.so.0 > #6 0x4018349a in g_main_iterate () from /usr/lib/libglib-1.2.so.0 > #7 0x401838f1 in g_main_run () from /usr/lib/libglib-1.2.so.0 > #8 0x400a85b9 in gtk_main () from /usr/lib/libgtk-1.2.so.0 > #9 0x8055453 in main () > #10 0x402889cb in __libc_start_main (main=0x8055260 , argc=1, > argv=0xbaa4, init=0x804a084 <_init>, fini=0x805577c <_fini>, > rtld_fini=0x4000ae60 <_dl_fini>, stack_end=0xba9c) > at ../sysdeps/generic/libc-start.c:92 I can't say something certain on this. Granted, this is not a gtk/gdk bug IMO, but some problem/bug with Xlib (I think). I hope someone from gtk-devel-list see this and examine the problem. > On Sat, 12 Aug 2000, Naba Kumar wrote: > > > I don't think this a problem, beacause it is the inherent property of > > the implementation. Gtk has no idea how many times it should call your > > function when it becomes idle. That's why (I suppose) it is called only > > once :-). > > It seems to me that it should continue to run your function as long as it > is idle, and your function should be smart enough to know when it should > be working and when it should not. You are correct that the idle function > shouldn't take a long time to run, but I expected that the process should > be: run the function, handle any pending events, run the function, handle > any pending events, etc. It doesn't seem right for the number of times > your idle function is run to depend on how many redraw requests or > whatever events your program gets. In any case, that is probably not the > problem here. Adding the idle function more than once makes the problem > _more likely_ to occur. As for hackish ways for solving the problem, I would recommend the following: Could you add a timeout function that does nothing but is invoked very often? > Nick Matsakis > Best regards, -Vlad ___ gtk-list mailing list [EMAIL PROTECTED] http://mail.gnome.org/mailman/listinfo/gtk-list
Re: Peeking into the event queue?
On Mon, 14 Aug 2000, Ian Britten wrote: > On Mon, 14 Aug 2000, Jon Trowbridge wrote: > > > Well, there is > > > > GdkEvent* gdk_event_peek(); > > > > that looks like it would do what you want. The source for the > > gtk_main_do_event() function has an example of its use. > > Ya, when I first saw it, I thought it would fix my problem too. However, > it only returns the first event in the queue, and there doesn't appear to > be any way to look at any remaining events in the queue (Which is what led > me into the source code in the first place to find the event queue, and > see what other functionality accessed it) > Thanks for all the suggestions so far though! Keep em coming! Why can't you just call XCheckIfEvent directly for now? > Ian Best regards, -Vlad ___ gtk-list mailing list [EMAIL PROTECTED] http://mail.gnome.org/mailman/listinfo/gtk-list
Re: gdk-pixbuf-animation
On Wed, 16 Aug 2000, Ben K wrote: > this may be the incorrect place to post this, but i'm hoping to get a little > help with the gdk_pixbuf_animation functions in gdk-pixbuf. basically my > problem is that i cannot seem to get a good logic structure to implement > this in my program. > > my best guess so far is to create a big struct that has the animation, the > drawable, and the drawing area in it, al la: > > struct gif { > GdkPixbufAnimation *foo; > GdkDrawable *drawable; > GtkWidget *drawing_area; > }; > > then in main(), i pass the struct to a function called animate(struct gif > *ptr), which calls render(struct gif *ptr) on a gtk timeout. the timeout > length varies depending on the length of the frame, accessed with > gdk_pixbuf_frame_get_delay_time( gdk_pixbuf_animation_get_frames(ptr)->data > ) > > this gives me trouble because i end up rendering the pixbuf before the > drawing area exists (seg), or i create an expose event on a drawing area > with NULL data (seg). I think you should connect your timeout function in the signal handler for "map" event on DrawingArea (i.e. when its GdkWindow is created on X server). This IMO will solve both of your problems. > please, if anyone could spare a minute do help drag this through my brain, > i'd truly appreciate it. > -bennyk > Best regards, -Vlad ___ gtk-list mailing list [EMAIL PROTECTED] http://mail.gnome.org/mailman/listinfo/gtk-list
Re: A problem with gtk+ apps
On Tue, 15 Aug 2000, Rich Shepard wrote: > There's an interesting annoyance with all apps that use gtk+ for the UI: > they prevent the window manager from complying with the -geometry option on > the command line that invokes the app. > > I run Xfce/xfwm for the GUI desktop/window manager (version 3.4.4 right > now). Each task bar button has an associated command line string to invoke > the application, and each command line uses the -geometry option to size and > place the window. This works just fine with aterms, pine, Navigator, Xess, > WordPerfect and so on. But, j-pilot (the PalmPilot desktop appliance) > ignores the settings. According to Judd Montgomery, j-pilot's author, this > holds true for other gtk apps, too. > > It would be very nice to have gtk apps honor that command line option as > other apps do. Is this a reasonable request to the developers? Every app should provide support for that commandline switch itself. For some apps, it may not make sense (if they open several windows), other apps can have constraints on min/max size of window or support slightly different syntax for geometry. For your convenience you can use a function from gnome-libs int gnome_parse_geometry(char* geometry,int* x,int* y,int *w,int* h) that will parse geometry string. It's easy to write function that will use that parsed information to adjust size and position of the window. > Thanks, > > Rich > Best regards, -Vlad ___ gtk-list mailing list [EMAIL PROTECTED] http://mail.gnome.org/mailman/listinfo/gtk-list
Re: How to set tooltips font size?
On Wed, 16 Aug 2000, alan wrote: > Dear sir, > > How to set tooltips font type and size? Use gtkrc functionality for this. For example, the following piece of gtkrc sets the color of background of tooltips and font to helvetica normal, 10 pt size -- style "gtk-tooltips-style" { font = "-*-helvetica-medium-r-normal--10-*-*-*-*-*-*-*" bg[NORMAL] = "#c0" } widget "gtk-tooltips" style "gtk-tooltips-style" -- You can force your app to load the given gtkrc file by using gtk_rc_add_default_file(char* filename) (AFAIR, before calling gtk_init!). > Please help me, thanks. > [EMAIL PROTECTED] Best regards, -Vlad ___ gtk-list mailing list [EMAIL PROTECTED] http://mail.gnome.org/mailman/listinfo/gtk-list
Re: HOWTO with GtkCTree and Select/Focus
On Wed, 16 Aug 2000, Chen, Frank wrote: > > > Hi, > > > > I'm seeking to learn how to change the graphical attributes when > > "focusing" or "selecting" items in a GtkCTree. > > > > My default background color for "selected" items in a GtkCTree is blue - > > how can I change this? You can control it using gtkrc: the following piece of gtkrc sets bg of items in gtkctree to blue: style "myclist" { bg[SELECTED] = { 0., 0., 1.0 } } class "GtkCList" style "myclist" (This will work since GtkCList is ancestor of GtkCTree). > > My default graphical presentation for "focused" items is a black border - > > how can I change this border to include a shaded background color? > > Seems it's possible to change that, but I don't know how (but it should also be possible using gtkrc files since that color is different for different gtk themes). > > Any pointer would be welcome. > > > > Cheers, > > > > Frank Chen Best regards, -Vlad ___ gtk-list mailing list [EMAIL PROTECTED] http://mail.gnome.org/mailman/listinfo/gtk-list
Re: A couple of questions
On Wed, 16 Aug 2000, rhfreeman wrote: Hi, > Hi folks, > > Just need to pick your brains about somethings! > > I've got this few lines of code scattered around in my code (in this > order) > > gtk_signal_emit_by_name(GTK_OBJECT(w_layout[current].drawing_area), > "expose_event", GINT_TO_POINTER(current)); > > static void expose_event(GtkWidget *widget, GdkEventExpose *event, gpointer > current_ptr) > { > gint current=GPOINTER_TO_INT(current_ptr); > gdk_draw_pixmap(widget->window, > widget->style->fg_gc[GTK_WIDGET_STATE(widget)], > w_layout[current].drawing_pixmap, 0, 0, 0, 0, > w_layout[current].width, w_layout[current].height); > } > > gtk_signal_connect(GTK_OBJECT(w_layout[current].drawing_area), > "expose_event", GTK_SIGNAL_FUNC(expose_event), GINT_TO_POINTER(current)); > > When the gtk_signal_emit_by_name() is called, I get this warning: > > Gtk-WARNING **: gtk_signal_collect_params(): invalid NULL pointer for return > argument type `gboolean' gtk_signal_emit_by_name accepts a variable list of arguments, the last one is ptr to return value (you don't pass it). Also, GINT_TO_POINTER(current) you pass to it will be used for GdkEventExpose *event, not for 'current_ptr' (it's bound when you connect the signal!). > Any ideas? > > On a second similar-ish front, if I've got this: > > gtk_signal_connect(GTK_OBJECT(w_layout[i].drawing_area), > "button_press_event", (GtkSignalFunc) button_press_event, > GINT_TO_POINTER(i)); > > to detect mouse clicks. Is there anyway I can tell if the shift button was > being held down at the same time as the click The .state member of GdkEventButton passed contains the currently pressed modifiers (it means the same as in GdkEventKey). > Ta folks!! > > Rich > Best regards, -Vlad ___ gtk-list mailing list [EMAIL PROTECTED] http://mail.gnome.org/mailman/listinfo/gtk-list
Re: fork
On Thu, 17 Aug 2000, Denis Serebro wrote: Hi, > > Hello, All. > > I try create a child process in gtk application. And I try create new window >with type GTK_TOPLEVEL_WINDOW in child process. >And I get very strange behaviour. When I try change window size or position or >something else, I get on console: Gtk wasn't supposed to be used this way. Also it's not thread-safe. Use a different approach. Best regards, -Vlad ___ gtk-list mailing list [EMAIL PROTECTED] http://mail.gnome.org/mailman/listinfo/gtk-list
Re: OK, now gtk_signal_emit_by_name() is confusing me!!!
On Thu, 17 Aug 2000, rhfreeman wrote: Hi Rich, > Hi folks, > > Now, I'm *REALLY* curious. First I have this bit of code, which breaks: > > gtk_signal_emit_by_name(GTK_OBJECT(w_layout[current].drawing_area), > "expose_event"); > > static void expose_event(GtkWidget *widget, GdkEventExpose *event, gpointer > current_ptr) > { > gint current=GPOINTER_TO_INT(current_ptr); > gdk_draw_pixmap(widget->window, > widget->style->fg_gc[GTK_WIDGET_STATE(widget)], > w_layout[current].drawing_pixmap, 0, 0, 0, 0, > w_layout[current].width, w_layout[current].height); > } > gtk_signal_connect(GTK_OBJECT(w_layout[current].drawing_area), > "expose_event", GTK_SIGNAL_FUNC(expose_event), GINT_TO_POINTER(current)); > > Which doesn't work at all, and gives me this: > > Gtk-WARNING **: gtk_signal_collect_params(): invalid NULL pointer for return > argument type `gboolean' > > .. and doesn't do the event. I've already told you what to do in my recent mail to you - the handler for "expose-event" returns a gbool (so correct your function first), and when doing gtk_signal_emit_by_name, you have to add a parameter - the pointer to return value, so your call should look like GdkEventExpose event;/*fill it as necessary*/ gboolean retval; gtk_signal_emit_by_name(GTK_OBJECT(w_layout[current].drawing_area), "expose_event",&event,&retval); > I also have this: > static void clist_size(GtkWidget *clist, GtkAllocation *allocation, gpointer > current_ptr) > { > // does stuff > } > > gtk_signal_emit_by_name(GTK_OBJECT(wl->signal_lists), "size_allocate"); > > gtk_signal_connect(GTK_OBJECT(w_layout[i].signal_lists), "size_allocate", > GTK_SIGNAL_FUNC(clist_size), GINT_TO_POINTER(i)); > > Works without a problem!!! That's because handler is not expected to return a value. > Ideas? > > Also, does anyone know why putting a clist into a scrolled window blocks the > size_allocate signal and neither the clist nor the window recieves it until > I resize the whole window? I don't know. > Ta, > > Rich > Best regards, -Vlad ___ gtk-list mailing list [EMAIL PROTECTED] http://mail.gnome.org/mailman/listinfo/gtk-list
Re: fork
On Thu, 17 Aug 2000, Matt Goodall wrote: > Vlad Harchev wrote: > > > > On Thu, 17 Aug 2000, Denis Serebro wrote: > > > > Hi, > > > > > > > > Hello, All. > > > > > > I try create a child process in gtk application. And I try create new window >with type GTK_TOPLEVEL_WINDOW in child process. > > >And I get very strange behaviour. When I try change window size or position >or something else, I get on console: > > > > Gtk wasn't supposed to be used this way. Also it's not thread-safe. Use a > > different approach. > > It **is** thread safe. Read section 5.2 of the GTK+ FAQ. Hmm, probably you are right - I was using the old version of FAQ that tells that gtk isn't thread-safe and lists 2 ugly apporaches for overcoming this limitations. Sorry for confusion. > /Matt > > -- > Matt Goodall, Software Engineer | Isotek Electronics Ltd > mailto:[EMAIL PROTECTED] | Claro House, Servia Road > http://www.isotek.co.uk | Leeds, LS7 1NL > Tel: +44 113 234320 | England Best regards, -Vlad ___ gtk-list mailing list [EMAIL PROTECTED] http://mail.gnome.org/mailman/listinfo/gtk-list
Re: GDK "root" GtkObject?
On Thu, 17 Aug 2000, Derek Simkowiak wrote: Hi, > > Hello, > I'm looking to deal with expose events generated by the root > ("desktop") window. (I'm animating the background) > > I can get the root GdkWindow by calling > > window = GDK_ROOT_PARENT(); > > Now I want to grab expose events and handle them. However, the > only thing I could find is using gtk_signal_connect() on the GtkObject > that owns the GdkWindow whose expose events you wish to grab. > > So, my question is: Is there a GtkObject which owns the root > window? Or am I going about this in the wrong way? > I think you should do the following: get root gdk window using GDK_ROOT_PARENT(), then simpulate creation of GtkWindow from that gdk_window (see gtkwindow.c) - i.e. set all flags appropriately (mark it as mapped, visible, etc) - gtk_window_new() and setting the gdk window and marking it as realized should be enough IMO. After that you will have to gdk_window_set_events(root,GDK_EXPOSURE_MASK) to make it accepting exposures. That's all. Please report whether this worked. > Thanks, > Derek Simkowiak > [EMAIL PROTECTED] > > > ___ > gtk-list mailing list > [EMAIL PROTECTED] > http://mail.gnome.org/mailman/listinfo/gtk-list > Best regards, -Vlad ___ gtk-list mailing list [EMAIL PROTECTED] http://mail.gnome.org/mailman/listinfo/gtk-list
Re: Waiting for user input
On Thu, 17 Aug 2000, Salvador Ramirez wrote: Hi, > Hi, > > I'm trying to do a function that display a window with a clist and an > entry and a "OK" button. > I would like that this function wait for the user input (the selection > of an item on the clist, some text on the text entry and the push over > the OK button) and then return, however I think this is not possible > because gtk+ works with the callbacks model so I would have to connect a > signal to the OK button then read the selection and the text on the text > entry and make something with that > data. I have been working this way but now I am needing this same > selection window to do other thing with the data selected on the clist > and the text on text entry so I would not like to create another > function similar to the previous but just changing the data processing > but I would like to > create a function that create the user interface and then I could get > the data selected and entered by the user so I could use that > information anywhere on the program. So my question is how can I create > a function like this? I thought to connect the OK button to some > function that put on some global variables the user input (either from > the clist and the text entry) and then read that global variables but > can't figure out how to make gtk wait for the press on the OK button to > then follow with the reading of the variables.. Just call gtk_main() right after showing the window, and make your OK-button call gtk_main_quit() in the clicked signal - this way you will be able to wait for window to be filled since it will look to you as that gtk_main() called after gtk_widget_show_all was returned. That's it. > Thanks, > > ---sram Best regards, -Vlad ___ gtk-list mailing list [EMAIL PROTECTED] http://mail.gnome.org/mailman/listinfo/gtk-list
Re: Install GTK+ on a device
On Sat, 19 Aug 2000, Xiang Hong wrote: Hi, > Hi, > > I am trying to install GTK+ 1.2.8 onto a device. But I believe something is missing. > > The device runs a simplied Linux (2.2.14) kernel. As it has limited memory with only >the OS and some basic library, like X, installed. I decided to install all my >extended libraries and applications on a compact flash memory. It can be mounted to >/root as a new directory (such as /xxx). > > The device has no compiler, so I have to > (1) compile all the source code (both library and applications) on a desktop PC >running Linux 2.2.14, > (2) install everything into /xxx (in the PC), > (3) copy the content in /xxx to the compact flash memory, > (4) mount the compact flash memory as /xxx to the device's /root, > (5) run ldconfig (/etc/ld.so.conf modified) > (6) start my application and hope it can work! > > This the basic idea. I believe it is right. Because so far all my applications >requiring X library work. But Something wrong with my first application requiring >GTK+, "gedit". It seems something is missing. I don't know much about gtk+, I just >followed the instruction to install. > > I compiled glib 1.2.8 and gtk+ 1.2.8 on a desktop running Linux 2.2.14, and >installed all of them into /xxx. I believe I did it right. I changed "DESTDIR =" in >all "Makefile.in" into "DESTDIR = /xxx". The old glib and gtk were deleted before >that. Then I compiled gedit 0.5.4 after I created some links in /usr/... to the >gtk+/glib header files in /xxx. Install gedit into /xxx by modifying all "DESTDIR". >Finally, gedit can run on the PC with a warning. > > After I copied the content of /xxx into the compact flash memory, mounted to the >device, run ldconfig, and run gedit. It gave me a lot of warning and errors listed >below. I guess I need to install some additional files. But I could not find in >www.gtk.org, > > Warning: > 1. Gdk-WARNING **: locale not supported by C library It's not severe. > Errors: > 1. Gtk-CRITICAL **: file gtkbox.c: line 332 (gtk_box_pack_start): assertion >'child->parent == NULL' failed. This looks very interesting. I have no idea why this is coming. > 2. Gtk-CRITICAL **: file gdkfont.c: line 248 (gdk_font_id): assertion 'font != NULL' > failed. > 3. ... tens of assertion 'font != NULL' failed, all in gdkfont.c, before the >application finally aborted. > > Please tell me where I can find infomation about those missing fonts, how to >install, and anything else I will miss if I install in such a way. I'd recommend you to check that the fonts mentioned in ~/.gtkrc and /etc/gtk/gtkrc are present. Also, if you use some non-"C" locale, you might want to check the fonts mentioned in fontset in /etc/gtk/gtkrc.LANGNAME exist. The quick way of checking whether those national fonts are the cause: run the program with environemnt variable LANG and all LC_* unset (in bash: "(unset LANG; gedit)" Also, a hint would be to recompile gtk/gdk and software without debugging support (i.e. not stripping executable, but an argument for 'configure' script that will make type-checking and type-casting macros become trivial). I think it will reduce size of the code by 10%. PS: just curious: how much RAM is on device? How big the linux kernel is? X? How much ROM linux + X + libs + X stuff + gtk take? > Best Regards, > XH Best regards, -Vlad ___ gtk-list mailing list [EMAIL PROTECTED] http://mail.gnome.org/mailman/listinfo/gtk-list
Re: Fullscreen mode !?
On Sat, 19 Aug 2000, Arndt Schwaiger wrote: > Hi, > > is there any possibility to browse a pixmap in FULLSCREEN MODE with gtk ? > Any ideas ? gqview at least from version 0.8.2 allows to view images in fullscreen mode. Look at the source how to do this. > Regards, > Arndt Best regards, -Vlad ___ gtk-list mailing list [EMAIL PROTECTED] http://mail.gnome.org/mailman/listinfo/gtk-list
Re: Documentation about the GTK+ Standard Args
On Mon, 14 Aug 2000, Andrew Ferguson wrote: > [ I posted this to [EMAIL PROTECTED] some time ago and > recieved little response, hence I have reposted it here; perhaps > someone on this list will tell me if what I have done is a good, bad, > or ugly thing. Thanks.] Hi, > Hi, > > In the GTK+ tutorial, it is mentioned that there are several standard > arguments that GTK+ accepts (the one's parsed for by > gtk_init(&argc, &argv) ). > > I was unable to find any documentation on these arguments (except for > two email messages to the main GTK+ list). So, I have looked in the > GTK+ code and put up a webpage with my findings, if anyone on the list > could go to > > http://owsla.cjb.net/gtk.shtml > > and tell me about an errors, additions, etc., I would be most obliged. > Also, is any of this information wanted by the FAQ or tutorial > maintainers? Thanks. Gtk reference documentation project documents all args each gtk widget accepts. See http://developer.gnome.org/doc/API/gtk/index.html Thanks for your efforts. > _ > Andrew Ferguson > http://owsla.cjb.net | [EMAIL PROTECTED] > Tintin Webring: http://owsla.cjb.net/tintin/ring/ Best regards, -Vlad ___ gtk-list mailing list [EMAIL PROTECTED] http://mail.gnome.org/mailman/listinfo/gtk-list
Re: Dynamic Context Popup menus(ARGHHHH!!!)
On Fri, 18 Aug 2000, Kristopher Kycia wrote: > Hello all, > > How do you display a dynamic context popup menu? I have a GtkCList with > columns... I want to be able to click on the column and have a context > menu appear. I need to use a event box for each column and the call a > function display_popup_menu(gint column). My problem is that whenever I > get into one of the signal handlers... the column is ALWAYS invalid. 3 > Developers have looked at this code and nobody understand why this does > NOT work!!! > > Sample code: > > GtkObject create_popup_menu(gint column) > { // Create my context menu > ... > // Attach signal handlers > gtk_signal_connect (GTK_OBJECT (sort_ascending1), "activate", > GTK_SIGNAL_FUNC (on_sort_ascending1_activate), > &column); You are taking the address of some value on the stack. Change previous line to (and see the fix for on_sort_ascending1_activate below) GINT_TO_POINTER(column)); > ... > return popupmenu; > } > > gboolean > display_popup_menu(GtkWidget *widget, >GdkEventButton *event, >gint column) > { > mPopupMenu = create_popup_menu(column); > gtk_menu_popup(GTK_MENU (mPopupMenu), NULL, NULL, NULL, NULL, > event->button, event->time); > } > > gboolean > on_eventbox1_button_press_event(GtkWidget *widget, > GdkEventButton *event, > gpointer user_data) > { > return display_popup_menu(widget, event, 0); > } > > // gpointer = void * > void > on_sort_ascending1_activate(GtkMenuItem *menuitem, > gpointer user_data) > { > gint column; > cout << "IN SORT ASCENDING CODE..." << endl; > // Sort the column... > column = *((gint *) user_data); // <--- THIS NEVER WORKS!!! ALWAYS Previous line should become column = GPOINTER_TO_INT(user_data); > RETURNS SOME HUGE NUMBER! WHY? > } > > I hope somebody can help... Sincerely, Cheers to you and three developers :) > Kristopher Kycia Best regards, -Vlad ___ gtk-list mailing list [EMAIL PROTECTED] http://mail.gnome.org/mailman/listinfo/gtk-list
Re: Fwd: Keys accelerator, bindings
On Mon, 21 Aug 2000 [EMAIL PROTECTED] wrote: > I have keys accelerators on my main window, but i have a text entry which > must handle key_press_event, so when the entry has the focus accelerators > doesn't work anymore .. Your handler for key_press_event should return FALSE in case it didn't handle the event (so the event will be propagated to parent widgets). If it returned TRUE, the event won't be propagated to parent widgets. It seems that your handler doesn't obey this rule and always returns TRUE. > In fact i want main window keys accelerators to have the priority on all > others widgets. > How could i resolve this ? > What is the difference between gtk bindings functions and defining > accelerators ? > If gtk bindings is useful for me, is there any doc ? > > thanks. Best regards, -Vlad ___ gtk-list mailing list [EMAIL PROTECTED] http://mail.gnome.org/mailman/listinfo/gtk-list
Re: broadcast signals?
On Mon, 21 Aug 2000, Richard Harvey Chapman wrote: > I have an app that is a configuration tool for a list of machines. I need > a way to tell a set of widgets to update their values when a user clicks > on a new machine in the list. I figured signals were the way to go. > Basically, I'd have each of the widgets "listen" for a certain "update" > signal. > > Throwing one more bit of complexity into it, I'd like to do it in sets. > I'm not sure if that requires multiple signals or not. > > Background: CTree with a list of machines. Notebook (~10 pages) with all > of the configuration information. I'd like to be able to update the > current page first. So, if page 3 was up, and a new machine was selected, > I'd like to update page 3's widgets first to reduce noticable delay. > > Is there a good way of doing this? It's definitely impossible with signals, but you can do that with events easily. You have to connect handler for "client-event" to all widgets, then create the event, and then use 'gtk_container_foreach' to iterate over all children of container (in your case, you'll have to call gtk_container_foreach for each page of notebook, current page first). The callback for gtk_container_foreach should check whether the child is container too, and call gtk_container_foreach for it if yes. After that the callback should call gtk_widget_event with that composed event (thus emitting "client-event" signal). > R. Best regards, -Vlad ___ gtk-list mailing list [EMAIL PROTECTED] http://mail.gnome.org/mailman/listinfo/gtk-list
Re: gtk_signal_connect vs. connect_object?
On Tue, 22 Aug 2000, Antonio Campos wrote: > Havoc Pennington wrote: > > > "David J. Topper" <[EMAIL PROTECTED]> writes: > > > Hi folks, > > > > > > What's the difference between the gtk_signal_connect and > > > gtk_signal_conect_object (and related) functions? I recall an earlier > > > tutorial had early example with both. I can't find any info on the > > > difference. > > > > > > Examples? > > > > > > > connect_object() swaps the first callback argument (the emitting > > object) and the last one (user data). It's called connect_object() for > > historical reasons, and the name no longer makes any sense. ;-) > > > > all these historical functions should dissapear sooner or later in GTK. Why? How will you connect handlers to signals then if all "those" functions would be removed? > Maybe GTK 2.0/2.2? > I think all of them only make the libraries bigger and more difficult to > learn... > IMHO breaking backwards compatibility is neccesary sometimes... (you can > always have various versions of the same library on the system, can't > you?) > > Best regards, -Vlad ___ gtk-list mailing list [EMAIL PROTECTED] http://mail.gnome.org/mailman/listinfo/gtk-list
Re: Help with retreiving children?
On Mon, 21 Aug 2000 [EMAIL PROTECTED] wrote: > > Hi there... > > I am creating an app using GTK+... I don't like global variables, or > exporting large numbers of variables to implement functionality. > > I have a form with multiple entries and combos and spin-buttons and I > would like to be able to access those widgets without having a global > variable for each. > > I'm thinking something along the line of using a function on the top-level > widget to return a pointer to the requested child-widget (requested by > name, since I did name all my widgets, and whats the point of names if > this isn't it?) > > So if there's any functionality like this, or other suggestions, it would > be greatly appreciated. I've been through the docs, unfortunately they're > a bit sketchy on the more complex topics. I would recomend you to (ab)use gtk_object_set_data/gtk_object_get_data, in the toplevel widget, e.g. gtk_object_set_data(GTK_OBJECT(mywindow),"total-btn",total_button); and then, when ptr is needed, extract it like this: GtkWidget* total_button = GTK_WIDGET(gtk_object_get_data(GTK_OBJECT(mywindow),"total-btn")); in order to save typing, I always use the following macros: GOSD(obj,name,data) gtk_object_set_data(GTK_OBJECT(obj),name,(gpointer)data) GOGD(obj,name) gtk_object_get_data(GTK_OBJECT(obj),name) GOSI(obj,name,val) GOSD(obj,name,GINT_TO_POINTER(val)) GOGI(obj,name) GPOINTER_TO_INT(GOGD(obj,name)) GOGW(obj,name) (GtkWidget*)(GOGD(obj,name)) > > > Thanks loads, > > Leeman > [EMAIL PROTECTED] > > > ___ > gtk-list mailing list > [EMAIL PROTECTED] > http://mail.gnome.org/mailman/listinfo/gtk-list > Best regards, -Vlad ___ gtk-list mailing list [EMAIL PROTECTED] http://mail.gnome.org/mailman/listinfo/gtk-list
Re: How to create scales for range widgets?
On Tue, 22 Aug 2000, David J. Topper wrote: > Hi all, > > I've been going nuts over this and can't believe there isn't a built in > mechanism in GTK to do it. Bascially, I'm trying to attach a numeric > scale onto a range widget. I've attached a (very small) gif. It > consists of a gtk table (the scale) that sits next to a range widget, > which lies on top of a text box. They're all put together and make a > nice little slider. > > BUT I CAN'T GET THE DAMN SCALING TO MATCH!!! It does sometimes, but the > whole business of setting up a scale index like this is pretty tough. > Since the range widget has to have an idea about this sort of thing > internally ... I'm thinking it should be easier that way. Could you post your stripped-down source (probably with main function) to help us helping you? I addressed this about half a year ago without any problems. > Help? Somebody has to have addressed this already. > > Thanks, > > DT > -- > Technical Director - Virginia Center for Computer Music > http://www.people.virginia.edu/~djt7p > > Best regards, -Vlad ___ gtk-list mailing list [EMAIL PROTECTED] http://mail.gnome.org/mailman/listinfo/gtk-list
Re: problems installing gtk
On Tue, 22 Aug 2000, Nora Speer wrote: Hi, > Hi, > > I have some problems installing gtk. I already installed glib-1.2.7 > successfully. > When I try to run the configure script for gtk-1.2.7, I always get the > following error: > > checking for X... no > configure: error: > *** X libraries or include files not found. Check 'config.log' for > *** more details. >[...] > > Has anyone an idea how I can get rid of this problem ? Do you have XFree86-devel*.rpm installed? > Thanks > Nora > > --- > System: SuSe Linux 6.4, Kernel 2.2.14, Desktop-enviroment: helixcode-gnome > Best regards, -Vlad ___ gtk-list mailing list [EMAIL PROTECTED] http://mail.gnome.org/mailman/listinfo/gtk-list
Re: problems installing gtk
On Tue, 22 Aug 2000, Nora Speer wrote: > > Hi, > > > Do you have XFree86-devel*.rpm installed? > No, I have installed XFree86.rpm, but not XFree86-devel*.rpm. You have to install it then. :) > > > Nora Best regards, -Vlad ___ gtk-list mailing list [EMAIL PROTECTED] http://mail.gnome.org/mailman/listinfo/gtk-list
Re: How to get the selected gtktreeitem?
On Tue, 22 Aug 2000, Ottavio Campana wrote: > I have got a gtktree with single selection in which I insert some items. > Which method sould I use to know which item is currently selected? The GTK_CLIST(ctree)->selection->data is GtkCTreeRow * of selected row if something is selected. If nothing is selected, either GTK_CLIST(ctree)->selection or GTK_CLIST(ctree)->selection->data is NULL (sorry, don't remember). Are you sure you need GTK_SELECTION_SINGLE? May be you need GTK_SELECTION_BROWSE? After that use gtk_ctree_find_node_ptr for getting GtkCTreeNode* from that GtkCTreeRow*. > Bye > Best regards, -Vlad ___ gtk-list mailing list [EMAIL PROTECTED] http://mail.gnome.org/mailman/listinfo/gtk-list
Re: How to create scales for range widgets?
On Tue, 22 Aug 2000, David J. Topper wrote: > Vlad Harchev wrote: > > > Could you post your stripped-down source (probably with main function) to > > help us helping you? > > A bit hard to strip down but I'll try. > > > I addressed this about half a year ago without any problems. > > A key issue for me is to be able to do non standard mappings. Regardless, it > should be the same. It's kind of like a clock, where I need values to go > from 1:00 up to 12:59, then right to 1:00. I have a "conversion" function > that will change values coming in from the adjustment. > > Here's a sample function. Bascially just call it with a ptr to an > adjustment. It takes in the adj values and creates a slider range widget and > a scale next to it, with some frames to make it look nice. It also adds a > text box at the bottom which will display the adjustment's "value." The > problem is that with different "steps" the scale listing gets skewed. I find > no easy way to correlate a scale to a range widgets value / range. It always > seems to be ok in one case, but then off in another: I tried the code you posted with second mail from you (i.e. the one with main() function). Changing the flags of 2nd scale from OPC to NORMAL it was made a usual scale that worked without any glitches/flaws. I don't get - what is your problem? Could you demonstrate it using only scales with flag NORMAL? (Give exact values for step sizes and range)? If you can't - then there is a flaw in math in pchoct() and other conversion functions. Best regards, -Vlad ___ gtk-list mailing list [EMAIL PROTECTED] http://mail.gnome.org/mailman/listinfo/gtk-list
Re: Keys accelerator, bindings
On Tue, 22 Aug 2000 [EMAIL PROTECTED] wrote: > Thanks for your anwser for the problem of the entry catching key_press_event, > it's now resolved, but i have another much more annoying, it's with the gtk > mozilla widget, i don't have access to the key press handler, and it's a gdk > window object .. Is there a way to prevent it from getting GDK > key_press_event ? You didn't describe you problem in detail. If you'd like to prevent that gdk window from getting key_press_event, you can (IMO) just do: gdk_window_set_events(wnd,gdk_window_get_events(wnd)& ~(GDK_KEY_PRESS_MASK|GDK_KEY_RELEASE_MASK)); > thanks. > Nicolas > Best regards, -Vlad ___ gtk-list mailing list [EMAIL PROTECTED] http://mail.gnome.org/mailman/listinfo/gtk-list
Re: How to get the selected gtktreeitem?
On Wed, 23 Aug 2000, Ottavio Campana wrote: > On Tue, Aug 22, 2000 at 11:38:22PM +0500, Vlad Harchev wrote: > > Are you sure you need GTK_SELECTION_SINGLE? May be you need > > GTK_SELECTION_BROWSE? > > No, I'm not sure of it. It's the first time I use the gtktree widget and > I think I need a bit of help. > > I have got a function which creates some gtktreeitems with label and > puts them into a gtktree. Together with this function I have got a > similar one, which has to check if an item is selected, remove it and > return the label of the item. And I don't know how to do it. > > Should I user GTK_SELECTION_SINGLE or GTK_SELECTION_BROWSE? Can anyone > help help me? The *_SINGLE mode allows selection of one or zero items, while *_BROWSE allows selection exactly one item (if there is something to select from). What is more suitable for your case - you decide. > Bye and thanks. > Best regards, -Vlad ___ gtk-list mailing list [EMAIL PROTECTED] http://mail.gnome.org/mailman/listinfo/gtk-list
Re: invalid unclassed pointer?
On Wed, 23 Aug 2000, Dugas, Alan wrote: > I've written a function that creates a window with a combo box and a drawing > area. The drawing area is connected to the "configure" and "expose" events and > passes the GTK_WIDGET(combo) to the function called. However, when the progam > reaches the callback function, I keep getting the following message just prior > to segfaulting; > > Gtk-WARNING **: invalid unclassed pointer in cast to 'GtkCombo'. > > The callback function is declared as: > void draw_histogram(GtkWidget *calling_widget, GtkWidget *widget) It should be: gboolean draw_histogram (GtkWidget *widget, GdkEventExpose *event, gpointer user_data); i.e. it should accept 3 params instead of two. > The signal connections, which occur after the combo widget is created, realized, > and shown, are as follows: > gtk_signal_connect(GTK_OBJECT(drawing_area), "configure_event", > GTK_SIGNAL_FUNC(draw_histogram), GTK_WIDGET(combo)); > gtk_signal_connect(GTK_OBJECT(drawing_area), "expose_event", > GTK_SIGNAL_FUNC(draw_histogram), GTK_WIDGET(combo)); > > The line of code triggering the warning, and subsequent segfault, is: > combo = GTK_WIDGET(combo); > WHere combo is declared as follows: > GtkWidget *combo; > > I've tried to realize the GtkCombo widget to no avail and everything else looks > proper. What is warning trying to tell me? Is this some sort of weird scope > issue? Any and all responses would be appreciated! > Best regards, -Vlad ___ gtk-list mailing list [EMAIL PROTECTED] http://mail.gnome.org/mailman/listinfo/gtk-list