Ok.. I used this to change a Text Field
in my apps...

//this is where I need to change the label
if(StrCompare(ArmedState, "0") == 0)
     {
      StrCopy(ArmedState, "1");
      Handle AText = MemHandleNew(8);
      StrCopy(MemHandleLock(AText), "Armed");
      MakeMyBeep(shortBeep, 3);
     ChangeTextLab(MainText164Field, AText);
      MemHandleUnlock(AText);
      MemHandleFree(AText);
    }
     else
     {
      StrCopy(ArmedState, "0");
      Handle DText = MemHandleNew(10);
      StrCopy(MemHandleLock(DText), "Disarmed");
      MakeMyBeep(shortBeep, 5);
      ChangeTextLab(MainText164Field, DText);
      MemHandleUnlock(DText);                                <--Invalid
Handle error
      MemHandleFree(DText);
     }
    MemHandleUnlock(GCode);


//this is the changing label function...
static void ChangeTextLab(Word FieldID, Handle textH)
{

 Handle  oldTxtH;
 FormPtr  frm = FrmGetActiveForm();
 FieldPtr fldP;

 fldP = FrmGetObjectPtr(frm, FrmGetObjectIndex(frm, FieldID));
 oldTxtH = FldGetTextHandle(fldP);

 FldSetTextHandle(fldP, textH);
 FldDrawField(fldP);

 if(oldTxtH)
  MemHandleFree(oldTxtH);

}


But It give me a invalid handle error...
Does someone have a clue....

Or is there a better way to make something like this
simply change the text on a label or non-editable textfield



-- 
For information on using the ACCESS Developer Forums, or to unsubscribe, please 
see http://www.access-company.com/developers/forums/

Reply via email to