On 14-Jul-99 James Lynes wrote:
> CAN YOU SHOW CODE?.... SURE: here's the code snippet
>
> =======================================================
> case frmOpenEvent: // The form was told to open.
> {
> CharPtr newText;
> Handle newHandle;
>
> // Get references to form components
> frm = FrmGetActiveForm();
> ctlIndex = FrmGetObjectIndex(frm, OptionsBacklightEnableCheckbox);
> ctlBacklightEnable = FrmGetObjectPtr(frm, ctlIndex);
> ctlIndex = FrmGetObjectIndex(frm, OptionsAutoOffCheckbox);
> ctlAutoOff = FrmGetObjectPtr(frm, ctlIndex);
> ctlIndex = FrmGetObjectIndex(frm, OptionsFixedFontCheckbox);
> ctlFixedFont = FrmGetObjectPtr(frm, ctlIndex);
> ctlIndex = FrmGetObjectIndex(frm, OptionsGuiMenusCheckbox);
> ctlGuiMenus = FrmGetObjectPtr(frm, ctlIndex);
> ctlIndex = FrmGetObjectIndex(frm, OptionsCustConnCheckbox);
> ctlCustConn = FrmGetObjectPtr(frm, ctlIndex);
> ctlIndex = FrmGetObjectIndex(frm, OptionsLogEnableCheckbox);
> ctlLogEnable = FrmGetObjectPtr(frm, ctlIndex);
>
> // init checked states
> if (Options.fBacklight) CtlSetValue(ctlBacklightEnable, 1);
> if (Options.fPwrTimeout) CtlSetValue(ctlAutoOff, 1);
> if (Options.fFixedFont) CtlSetValue(ctlFixedFont, 1);
> if (Options.fGuiMenus) CtlSetValue(ctlGuiMenus, 1);
> if (Options.fConnParms) CtlSetValue(ctlCustConn, 1);
> if (Options.fLogging) CtlSetValue(ctlLogEnable, 1);
>
> FrmDrawForm (frm);
> handled = true;
> break;
> }
> =====================================================
>
> ...only the checkboxes that are initialized to 1(ON)
> behave strange....if the "init checked states" section
> is moved to a section that responds to a form button push
> (after the frmOpenEvent) everything works without problems.
> Also: it doesn't help to move the init code past the
> FrmDrawForm call either
That is the same stuff that I do. Though mine looks like this, but I
probably don't need to set them to 0..
if (PrefsR->ApptPrefs.weekstart == '1')
CtlSetValue(FrmGetObjectPtr(frm, FrmGetObjectIndex(frm,
checkboxID_apptprefsweekstart)), 1);
else CtlSetValue(FrmGetObjectPtr(frm, FrmGetObjectIndex(frm,
checkboxID_apptprefsweekstart)), 0);
I do it before the FrmDrawForm in the frmOpenEvent just like you. I'm
guessing that it is a problem in another case within your form handler
function -- like a missing break statement. Try snipping some stuff out of
it until it starts working.
/* Chris Faherty <[EMAIL PROTECTED]>, finger for PGP */