static void JavaFormResizeForm(FormType *frmP,RectangleType *fromBounds, RectangleType *toBounds) { Int16 heightDelta, widthDelta; UInt16 numObjects, i; heightDelta=(toBounds->extent.y-toBounds->topLeft.y)-(fromBounds->extent.y-fromBounds->topLeft.y); widthDelta=(toBounds->extent.x-toBounds->topLeft.x)-(fromBounds->extent.x-fromBounds->topLeft.x); numObjects=FrmGetNumberOfObjects(frmP); for(i=0; i<numObjects; i++) { Coord x,y; FrmGetObjectPosition(frmP,i,&x,&y); switch(FrmGetObjectType(frmP,i)) { case frmGraffitiStateObj: FrmSetObjectPosition(frmP,i,x+widthDelta,y+heightDelta); break; default: FrmSetObjectPosition(frmP,i,x+(widthDelta>>1),y+(heightDelta>>1)); break; } } }
FieldType * MyFrmGetActiveField() { Err err; UInt16 focus; FormType * activeForm; if ( (activeForm = FrmGetActiveForm()) == 0 || (focus = FrmGetFocus(activeForm)) == noFocus) { return 0; } FieldType * activeField = 0; switch (FrmGetObjectType(activeForm, focus)) { case frmFieldObj: UInt32 romVersion = 0; err = FtrGet(sysFtrCreator, sysFtrNumROMVersion, &romVersion); activeField = (romVersion >= sysMakeROMVersion(4, 0, 0, sysROMStageRelease, 0)) ? FrmGetActiveField(0) : (FieldType *)FrmGetObjectPtr(activeForm, focus); break; case frmTableObj: TableType * activeTable = (TableType *)FrmGetObjectPtr(activeForm, focus); activeField = TblGetCurrentField(activeTable); break; default: break; } /* this might not work, eg., expense. perhaps if the field is new, it has no text handle. if (activeField) { if (FldGetTextHandle(activeField) == 0) { return 0; } FieldAttrType a; FldGetAttributes(activeField, &a); if (!(a.usable && a.editable)) { return 0; } } */ return activeField; }