Nitin
12/20/2005 4:21:00 AM
Hi,
Then I think cmb is a form control name. As you said that it is bound
control, then it will be better to take it as table's field. Do it like this:
void initButtonA()
{
if ( Table.ComboField == Enum1::Value1 )
buttonA.enabled( true );
else
buttonA.enabled( false );
}
Also call the same method from modified() method on Data Source -> field ->
ComboField.
Cheers
Nitin
"PacMan" wrote:
> Thanks for the suggestion. However, nothing has changed.
>
> Here is what I did.
>
> in the form data source:
> public int active()
> {
> int ret;
>
> ret = super();
> element.initButtonA();
>
> return ret;
> }
>
> Is this what you suggested?
>
> The enabling/disabling works when the combo box is modified, but not on the
> initial activation of the form.
> It seems that the combo.selection() always = 0 on startup, regardless of the
> actual data from the datasource that is loaded into the combo box , hence the
> button is always disabled (i set the button disabled when enum value = 0)
>
> I would appreciate more suggestions/insights. Thanks.
>
> -Jimm Bo
>
> "Nitin" wrote:
>
> > Hi,
> >
> > You need to override a method active() on datasource. In this method after
> > super() just call this method.
> > Actually when ever you change a record the button should work according to
> > the value in that record.
> >
> > Cheers
> > Nitin
> >
> > "PacMan" wrote:
> >
> > > Greetings!
> > >
> > > I have a form that uses a combo box to enable/disable a button, depending on
> > > the content of the combo box. I overrode the modified() method to call my
> > > method InitButton() which does the actual button.enabled( false ) call. I do
> > > a selection on the combo box, and the button is enabled/disabled. So far. so
> > > good.
> > >
> > > However, the combo box is a bound control, and even though I call
> > > initButton() in my form's init() method, the button is not enabled/disabled
> > > correctly based on the combo box data fetched from the datasource. When I do
> > > a selection, though, it does what it is supposed to. As I mentioned, both the
> > > combobox modified() and form init() method both call initButton().
> > >
> > > Any idea why loading the data does not initialize the button?
> > >
> > > Why is the value of the combobox.selection() always 0?
> > >
> > > Here is my code:
> > >
> > > in the form:
> > > public void init()
> > > {
> > > super();
> > > element.initButtonA();
> > > }
> > >
> > > in the combo box:
> > > public boolean modified()
> > > {
> > > boolean ret;
> > >
> > > ret = super();
> > > element.initButtonA();
> > > return ret;
> > > }
> > >
> > > void initButtonA()
> > > {
> > > if ( cmb.selection() == Enum1::Value1 )
> > > buttonA.enabled( true );
> > > else
> > > buttonA.enabled( false );
> > > }
> > >
> > > Thanks!