Re: Re: Toggle buttons

On Mon, May 06, 2002 at 02:22:17PM -0400, Jim Parker wrote:
G'Day !

I am building a toolbar(s) in a CAD application.  While I use radio-buttons
in my menu, the UI would require a major rewite to incorporate the use of
radio-buttons and I don't think it wold work (I am probably blinded by
convention here).

I could use normal buttons for this, but wanted to give the user a visual
clue as to what state the program was in.  Also the program continues to be
in this state until changed by the user explicitly.  (for example, drawing
points on a screen with a mouse.  You do not want to force the user to
click a button for each point.)

As another poster pointed out gtk_toggle_button_set_active ( ) is the way
to go.  Ugly, but ...

Thanks for your replies.

  I may misunderstand totally, but you're still describing radio
buttons. The only difference between toggle buttons and radio buttons is
that toggle buttons automatically call gtk_toggle_button_set_active()
for every buttons of its group if it is selected.

  Maybe you don't want to use radio buttons like this:
     < > choice 1
     <*> choice 2
     < > choice 3
  and you prefer a toolbox like this:
  |        |[        ]|        |
  | icon 1 |[ icon 2 ]| icon 3 |
  |        |[        ]|        |
 (sorry, if my ascii art looks ugly, I'm not an artist)

then, you can create your radiobuttons like this:
button = gtk_radio_button_new(group);
icon = gtk_pixmap_new(..., ...);
gtk_container_add(GTK_CONTAINER(button), icon);
gtk_toggle_button_set_mode(GTK_TOGGLE_BUTTON(button), FALSE);

The last function prevent the < > or <*> indicator to be drawn, instead,
the radio button will be shown pressed or depressed to show its state.


David dindinx org

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