GtkComboBox focus issue

2005-07-07 Thread Pramod Patangay
Hi,

I am trying to grab focus to GtkComboBox but focus is not set to it.
Here's a sample program. What's wrong with the code?

gboolean kp(GtkWidget *w, GdkEvent* e, gpointer d)
{
printf(Key Pressed\n);
gtk_widget_grab_focus(GTK_WIDGET(d));
return TRUE;
}

int main( int   argc, char *argv[] )
{

gtk_init (argc, argv);

GtkWidget *dialog = gtk_window_new(GTK_WINDOW_TOPLEVEL);

GtkWidget* l = gtk_layout_new(NULL,NULL);
gtk_widget_show(l);
GtkWidget* b = gtk_button_new_from_stock(GTK_STOCK_FLOPPY);
gtk_layout_put(GTK_LAYOUT(l),b,40,70);

ts = gtk_tree_store_new(1, G_TYPE_STRING);
GtkCellRenderer* cr = gtk_cell_renderer_text_new();
GtkTreeIter iter;

gtk_tree_store_insert(ts, iter, NULL, 0);
gtk_tree_store_set(ts, iter, 0, FIRST, -1);

combo = gtk_combo_box_new_with_model(GTK_TREE_MODEL(ts));
gtk_cell_layout_pack_start(GTK_CELL_LAYOUT(combo),cr,FALSE);
gtk_cell_layout_set_attributes(GTK_CELL_LAYOUT(combo),cr,text,0,NULL);

gtk_combo_box_set_active(GTK_COMBO_BOX(combo),0);
gtk_widget_show(combo);
gtk_layout_put(GTK_LAYOUT(l),combo,20,20);
gtk_widget_grab_focus(b);
gtk_widget_show(b);

g_signal_connect(b,key-press-event,G_CALLBACK(kp),combo);

gtk_container_add(GTK_CONTAINER(dialog),l);
gtk_widget_show(dialog);

gtk_main();

return 0;
}

Thanks
___
gtk-list mailing list
gtk-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-list


GtkComboBox

2005-07-01 Thread Pramod Patangay
Hi,

I asked this question previously but there were no replies. So here I
am again. I would like to disable a particular entry in the
GtkComboBox. I am using a GtkComboBox with a model and supplying it
cell renderers. If disabling a particular entry is not possible, can I
at least change the look of that entry like background or foreground
so that the user knows that it is disabled. How can I do that? I see
some functions like gtk_cell_renderer_render, what does this do?

Thanks
___
gtk-list mailing list
gtk-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-list


Re: GtkCombo does not send signal

2005-06-27 Thread Pramod Patangay
activate signal on which widget? GtkComboBox doesn't have any such signal.


On 6/24/05, Preben Randhol [EMAIL PROTECTED] wrote:
 On Fri, Jun 24, 2005 at 08:54:11PM +0530, Pramod Patangay wrote:
  Hi,
 
  I am using GTK 2.4 and facing a problem with GtkCombo. I populated a
  GtkCombo with entries. I want to catch signals when the selection
  changes. I am handling changed signal on the combo. I would like to
  know even if the selection was not changed but the user popped up the
  combo and selected the already selected entry. In this case changed
  signal is not emitted. How do I achieve this? Is there some other
  signal for this?
 
 Not sure, but have you tested the :
 
activate
 
 signal?
 
 Preben

___
gtk-list mailing list
gtk-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-list


GtkCombo does not send signal

2005-06-24 Thread Pramod Patangay
Hi,

I am using GTK 2.4 and facing a problem with GtkCombo. I populated a
GtkCombo with entries. I want to catch signals when the selection
changes. I am handling changed signal on the combo. I would like to
know even if the selection was not changed but the user popped up the
combo and selected the already selected entry. In this case changed
signal is not emitted. How do I achieve this? Is there some other
signal for this?

Also how to I programmatically set the focus to combo.
gtk_widget_grab_focus fails.

Thanks
___
gtk-list mailing list
gtk-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-list


GtkComboBox again

2005-06-02 Thread Pramod Patangay
Hi,

Is there any way to add a separator in the GtkComboBox. I am using
combo box with a tree model. Also I need to add markup properties that
applies to a whole column. How do I do that? I tried the following
code, but it doesn't work.

ts = gtk_tree_store_new(1,G_TYPE_STRING);
GtkWidget *tv = gtk_tree_view_new_with_model(GTK_TREE_MODEL(ts));
GtkCellRenderer* cr = gtk_cell_renderer_text_new();
//g_object_set(G_OBJECT(cr),weight,1000,NULL); //this works

g_object_set(G_OBJECT(cr),markup,span size=\large\ weight =
\bold\some text/span,NULL);

GtkTreeIter iter;
gtk_tree_store_insert(ts, iter, NULL, 0);
gtk_tree_store_set(ts, iter, 0, FIRST,-1);

GtkWidget* combo = gtk_combo_box_entry_new_with_model(GTK_TREE_MODEL(ts),0);
gtk_cell_layout ...

One more problem that I had was with disabling of a particular entry
in the combo box which doesn't seem so easy. All these things were
accomplished quite easily with GtkOptionMenu which is now deprecated
in preference to GtkComboBox. But GtkComboBox doesn't seem to have any
easy ways to achieve the same. Why were things designed like this? or
am I missing something here? Can anyone point to some detailed
documentation on the net related to GtkComboBox or migrating from
GtkOptionMenu to GtkComboBox?

Thanks
-Pramod
___
gtk-list mailing list
gtk-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-list


Diabling an entry in TreeView

2005-05-31 Thread Pramod Patangay
Hi,

I have a treestore and corresponding model and treeview. I would like
to disable a particular entry in the treeview. How can I do this?

Thanks
___
gtk-list mailing list
gtk-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-list


GtkComboBox

2005-05-31 Thread Pramod Patangay
Hi,

I was trying out GtkComboBox. I have Gtk-2.4. I have created a
GtkTreeModel and populated the corresponding GtkTreeStore. But when I
run the program, the entries are not shown. Why is this happening? I
am attaching the program here:

GtkTreeStore *ts = gtk_tree_store_new(1,G_TYPE_STRING);
GtkWidget *tv = gtk_tree_view_new_with_model(GTK_TREE_MODEL(ts));
GtkCellRenderer* cr = gtk_cell_renderer_text_new();
GtkTreeViewColumn* tvc =
gtk_tree_view_column_new_with_attributes(NULL, cr, text, 0, NULL);
gtk_tree_view_append_column (GTK_TREE_VIEW(tv), tvc);
gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(tv), FALSE);
GtkTreeSelection* TS = gtk_tree_view_get_selection(GTK_TREE_VIEW(tv));
gtk_tree_selection_set_mode(TS, GTK_SELECTION_BROWSE);

GtkTreeIter iter;

gtk_tree_store_insert(ts, iter, NULL, 0);
gtk_tree_store_set(ts, iter, 0, FIRST,-1);

gtk_tree_store_insert(ts, iter, NULL, 0);
gtk_tree_store_set(ts, iter, 0,SECOND,-1);

GtkWidget* combo = gtk_combo_box_new_with_model(GTK_TREE_MODEL(ts));
gtk_container_add(GTK_CONTAINER(dialog),combo);
gtk_widget_show(combo);

Can anyone please point out, why the entries are now show n in the combo box?

Thanks
___
gtk-list mailing list
gtk-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-list


Re: GtkComboBox

2005-05-31 Thread Pramod Patangay
Hi Michael,

If I am not wrong, with tree model we can even display images and text
together as part of the menu items. This is the reason why I chose to
use tree model. If there was only text then you are correct. Thanks to
Neumann for pointing out what I was missing in the code.

-Pramod


On 5/31/05, Michael Ott [EMAIL PROTECTED] wrote:
 Hello Pramod!
 
  I was trying out GtkComboBox. I have Gtk-2.4. I have created a
  GtkTreeModel and populated the corresponding GtkTreeStore. But when I
  run the program, the entries are not shown. Why is this happening? I
  am attaching the program here:
 
  GtkTreeStore *ts = gtk_tree_store_new(1,G_TYPE_STRING);
GtkWidget *tv = gtk_tree_view_new_with_model(GTK_TREE_MODEL(ts));
GtkCellRenderer* cr = gtk_cell_renderer_text_new();
GtkTreeViewColumn* tvc =
  gtk_tree_view_column_new_with_attributes(NULL, cr, text, 0, NULL);
gtk_tree_view_append_column (GTK_TREE_VIEW(tv), tvc);
gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(tv), FALSE);
GtkTreeSelection* TS = gtk_tree_view_get_selection(GTK_TREE_VIEW(tv));
gtk_tree_selection_set_mode(TS, GTK_SELECTION_BROWSE);
 
GtkTreeIter iter;
 
gtk_tree_store_insert(ts, iter, NULL, 0);
gtk_tree_store_set(ts, iter, 0, FIRST,-1);
 
gtk_tree_store_insert(ts, iter, NULL, 0);
gtk_tree_store_set(ts, iter, 0,SECOND,-1);
 
GtkWidget* combo = gtk_combo_box_new_with_model(GTK_TREE_MODEL(ts));
gtk_container_add(GTK_CONTAINER(dialog),combo);
gtk_widget_show(combo);
 
  Can anyone please point out, why the entries are now show n in the combo 
  box?
 Why so difficult. You can use gtk_combo_box_append_text and need no tree
 model
 
 CU
 
   Michael
 
 --
Michael Ott, e-mail: [EMAIL PROTECTED], www.zolnott.de
 I am registered as user #275453 with the Linux Counter, http://counter.li.org.
 
 

___
gtk-list mailing list
gtk-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-list


Edit Box in GtkFileChooserDialog

2005-05-28 Thread Pramod Patangay
Hi,

I would like to have an edit box in GtkFileChooserDialog for opening
files (and not saving) so that when user types in something ni the
edit box and presses tab the filename should appear in the edit box
and the file should be shown selected in the file list. Is there any
easy way to do this?

Thanks
___
gtk-list mailing list
gtk-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-list


NULL GdkPixbuf

2005-04-22 Thread Pramod Patangay

Hi All,

I have written a small program (attached below) and am
facing a problem in it. I am trying to create a
GdkPixbuf out of a png file. But I am getting a NULL
value. This does not happen with bmp files. I am
working on Solaris 8. Has any one got any idea why
this might be happening? Am I missing some libraries?
It compiles and links w/o any warnings/errors but when
run the value is NULL (ppp = 0). I tried this on a
Linux machine with the same PNG and everything is
fine.


#include gtk/gtk.h
#include gdk-pixbuf-xlib/gdk-pixbuf-xlib.h
#include gdk-pixbuf/gdk-pixbuf.h
#include X11/Xlib.h
int main( int   argc, char *argv[] )
{
gtk_init (argc, argv);
GtkWidget *w =
gtk_window_new(GTK_WINDOW_TOPLEVEL);
gtk_window_move(GTK_WINDOW(w),400,400);
   
gtk_window_set_default_size(GTK_WINDOW(w),4,4);

GdkPixbuf* ppp =
gdk_pixbuf_new_from_file(/space/pramod/1.png,NULL);
// any bmp file works fine here
printf(PIXBUF : %p\n,ppp);
GtkWidget *i = gtk_image_new_from_pixbuf(ppp);
gtk_container_add(GTK_CONTAINER(w),i);

gtk_widget_show(i);
gtk_widget_show(w);

gtk_main();
return 0;
}

__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 
___
gtk-list mailing list
gtk-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-list


[EMAIL PROTECTED]

2005-02-24 Thread Pramod Patangay

Hi All,

I am observing strange behaviour with GTK (2.2.4)

1)If I have a button in a window as the default widget
of that window, the button appears too small when
focus is on that button. When the focus is out button
appears OK but in both cases w/o the given text. I am
using SuSE 9.1 Personal Edition with Qt as the theme.
Here's a small program to demonstrate this. Has anyone
encountered the same problem? how can I solve this?

Sample Program:

GtkWidget *w = gtk_window_new(GTK_WINDOW_TOPLEVEL);
gtk_widget_set_size_request(w,400,400);

GtkWidget *l = gtk_layout_new(NULL,NULL);
GtkWidget *b = gtk_button_new_with_label();
gtk_button_set_label(GTK_BUTTON(b),ABC_DEF);
GtkWidget *b2 = gtk_button_new_with_label(EGH_JKL);

gtk_widget_set_size_request(b,100,30);
GTK_WIDGET_SET_FLAGS(b,GTK_CAN_DEFAULT);
gtk_window_set_default(GTK_WINDOW(w),b);
gtk_layout_put(GTK_LAYOUT(l),b,20,20);
gtk_layout_put(GTK_LAYOUT(l),b2,20,80);

gtk_container_add(GTK_CONTAINER(w),l);

2)This is regarding the menus. If I have a menu with
GtkImageMenuItem as the menu items and if images of
the menu items are all of different sizes then the
image is expanded (some space left out at the top and
bottom), may be to make it a square. How do I get the
desired result of images appearing as they should.

3)When I use the color selection dialog provided by
GTK, I get grey colors in the squares of the palette
frame instead of the actual colors. This happens on
SuSE 9.2 Professional. Sample program is attached
below. How do I solve this?

Sample Program

char buf[] = Choose a color;
GtkWidget *colorSelDlg =
gtk_color_selection_dialog_new (buf);

GtkColorSelection *colorSel = GTK_COLOR_SELECTION
(GTK_COLOR_SELECTION_DIALOG (colorSelDlg)-colorsel);

GdkColor prevColor;
prevColor.pixel = 0;
prevColor.red = 65535;
prevColor.green = 65535;
prevColor.blue = 65535;

gtk_color_selection_set_previous_color (colorSel,
prevColor);
gtk_color_selection_set_current_color (colorSel,
prevColor);
gtk_color_selection_set_has_palette (colorSel, TRUE);

int response = gtk_dialog_run (GTK_DIALOG
(colorSelDlg));

if (response == GTK_RESPONSE_OK)
{
GdkColor color;
gtk_color_selection_get_current_color (colorSel,
color);
}

Are there any bugs logged against the above three
strange behaviours? Can you forward me the links, are
is there any other forum which is more appropriate to
send these to?

Thanks
-Pramod




__ 
Do you Yahoo!? 
Take Yahoo! Mail with you! Get it on your mobile phone. 
http://mobile.yahoo.com/maildemo 
___
gtk-list mailing list
gtk-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-list


Getting the Coords of TextView cursor

2005-02-14 Thread Pramod Patangay

Hi,

I am using a GtkTextView which is added to a
GtkScrolledWindow. Now whenever the GtkTextView gets
focus, I want the scrolled window to scroll in such a
manner so that the cursor is visible. How can I
achieve this?

One way I thought of is that, I get the location of
iterator where the cursor is placed and based on the
'Y' value of the location, I set the adjustment value
for the scrolled window. But this doesn't work since
the gtk_text_view_get_iter_location is returning same
value no matter where the cursor is, also converting
the values to window coords using
gtk_text_view_buffer_to_window_coords with
GTK_TEXT_WINDOW_WIDGET as the window type, gives weird
results.

Can anyone suggest a better working way to achieve the
same?

Thanks




__ 
Do you Yahoo!? 
Meet the all-new My Yahoo! - Try it today! 
http://my.yahoo.com 
 

___
gtk-list mailing list
gtk-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-list


Disabling a row in GtkTreeView

2005-01-24 Thread Pramod Patangay

Hi,

I have a GtkTreeView (and corresponding GtkTreeStore
and GtkTreeModel etc). I want to disable a particular
row so that it can not be selected and also looks
disabled. How can I achieve this?

Thanks
-Pramod




__ 
Do you Yahoo!? 
Yahoo! Mail - Easier than ever with enhanced search. Learn more.
http://info.mail.yahoo.com/mail_250
___
gtk-list mailing list
gtk-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-list


Changing the icon in GtkMessageDialog

2005-01-23 Thread Pramod Patangay

Hi,

I would like to use GtkMessageDialog but how can I
change the default icon that appears on the dialog
using Stock items. I'd like to change the icon for
GTK_MESSAGE_INFO type to use say
GTK_STOCK_DIALOG_ERROR, how can I achieve this?

Thanks



__ 
Do you Yahoo!? 
Yahoo! Mail - Find what you need with new enhanced search.
http://info.mail.yahoo.com/mail_250
___
gtk-list mailing list
gtk-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-list


Creating GdkPixbuf from PNG data

2005-01-07 Thread Pramod Patangay

Hi,

I have PNG data in memory which is essentially the
contents of a png file. I need to create a GdkPixbuf
from this data. How can I do this?

Thanks




__ 
Do you Yahoo!? 
All your favorites on one personal page – Try My Yahoo!
http://my.yahoo.com 
___
gtk-list mailing list
gtk-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-list


Custom Drawn Images in GtkImageMenuItem

2005-01-03 Thread Pramod Patangay

Hi,

I am using GtkImageMenuItem in my code and the icon to
be displayed is custom drawn. To achieve this, I am
creating a GtkDrawingArea widget with proper size and
adding it to a GtkHBox. This GtkHBox will be the image
in the imagemenuitem. I am handling the expose event
(of the drawing area) callback where proper icon is
drawn in the drawing area. The problem that I am
facing is that, some of the portion of the icon is
transparent which means I SHOULD get proper background
color of the menuitem behind the icon wherever it is
transparent. For menus, select is called first and
then expose is called. Now the questions are
1) When expose event is called (after select event),
at that time, the item doesn't appear selected yet and
the background is still grey meaning not selected. Why
is it so?
2) How to get the exact background color (blue/green,
the selection color or grey the deselection color) of
the menu item when it is selected/deselected?
3) What event should I handle so that the correct
background of the menu item appears and I can render
the icon?

Is there any other way to achieve the same?

Thanks
-Pramod




__ 
Do you Yahoo!? 
Dress up your holiday email, Hollywood style. Learn more. 
http://celebrity.mail.yahoo.com
___
gtk-list mailing list
gtk-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-list


Custom Drawing on a GtkTreeView

2004-12-15 Thread Pramod Patangay

Hi,

I have a treeview whose cells will contain some custom
drawn image. To achieve this, I am making a
treeviewcolumn with pixbuf cellrenderer and I am
capturing expose-event of the treeview and then draw
the image on the window. But this doesn't work. If I
don't draw the treeview on the window (i.e., comment
the line gtk_container_add... ) then the custom
image is drawn. Can any one help?
Is there any other way to achieve the same?

The code is as below:

gboolean myDraw(GtkWidget *w, GdkEvent *e, gpointer d)
{
 GdkGC *gc = gdk_gc_new(w-window);
 gdk_draw_rectangle(w-window,gc,TRUE,15,15,50,50);
 return TRUE;
}
int main(int argc,char *argv[] )
{
gtk_init (argc, argv);
GtkWidget *window;
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
GdkColor c;
c.red=65535; c.blue=65535; c.green=65535;
gtk_widget_modify_bg(window,GTK_STATE_NORMAL,c);
gtk_widget_set_size_request (GTK_WIDGET (window), 300,
300);

GtkTreeView *fTV;
GtkTreeModel *fTM;
GtkTreeStore *fTS;
GtkTreeViewColumn *fTVC;
GtkCellRenderer *ren;

fTS =
gtk_tree_store_new(2,GDK_TYPE_PIXBUF,G_TYPE_STRING);
fTM = GTK_TREE_MODEL(fTS);
fTV =
GTK_TREE_VIEW(gtk_tree_view_new_with_model(fTM));

ren = gtk_cell_renderer_pixbuf_new();
fTVC=
gtk_tree_view_column_new_with_attributes(Custom,ren,pixbuf,0,NULL);
gtk_tree_view_column_set_min_width(fTVC,100);
gtk_tree_view_column_set_resizable(fTVC,TRUE);
gtk_tree_view_append_column(fTV,fTVC);
ren = gtk_cell_renderer_text_new();
fTVC=
gtk_tree_view_column_new_with_attributes(Text,ren,text,1,NULL);
gtk_tree_view_column_set_resizable(fTVC,TRUE);
gtk_tree_view_append_column(fTV,fTVC);

GtkTreeIter iter;
gtk_tree_store_append(fTS,iter,NULL);
gtk_tree_store_set(fTS,iter,1,Checkmark,-1);
gtk_tree_store_append(fTS,iter,NULL);
gtk_tree_store_set(fTS,iter,1,NoCheckmark,-1);

gtk_widget_show_all(GTK_WIDGET(fTV));

gtk_container_add(GTK_CONTAINER(window),GTK_WIDGET(fTV));

g_signal_connect_after(G_OBJECT(fTV),expose-event,G_CALLBACK(myDraw),NULL);
gtk_widget_show (window);

gtk_main ();

return 0;
}

Thanks
-Pramod

__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 
___
gtk-list mailing list
[EMAIL PROTECTED]
http://mail.gnome.org/mailman/listinfo/gtk-list


Changing the shortcut text for menus

2004-10-14 Thread Pramod Patangay

Hi,

I have to change the text of the default shortcut
generated by GTK when I add an accelerator to the menu
item. Is there any way to do it?

Like if I add '+' as the accelerator, a '+' is shown
as the shortcut but I want to it be to plus. How can
I achieve that?

Thanks
-Pramod


__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 
___
gtk-list mailing list
[EMAIL PROTECTED]
http://mail.gnome.org/mailman/listinfo/gtk-list


Re: Accelerators don't work

2004-10-05 Thread Pramod Patangay

Thanks for the reply. I solved this problem by
connecting the widget's can-activate-accel signal to
a callback which will always return true. This solved
the problem but now I am facing a new one. Some of the
accelerators don't work even if the menubar is
visible. But the shortcuts are shown as part of the
menu item beside its name. Any thoughts on what might
be happening here?


From: edscott wilson garcia [EMAIL PROTECTED]
Subject: Re: Accelerators don't work
To: Pramod Patangay [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Message-ID: [EMAIL PROTECTED]
Content-Type: text/plain; charset=iso-8859-1

El mié, 29-09-2004 a las 10:46, Pramod Patangay
escribió:
 Hi All,
 
 I am trying to add accelerators to menu items. But
 they don't seem to work as they should. There's a
 menuitem which when activated will hide the menu
bar.
 But once the menu bar is hidden, none of the
 accelerators work.
  I am using Fedora Core. Any idea on what's going on
 here? Why are accelerators disabled when menu bar is
 hidden? How do I enable them? and what are the other
 workarounds? Suprisingly I don't face this problem
on
 RedHatLinux-8 but only on FedoraCore.

I've got the same problem (Gentoo-linux with gtk-2.4).
This fault is
either a bug or the gtk developers decided that
accelerators to hidden
menu items is not a valid way to code. I'm not sure,
but probably the
latter is correct.

To work around this issue, you could add in your own
keypress event
handlers. When you get a hit for a key that should
accelerate to the
hidden menu item, just go to the callback directly and
return TRUE,
otherwise FALSE.


Edscott



___
Do you Yahoo!?
Declare Yourself - Register online to vote today!
http://vote.yahoo.com
___
gtk-list mailing list
[EMAIL PROTECTED]
http://mail.gnome.org/mailman/listinfo/gtk-list


Changing the shortcut names for menu items

2004-10-05 Thread Pramod Patangay

Hi,

I have menu item to which I have added an accelerator.
GTK automatically displays the shortcut as part of the
text beside the menu item name. Is there any way I can
change the shortcut string?

Say for e.g., I add ctrl + as the shortcut, the
displayed string is ctrl++ but I want it to be say
ctrl plus or some othe string, can I do that? and
how?

Thanks




___
Do you Yahoo!?
Declare Yourself - Register online to vote today!
http://vote.yahoo.com
___
gtk-list mailing list
[EMAIL PROTECTED]
http://mail.gnome.org/mailman/listinfo/gtk-list


Accelerators don't work

2004-09-29 Thread Pramod Patangay

Hi All,

I am trying to add accelerators to menu items. But
they don't seem to work as they should. There's a
menuitem which when activated will hide the menu bar.
But once the menu bar is hidden, none of the
accelerators work.
 I am using Fedora Core. Any idea on what's going on
here? Why are accelerators disabled when menu bar is
hidden? How do I enable them? and what are the other
workarounds? Suprisingly I don't face this problem on
RedHatLinux-8 but only on FedoraCore.

Thanks

Sample program is attached below:

gboolean menuActive = TRUE;
void print( GtkWidget *w , gpointer data)
{
g_print(Hi\n);
if (menuActive)
gtk_widget_hide(GTK_WIDGET(data));
else
gtk_widget_show(GTK_WIDGET(data));
}

int main( int   argc, char *argv[] )
{
gtk_init (argc, argv);


GtkWidget *w =
gtk_window_new(GTK_WINDOW_TOPLEVEL);
   
gtk_window_set_default_size(GTK_WINDOW(w),100,100);
GtkAccelGroup *gag = gtk_accel_group_new();
gtk_window_add_accel_group(GTK_WINDOW(w),gag);

GtkWidget *menu = gtk_menu_bar_new();
GtkWidget *submenu = gtk_menu_new();
GtkWidget *m1 = gtk_separator_menu_item_new();
GtkWidget *m2 =
gtk_menu_item_new_with_label(View);
GtkWidget *m3 = gtk_separator_menu_item_new();
GtkWidget *m4 =
gtk_menu_item_new_with_label(Tools);
GtkWidget *m5 =
gtk_menu_item_new_with_label(File);
   
gtk_menu_shell_append(GTK_MENU_SHELL(submenu),m1);
   
gtk_menu_shell_append(GTK_MENU_SHELL(submenu),m2);
   
gtk_menu_shell_append(GTK_MENU_SHELL(submenu),m3);
   
gtk_menu_shell_append(GTK_MENU_SHELL(menu),m4);
   
gtk_menu_shell_append(GTK_MENU_SHELL(menu),m5);
   
gtk_menu_item_set_submenu(GTK_MENU_ITEM(m4),submenu);
   
g_signal_connect(G_OBJECT(m2),activate,G_CALLBACK(print),menu);
   
gtk_widget_add_accelerator(m2,activate,gag,GDK_A,(GdkModifierType)0,GTK_ACCEL_VISIBLE);

gtk_container_add(GTK_CONTAINER(w),menu);

gtk_widget_show(m1);
gtk_widget_show(m2);
gtk_widget_show(m3);
gtk_widget_show(m4);
gtk_widget_show(m5);
gtk_widget_show(menu);
gtk_widget_show(submenu);
gtk_widget_show(w);

gtk_main();
return 0;
}



__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 
___
gtk-list mailing list
[EMAIL PROTECTED]
http://mail.gnome.org/mailman/listinfo/gtk-list


Selecting the region in GtkFileSelection

2004-09-08 Thread Pramod Patangay

Hi,

I have created a GtkFileSelection, set the filename
and want the filename region to be selected. Here's
what I am doing:

GtkWidget *a = gtk_file_selection_new(Hmmm);
gtk_file_selection_set_filename(GTK_FILE_SELECTION(a),TestFile);
GtkWidget *ase =
(GTK_FILE_SELECTION(a))-selection_entry;
gtk_entry_set_text(GTK_ENTRY(ase),Hope);
gtk_editable_select_region(GTK_EDITABLE(ase),0,-1);
gtk_widget_show(ase);
gtk_widget_show(a);

But this doesn't work. Any ideas what's wrong here and
how to get the filename region selected?
(I am using GTK 2.0.9)

Thanks
-Pramod


__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 
___
gtk-list mailing list
[EMAIL PROTECTED]
http://mail.gnome.org/mailman/listinfo/gtk-list


gtk_widget_add_accelerator

2004-09-08 Thread Pramod Patangay

Hi All,

I am trying to add an accelerator. Here's a sample
code:

GtkWidget *w=gtk_window_new(GTK_WINDOW_TOPLEVEL);
GtkWidget *e=gtk_button_new_from_stock(GTK_STOCK_OK);
GtkAccelGroup *gag = gtk_accel_group_new();
gtk_window_add_accel_group(GTK_WINDOW(w),gag);
g_signal_connect(G_OBJECT(e),clicked,G_CALLBACK(print),NULL);
guint mod = GDK_SHIFT_MASK;
mod |= GDK_CONTROL_MASK;
gtk_widget_add_accelerator(e,clicked,gag,'6',GDK_CONTROL_MASK|GDK_SHIFT_MASK,GTK_ACCEL_VISIBLE);
gtk_container_add(GTK_CONTAINER(w),e);
gtk_widget_show(e);
gtk_widget_show(w);


When the application is run, Ctrl+6 calls the callback
but not Ctrl+Shift+6. Any idea what's going on here?
(I am using GTK 2.0.9)

Thanks
-Pramod






__
Do you Yahoo!?
New and Improved Yahoo! Mail - 100MB free storage!
http://promotions.yahoo.com/new_mail 
___
gtk-list mailing list
[EMAIL PROTECTED]
http://mail.gnome.org/mailman/listinfo/gtk-list


gtk_widget_add_accelerator

2004-08-17 Thread Pramod Patangay

Hi All,

I am having trouble with adding acclerators.
I want the Shift Ctrl Minus key to map to some
event.

Here's what I am doing:

gchar * label = ...;
GtkWidget *menuItemWidget =
gtk_menu_item_new_with_mnemonic(label);
...
GdkAccelGroup *accel = ... ;
AccelKey = 45; //for - key
accelMod = GDK_CONTROL_MASK | GDK_SHIFT_MASK;

gtk_widget_add_accelerator(menuItemWidget, activate,
accel, AccelKey, (GdkModifierType)accelMod,
GTK_ACCEL_VISIBLE);
g_signal_connect(G_OBJECT(menuItemWidget),
activate,
G_CALLBACK (ActivateCallback), (gpointer)somedata);

I also added an accelerator so that Shit Ctrl + key
is mapped to another event.

These two keys (ShiftCtrlPlus and ShiftCtrlMinus) are
part of menus and I can see the shortcuts as part of
the menu names but the Shift Ctrl Minus does not
work instead Ctrl Minus emits the signal. No such
problem exists for Shift Ctrl Plus key.

Any idea what might be going wrong?

Thanks




__
Do you Yahoo!?
Yahoo! Mail Address AutoComplete - You start. We finish.
http://promotions.yahoo.com/new_mail 
___
gtk-list mailing list
[EMAIL PROTECTED]
http://mail.gnome.org/mailman/listinfo/gtk-list