Date: Mon, 10 Dec 2001 09:21:13 +0100 From: Alan Schmitt To: lablgtk at kaba.or.jp Subject: Re: setting the "upper" value of an adjustment Message-ID: <20011210092113.B894 at alan-schm1p> Mail-Followup-To: lablgtk at kaba.or.jp References: <20011209180210.A11954 at alan-schm1p> <20011210151319H.garrigue at kurims.kyoto-u.ac.jp> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: =?iso-8859-1?Q?=3C20011210151319H=2Egarrigue=40kurims=2Ekyoto-u=2Eac=2Ej?= =?iso-8859-1?Q?p=3E=3B_from_garrigue=40kurims=2Ekyoto-u=2Eac=2Ejp_on_lun?= =?iso-8859-1?Q?=2C_d=E9c_10=2C_2001_at_03:13:19_+0900?= * Jacques Garrigue (garrigue at kurims.kyoto-u.ac.jp) wrote: > From: Alan Schmitt > > > I'm still converting my old GTK program, and I'm trying to deal with > > this code: > > GTK_ADJUSTMENT(delay_adjustment) -> upper = minutes_span; > > which basically modifies the "upper" field of an adjustment. > > I have a strong feeling that it is not a good thing to do. > What if you end up with "value" being greater than "upper"? > Well, I also set the value ... And anyway, what happens if the value is set (using set_value, iirc) to something greater than "upper" ? > Except special cases, you're not supposed to modify directly the > members of a gtk object. > > > So I'm wondering if this is possible with lablgtk (looking at gData.mli, > > it does not seem possible), or if the only choice consists of creating a > > new adjustment (and thanking the GC for not having to deal with the old > > one ;-) > > Since there is no function to change the bounds of an adjustment in in > GTK+ itself, this would seem to be the right thing to do. > > Yet, this doesn't seem that clear: the documentation says that this is > OK for the owner of an adjustment to change the bounds, then calling > the "changed" signal. Does it mean that I should add a set_bounds > functions, eventhough there is no such thing in GTK+ ? Actually I don't think so anymore ... I create a new adjustment each time I need one, and use the scale#set_adjustment to attach it to the scale (luckily enough there is such a function). I don't know if set_value is just a convenience function in gtk, or if it exists to discourage direct modification of the record ... Alan -- The hacker: someone who figured things out and made something cool happen.