[CM] A question about GUI rpogramming for SND

Bill Schottstaedt bil@ccrma.Stanford.EDU
Fri, 27 May 2005 04:13:13 -0700


 > It appears from my experimentation that all the elements of a gui widget must
 > be defined and loaded at start-up.  In other words, if I have a widget that
 > is a slider with a minimum and a maximum value, those values must be defined
 > when the program is loaded.  Is this true?

Sliders have default ranges: 0 to 100, but they can also be changed at any time.

 > If so, is there any way that I can modify the default values for a slider,
 > say, when the window containing it is opened?

In Motif, use XtVaSetValues.  In Gtk, probably gtk_adjustment_set_value,
or set the value field by hand -- (set! (.value (GTK_ADJUSTMENT adj)) 50.0).

 > In Dave Phillips' marks-menu.scm, there is a dialog for playing between two marks.
 > The marks to play between are chosen using sliders.  The initial boundary values
 > for these sliders are hard-coded into the dialog as 0 and 25.  I routinely place
 > up to 75 or 100 marks in a soundfile. Is there a way that I can have the window
 > dialog, when it is called, look to see what the largest mark number is for the
 > currently selected sound and channel and adjust the maximum value of the slider
 > to match that value? In other words, if I have 37 marks in a sound and I open
 > the play-between-marks dialog from the menu, the sliders go from 0 to 36?

Yes.  I changed the defaults to do this; also to highlight the currently selected
marks, and so on.