It was something about "overlay-scroll" or whatever. need help tho



it took me the entire afternooon to get an idea of what those red
thin linnes a "thumb" bar were.  i think it was only in ubuntu...
and i have fixed parts of it.

now i have two separate horizontal scrollbars. they range from 0 to
100 exactly what i want.  and now, in place of that red line is a
regular groove with a tab inside that you slide to and fro.

my quandry is how to move the first grove up beneath the first
scollbar with a "0"?  do i need another box--a box4?  i have tried a
number of things, but nothing works.  can anybody help me?

thanks in advance,

gary

code appended below my sig.

-- 
 Gary Kline  kline thought org  http://www.thought.org  Public Service Unix

=======
#include <stdio.h>
#include <gtk/gtk.h>

GtkWidget *hscale, *hscale7;

void
scale_set_default_values (GtkScale *scale)
{
  //gtk_range_set_update_policy (GTK_RANGE (scale), GTK_UPDATE_CONTINUOUS);
  gtk_scale_set_digits (scale, 0); // Zero digits after N. 
  gtk_scale_set_value_pos (scale, GTK_POS_TOP);
  gtk_scale_set_draw_value (scale, TRUE);
}

    /*
     * creates the sample window 
     */
void
create_range_controls (void)
{
  GtkWidget *window;
  GtkWidget *box1, *box2, *box3;
  GtkWidget *button, *quitbox;
  GtkWidget *scrollbar, *scrollbar7;
  GtkObject *adj1, *adj7;

  /*
     Standard window-creating stuff 
   */
  window = gtk_window_new (GTK_WINDOW_TOPLEVEL);

  gtk_window_set_position (GTK_WINDOW (window), GTK_WIN_POS_CENTER);
  gtk_window_set_default_size (GTK_WINDOW (window), 350, 450);

  g_signal_connect (GTK_OBJECT (window), "destroy",  
                      GTK_SIGNAL_FUNC (gtk_main_quit), NULL);
  gtk_window_set_title (GTK_WINDOW (window), "two horiz bars");

  box1 = gtk_vbox_new (FALSE, 0);
  gtk_container_add (GTK_CONTAINER (window), box1);
  gtk_widget_show (box1);

  box2 = gtk_hbox_new (FALSE, 10);
  gtk_container_set_border_width (GTK_CONTAINER (box2), 10);
  gtk_box_pack_start (GTK_BOX (box1), box2, TRUE, TRUE, 0);
  gtk_widget_show (box2);

  /*
     value, lower, upper, step_increment, page_increment, page_size 
   */
  /*
     Note that the page_size value only makes a difference for
     * scrollbar widgets, and the highest value you'll get is actually
     * (upper - page_size). 
   */
  adj1 = gtk_adjustment_new (0.0, 0.0, 101.0, 0.1, 1.0, 1.0);
  adj7 = gtk_adjustment_new (0.0, 0.0, 101.0, 0.1, 1.0, 1.0);


  box3 = gtk_vbox_new (FALSE, 10);
  gtk_box_pack_start (GTK_BOX (box2), box3, TRUE, TRUE, 0);
  gtk_widget_show (box3);

  /* Reuse the same adjustment BAR-1*/

  hscale = gtk_hscale_new (GTK_ADJUSTMENT (adj1));
  gtk_widget_set_usize (GTK_WIDGET (hscale), 200, -1);
  scale_set_default_values (GTK_SCALE (hscale));
  gtk_box_pack_start (GTK_BOX (box3), hscale, TRUE, TRUE, 0);
  gtk_widget_show (hscale);

  /**** BAR-2 ****/
  hscale7 = gtk_hscale_new (GTK_ADJUSTMENT (adj7));
  gtk_widget_set_usize (GTK_WIDGET (hscale7), 200, -1);
  scale_set_default_values (GTK_SCALE (hscale7));
  // box 3 and 7
  gtk_box_pack_start (GTK_BOX (box3), hscale7, TRUE, TRUE, 0);
  gtk_widget_show (hscale7);


  /* Reuse the same adjustment again */

  scrollbar = gtk_hscrollbar_new (GTK_ADJUSTMENT (adj1));
  //scrollbar7 = gtk_hscrollbar_new (GTK_ADJUSTMENT (adj7));
  /*
     Notice how this causes the scales to always be updated
     * continuously when the scrollbar is moved 
   */

  gtk_range_set_update_policy (GTK_RANGE (scrollbar), GTK_UPDATE_CONTINUOUS);
  // box 3 and bar
  gtk_box_pack_start (GTK_BOX (box3), scrollbar, TRUE, TRUE, 0);
  gtk_widget_show (scrollbar);

  scrollbar7 = gtk_hscrollbar_new (GTK_ADJUSTMENT (adj7));
  gtk_range_set_update_policy (GTK_RANGE (scrollbar7), GTK_UPDATE_CONTINUOUS);
  // box 3 and bar7
  gtk_box_pack_start (GTK_BOX (box3), scrollbar7, TRUE, TRUE, 0);
  gtk_widget_show (scrollbar7);


  box2 = gtk_hbox_new (FALSE, 10);
  gtk_container_set_border_width (GTK_CONTAINER (box2), 10);
  gtk_box_pack_start (GTK_BOX (box1), box2, TRUE, TRUE, 0);
  gtk_widget_show (box2);

  /****  END of horizontal bar stuff ****/


  quitbox = gtk_vbox_new (FALSE, 10);   // WAS "box2" reused  
  gtk_container_set_border_width (GTK_CONTAINER (quitbox), 10);

        /**** "box1" below, so this button fits into the overall Window ****/
  gtk_box_pack_start (GTK_BOX (box1), quitbox, FALSE, TRUE, 0);
  gtk_widget_show (quitbox);

  button = gtk_button_new_with_label ("Quit");
  gtk_signal_connect_object (GTK_OBJECT (button), "clicked",  
                             GTK_SIGNAL_FUNC (gtk_main_quit), NULL);
  gtk_box_pack_start (GTK_BOX (quitbox), button, TRUE, TRUE, 0);
  GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT);
  gtk_widget_grab_default (button);
  gtk_widget_show (button);

  gtk_widget_show (window);
}

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

  create_range_controls ();  // Handles windows and h-bars

  gtk_main ();

  return (0);
}




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