I have some code here that I've been playing with, and with one
version of it, I get a fatal error about forms already loaded, with a
1-line change to the code, I get an error about AMXHardwareTD1.c Low
memory checksum fail line 791. 

        The line that is giving me troubles is the
FrmReturnToForm(mainForm) line. That line used to read
FrmGotoForm(mainForm), but complained about a form already being loaded.
I'm assuming that means mainForm, and not prefsForm, so I changed it, and 
it works as intended, but after a few minutes of poking around in the
app, I get the memory corruption. Any ideas?  

The code is below: 

-------------------------------------------------
#include "viewer.h"
#include "prefsdata.h"
#include "resourceids.h"
#include "callback.h"
#include "prefsform.h"
  
static FormPtr prefsForm;

static void prefsInitForm(void)
{
    prefsForm = FrmGetActiveForm();

    FrmDrawForm(prefsForm);

    CtlSetValue(getObjectPtr(frmPrefMenuHack), prefs()->menuHack);
    CtlSetValue(getObjectPtr(frmPrefPenScrollOff),
prefs()->penScrollAmount == SCROLLTYPE_OFF);
    CtlSetValue(getObjectPtr(frmPrefPenScrollPage),
prefs()->penScrollAmount == SCROLLTYPE_PAGE);
}

Boolean prefsFormHandleEvent(const EventPtr event)
{
    Boolean handled = false;

    CALLBACK_PROLOGUE

    switch (event->eType) {

    case ctlSelectEvent:
        if (event->data.ctlEnter.controlID == frmPrefOK)
        {
            prefs()->menuHack =
CtlGetValue(getObjectPtr(frmPrefMenuHack));
    
            if (CtlGetValue(getObjectPtr(frmPrefPenScrollPage)))  
                prefs()->penScrollAmount = SCROLLTYPE_PAGE;
            else
                prefs()->penScrollAmount = SCROLLTYPE_OFF;
        }
        else if (event->data.ctlEnter.controlID != frmPrefCancel)
            break;

        FrmReturnToForm(frmMain);
        handled = true;
        break;

    case frmOpenEvent:
        prefsInitForm();
        handled = true;
        break;

    default:                                                               
        handled = false;
    }

    CALLBACK_EPILOGUE

    return handled;
}


+-----------------------------------------------------------+
|  David A. Desrosiers             *calloc(1,sizeof(geek))  |
|  [EMAIL PROTECTED]       http://www.gnu-designs.com  |
|  void main (void) { if (windows=="useful") hell=frozen }  |
|  PGP: 80F8 7FFF 8329 292F 2696  E354 3D9E 2800 5B8D ABC1  |
+-----------------------------------------------------------+


Reply via email to