Re: Scrollbars upside down



On 2001.03.17 02:35:22 +0100 Mark Roberts wrote:
> Dear Folks!
> 
> Using
> 
> adjustment = gtk_adjustment_new (0.0, 0.0, 100.0, 0.1, 3.0, 1.0);
> scale = gtk_vscale_new (GTK_ADJUSTMENT (adjustment));
> 
> I get a vertical scale with zero being the value when the slider is at
> the
> top and 100 being the value at the bottom. How do I swap these, so that I
> can, say, turn the volume _down_ to zero? Simply typing
> 
> adjustment = gtk_adjustment_new (0.0, 100.0, 0.0, 0.1, 3.0, 1.0);
> 
> doesn't work. I bet it's obvious when pointed out. :)
> 

Same problem here. But it isn't a problem.
Simply hide the value-label (gtk_scale_set_draw_value(GTK_SCALE(scale),
0);), put it in a hbox or vbox and pre- or append a selfmade slider. Now,
make a simple callback that when the slider changes	
(gtk_signal_connect (GTK_OBJECT (lavedit_slider_adj), "value_changed",
scrollbar_value_changed, label);), this will need the following callback:

void scollbar_value_changed(GtkAdjustment *adj, GtkWidget *label)
{
	char temp[256];
	sprintf(temp, "%d", 100 - adj->value);
	gtk_label_set_text(temp);
}

That sets the label to show the "inverted value". Also, do all calculations
with this inverted value. That should work and that's what I generally use.

Regards,

Ronald

-- 
---------------------------------------------------.
--   .-.    | Ronald Bultje                        |
--   /V\    | Running: Linux 2.4.2 and OpenBSD 2.8 |
--  // \\   | E-mail : rbultje ronald bitfreak net |
-- /(   )\  | WWW    : http://ronald.bitfreak.net/ |
--  ^^-^^   |    *** Warning: Unix Addicted ***    |
---------------------------------------------------'





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