On Monday 07 October 2002 1:35 pm, Rob Lahaye wrote: > Angus Leeming wrote: > > Maybe we're looking at the wrong object. We should be > > looking at the input object to check its activation state, > > not at the label. > > > > Look in the xforms source (object.c). fl_activate_object and > > fl_deactivate_object most definitely DO set the active flag > > appropriately. > > No, I'm not looking at the wrong object. > I just found out: > > FL_OBJECT *object; > > object is active: object->active = 1 > object is inactive: object->active = -1 > > So using "if (object->active)" always executes the true > case!!! We should not treat it implicitly as a bool. > > Instead we should use: > object->active > 0 for active > and > object->active < 0 for inactive > > Ha, silly, isn't it! > > Cheers, > Rob.
Well done, Rob. why not add a little helper function to xforms_helpers.[Ch] bool isActive(FL_OBJECT * ob) { return ob && ob->active > 0; } Angus aleem@thorax:src$ grep ACTIVATED *.h flinternal.h:#define DEACTIVATED -1 /* must be none zero and negative */