static void SetPeople( Short num ) { Int x; Boolean found = false; FormPtr frm; ControlPtr cPtr; Word oIdx; frm = FrmGetActiveForm(); x = MaxPlayers - 1; while( ( x > ( MaxPlayers - (num + 1) ) ) && !found ) { oIdx = FrmGetObjectIndex( frm, pbtnVal[x--] ); cPtr = FrmGetObjectPtr( frm, oIdx ); if( CtlGetValue( cPtr ) ) { CtlSetValue( cPtr, false ); found = true; } } if ( found ) { stor.tmpcomputers = MaxPlayers - (num + 1); oIdx = FrmGetObjectIndex( frm, cbtnVal[stor.tmpcomputers] ); cPtr = FrmGetObjectPtr( frm, oIdx ); CtlSetValue( cPtr, true); } }
static Boolean ResidentBrowseFormFieldChanged(AppContext* appContext, FormType* form, EventType* event) { char * word; UInt32 newSelectedWord=0; FieldType * field; ListType * list; UInt16 index=FrmGetObjectIndex(form, fieldWord); Assert(index!=frmInvalidObjectId); field=(FieldType*)FrmGetObjectPtr(form, index); Assert(field); index=FrmGetObjectIndex(form, listMatching); Assert(index!=frmInvalidObjectId); list=(ListType*)FrmGetObjectPtr(form, index); Assert(list); word=FldGetTextPtr(field); // TODO: get length of the word via FldGetTextLength() if (word && *word) newSelectedWord = dictGetFirstMatching(GetCurrentFile(appContext), word); if (appContext->selectedWord != newSelectedWord) { appContext->selectedWord = newSelectedWord; Assert(appContext->selectedWord < appContext->wordsCount); LstSetSelectionMakeVisibleEx(appContext, list, appContext->selectedWord); } return true; }
static void SetComputers( Short num ) { FormPtr frm; ControlPtr cPtr; Word oIdx; if( num > (MaxPlayers - 1) || num < 0 ) { ErrNonFatalDisplayIf( true, "SetComputers: Out of Bounds"); return; } if( stor.tmpcomputers == num ) { return; } frm = FrmGetActiveForm(); /* Unset the old one */ oIdx = FrmGetObjectIndex( frm, cbtnVal[stor.tmpcomputers] ); cPtr = FrmGetObjectPtr( frm, oIdx ); CtlSetValue( cPtr, false ); /* Set new one */ oIdx = FrmGetObjectIndex( frm, cbtnVal[num] ); cPtr = FrmGetObjectPtr( frm, oIdx ); CtlSetValue( cPtr, true ); stor.tmpcomputers = num; if( stor.tmpcomputers + stor.tmpplayers > MaxPlayers ) { SetPlayers( MaxPlayers - stor.tmpcomputers ); } return; }
static Boolean UserCredentialsFormHandleEvent(EventType* event) { switch (event->eType) { case ctlSelectEvent: DMSG("UserCredentialsFormHandleEvent(): ctlSelectEvent"); DENDL; if (okButton == event->data.ctlSelect.controlID) { FormType* form = FrmGetFormPtr(userCredentialsForm); UInt16 emailIndex = FrmGetObjectIndex(form, emailField); UInt16 passwordIndex = FrmGetObjectIndex(form, passwordField); const char* email = FldGetTextPtr((FieldType*)FrmGetObjectPtr(form, emailIndex)); const char* password = FldGetTextPtr((FieldType*)FrmGetObjectPtr(form, passwordIndex)); if (NULL == email || 0 == StrLen(email)) { FrmSetFocus(form, emailIndex); return true; } if (NULL == password || 0 == StrLen(password)) { FrmSetFocus(form, passwordIndex); return true; } } return false; default: return false; } }
static void UserCredentialsFormValidate(FormType* form, FlickrPrefs& prefs) { const char* email = FldGetTextPtr((FieldType*)FrmGetObjectPtr(form, FrmGetObjectIndex(form, emailField))); const char* password = FldGetTextPtr((FieldType*)FrmGetObjectPtr(form, FrmGetObjectIndex(form, passwordField))); StrCopy(prefs.email, email); StrCopy(prefs.password, password); }
static Boolean prefs_save_checkboxes_1() { FormPtr frm; ControlPtr checkbox; Boolean val, dirty = false; frm = FrmGetActiveForm(); checkbox = FrmGetObjectPtr(frm, FrmGetObjectIndex(frm, check_prf_4)); my_prefs.sound = (CtlGetValue(checkbox) != 0); // Inverted background: checkbox = FrmGetObjectPtr(frm, FrmGetObjectIndex(frm, check_prf_13)); val = (CtlGetValue(checkbox) != 0); if (my_prefs.black_bg != val) dirty = true; my_prefs.black_bg = val; // Color: checkbox = FrmGetObjectPtr(frm, FrmGetObjectIndex(frm, check_prf_14)); val = (CtlGetValue(checkbox) != 0); if (my_prefs.color_on != val) dirty = true; my_prefs.color_on = val; return dirty; }
/* Initialize the details form */ static void DetailsFormInit( void ) { FormType* detailsForm; FieldType* urlField; UInt16 reference; detailsForm = FrmGetFormPtr( frmDetails ); urlField = GetObjectPtr( frmDetailsLink ); reference = GetHistoryCurrent(); if ( AddURLToField( urlField, reference ) ) FrmShowObject( detailsForm, FrmGetObjectIndex( detailsForm, frmDetailsCopy ) ); else FrmHideObject( detailsForm, FrmGetObjectIndex( detailsForm, frmDetailsCopy ) ); FrmDrawForm( detailsForm ); AddDocNameTitle( Prefs()->docName ); CtlSetValue( GetObjectPtr( frmDetailsStatusRead ), LinkVisited( reference ) ); CtlSetValue( GetObjectPtr( frmDetailsStatusUnread ), ! LinkVisited( reference ) ); CtlSetValue( GetObjectPtr( frmDetailsShowImages ), ShowImages( reference ) ); }
/*********************************************************************** * * FUNCTION: SetTimeTriggers * * DESCRIPTION: This routine sets the text label of the start time and * end time triggers. * * PARAMETERS: startTime - pointer to TimeType * endTime - pointer to TimeType * startTimeText - buffer that holds start time string * emdTimeText - buffer that holds end time string * timeFormat - time format * untimed - true if there isn't a time. * * RETURNED: nothing * * REVISION HISTORY: * Name Date Description * ---- ---- ----------- * art 4/4/96 Initial Revision * ***********************************************************************/ static void SetTimeTriggers (TimeType startTime, TimeType endTime, Char * startTimeText, Char * endTimeText, TimeFormatType timeFormat, Boolean untimed) { FormType * frm; ControlPtr startTimeCtl, endTimeCtl; frm = FrmGetActiveForm (); startTimeCtl = FrmGetObjectPtr (frm, FrmGetObjectIndex (frm, TimeSelectorStartTimeButton)); endTimeCtl = FrmGetObjectPtr (frm, FrmGetObjectIndex (frm, TimeSelectorEndTimeButton)); if (! untimed) { TimeToAscii (startTime.hours, startTime.minutes, timeFormat, startTimeText); TimeToAscii (endTime.hours, endTime.minutes, timeFormat, endTimeText); } else { // copy two spaces into these fields instead of just a null // because controls with empty strings (or one space) cause old-style // graphic control behavior, which uses the wrong colors! StrCopy(startTimeText, " "); StrCopy(endTimeText, " "); } CtlSetLabel (startTimeCtl, startTimeText); CtlSetLabel(endTimeCtl, endTimeText); }
/* Indicate that the next tap looks things up in the selected word */ static void ShowSelectWordTapIcon( void ) { FormType* mainForm; UInt16 prevCoordSys; if ( Prefs()->toolbar == TOOLBAR_NONE ) return; mainForm = FrmGetFormPtr( GetMainFormId() ); prevCoordSys = PalmSetCoordinateSystem( STANDARD ); if ( Prefs()->toolbar == TOOLBAR_SILK ) { /* FIXME: figure this out */ } else { FrmHideObject( mainForm, FrmGetObjectIndex( mainForm, bmpWait ) ); if ( isSelectWordTapMode ) { FrmHideObject( mainForm, FrmGetObjectIndex( mainForm, bmpHome ) ); FrmShowObject( mainForm, FrmGetObjectIndex( mainForm, bmpLookup ) ); } else { FrmHideObject( mainForm, FrmGetObjectIndex( mainForm, bmpLookup ) ); FrmShowObject( mainForm, FrmGetObjectIndex( mainForm, bmpHome ) ); } } PalmSetCoordinateSystem( prevCoordSys ); }
static Boolean FormPenDownEvent(EventType * e) { FormPtr frm = FrmGetActiveForm (); UInt16 objIndex; RectangleType r; Boolean res = false; objIndex = FrmGetObjectIndex (frm, ID_EditorMidiKeysGadget); FrmGetObjectBounds (frm, objIndex, &r); if (RctPtInRectangle (e->screenX, e->screenY, &r)) { midikeys_tapped(&midikeys, e->screenX, e->screenY); res = true; } objIndex = FrmGetObjectIndex (frm, ID_EditorNoteListGadget); FrmGetObjectBounds (frm, objIndex, &r); if (RctPtInRectangle (e->screenX, e->screenY, &r)) { notelist_tapped(¬elist, e->screenX, e->screenY); res = true; } UpdateNoteProperties(); return res; }
/* A game of Hide and go Seek er, Show? */ static void HideNShow ( UInt16 hideThis, UInt16 andThis, UInt16 butShowThis ) { FrmHideObject( form, FrmGetObjectIndex( form, hideThis ) ); FrmHideObject( form, FrmGetObjectIndex( form, andThis ) ); FrmShowObject( form, FrmGetObjectIndex( form, butShowThis ) ); }
static void init_lists(Short rw, Short ws) { FormPtr frm; ListPtr lst; frm = FrmGetActiveForm(); /* set initial settings for lists */ lst = FrmGetObjectPtr(frm, FrmGetObjectIndex(frm, list_prf_1)); LstSetSelection(lst, ws-1); lst = FrmGetObjectPtr(frm, FrmGetObjectIndex(frm, list_prf_2)); LstSetSelection(lst, rw-1); }
/********************************************************************** UPDATE_FIELD_SCROLLERS IN: frm, fld, up_scroller, down_scroller = various UI doodads OUT: nothing PURPOSE: Update the given scroller widgets (for the given field (in the given form)), according to whether the field is scrollable in the "up" and "down" directions. **********************************************************************/ void update_field_scrollers(FormPtr frm, FieldPtr fld, Word up_scroller, Word down_scroller) { Boolean u, d; u = FldScrollable(fld, winUp); d = FldScrollable(fld, winDown); FrmUpdateScrollers(frm, FrmGetObjectIndex(frm, up_scroller), FrmGetObjectIndex(frm, down_scroller), u, d); return; }
static void RulesSetScrolling (void) { FieldPtr field; field = FrmGetObjectPtr (rulesFrm, FrmGetObjectIndex (rulesFrm, rulesText)); FrmUpdateScrollers (rulesFrm, FrmGetObjectIndex (rulesFrm, rulesScrollUp), FrmGetObjectIndex (rulesFrm, rulesScrollDown), FldScrollable (field, winUp), FldScrollable (field, winDown)); }
static void init_checkboxes_1() { FormPtr frm; ControlPtr checkbox; frm = FrmGetActiveForm(); checkbox = FrmGetObjectPtr(frm, FrmGetObjectIndex(frm, check_prf_4)); CtlSetValue(checkbox, (my_prefs.sound ? 1 : 0)); checkbox = FrmGetObjectPtr(frm, FrmGetObjectIndex(frm, check_prf_13)); CtlSetValue(checkbox, (my_prefs.black_bg ? 1 : 0)); checkbox = FrmGetObjectPtr(frm, FrmGetObjectIndex(frm, check_prf_14)); CtlSetValue(checkbox, (my_prefs.color_on ? 1 : 0)); }
/*********************************************************************** * * FUNCTION: ThumbnailDetailViewLoadGadgets * * DESCRIPTION: This routine loads sketches into the thumbnail view form * thumbnail gadgets. * * PARAMETERS: recordNum index of the first record to display. * * RETURNED: nothing * ***********************************************************************/ static void ThumbnailDetailViewLoadGadgets(FormType* frm) { UInt16 row; MemHandle recordH; DynamicButtonType* btnThumb, *btnName, *btnNameMasked, *btnAlarm; MemPtr ptr; UInt16 attr; Char* record_name, *record_note; DiddleBugRecordType record; FontID font; UInt32 alarmSecs; UInt16 recordNum = d.top_visible_record; const UInt16 max = Min(recordsPerPage, d.records_in_cat - d.top_row_pos_in_cat); Boolean private = false; for (row = 0; row < max; row++) { /* Get the next record in the current category. */ recordH = DmQueryNextInCategory (d.dbR, &recordNum, p.category); if(row == 0) { /* store the position of the first row so we can use */ /* d.top_row_pos_in_cat+row when drawing */ d.top_row_pos_in_cat = recordH ? DmPositionInCategory(d.dbR, recordNum, p.category) : 0; } btnThumb = (DynamicButtonType*) FrmGetGadgetData(frm, FrmGetObjectIndex(frm, Thumb1 + row)); btnName = (DynamicButtonType*) FrmGetGadgetData(frm, FrmGetObjectIndex(frm, Thumb1Name + row)); btnNameMasked = (DynamicButtonType*) FrmGetGadgetData(frm, FrmGetObjectIndex(frm, Thumb1NameMasked + row)); btnAlarm = (DynamicButtonType*) FrmGetGadgetData(frm, FrmGetObjectIndex(frm, Thumb1Alarm + row)); /* Store record number */ btnThumb->value = recordNum; btnName->value = recordNum; btnNameMasked->value = recordNum; btnAlarm->value = recordNum; /* Clear old internal values */ btnThumb->selected = false; /* Read record attributes */ DmRecordInfo(d.dbR, recordNum, &attr, NULL, NULL); private = attr & dmRecAttrSecret && d.privateRecordStatus == maskPrivateRecords; /* Get a pointer to the record */ ptr = MemHandleLock(recordH); if (private) { DrawMaskedRecord(btnThumb->content.bmpW, maskPattern); } else {
void * GetObjectPtr(UInt16 objectID) { FormType * frmP; frmP = FrmGetActiveForm(); return FrmGetObjectPtr(frmP, FrmGetObjectIndex(frmP, objectID)); }
static void SelectTo() { FormPtr frmP = FrmGetActiveForm(); if (FormIsNot(frmP, FormReply)) return; SendPref pref; ReadSendPreference(pref); if (pref.useFingerAddress) { if (FasSearchAvailable()) { SelectUsingFingerAddr(); return; } } FieldPtr fieldTo = (FieldPtr) GetObjectPtr(frmP, FieldTo); FldSetSelection(fieldTo, 0, StrLen(FldGetTextPtr(fieldTo))); AddrLookupParamsType params; MemSet(¶ms, sizeof(AddrLookupParamsType), 0); params.formatStringP = "^mobile"; params.field1 = addrLookupSortField; params.field2 = addrLookupMobile; params.field2Optional = false; params.userShouldInteract = true; PhoneNumberLookupCustom (fieldTo, ¶ms, true); FrmSetFocus(frmP, FrmGetObjectIndex(frmP, FieldCompose)); }
void GadgetTimeSetRect(RectangleType *rect, TimeType begin, TimeType end, UInt8 day, UInt8 num_times, UInt8 pos) { UInt8 top, height, width, width_base; RectangleType bounds; UInt16 gadgetIndex = FrmGetObjectIndex(gForm, gGadgetID); FrmGetObjectBounds(gForm, gadgetIndex, &bounds); height = GadgetCalcTimeHeight(begin, end); top = GadgetCalcTimeTop(begin); if ( (top + height) > GADGET_MAX_PIXELHEIGHT) height -= ((top + height) - GADGET_MAX_PIXELHEIGHT); width = gGadgetDaysWidth / num_times; width_base = width; if (pos == (GADGET_MAX_AT_A_TIME-1)) { // It's the last item, add any pixels that get cut off by the division otherwise // (like: width: 20, num_items = 3, item width = 6, 2 got cut off, add them to the last entry) width += (gGadgetDaysWidth - (num_times * width)); } RctSetRectangle(rect, // Left Left Offset Days to left lines between days position offset bounds.topLeft.x+GADGET_BASELEFT+GADGET_LEFT+(gGadgetDaysWidth*day)+day + pos * width_base, // Top Top Offset hours bounds.topLeft.y+GADGET_TOP +top, // Width width, // 2px per 15min height); }
static VoidPtr GetObjectPtr (Word objID) { FormPtr frm; frm = FrmGetActiveForm(); return (FrmGetObjectPtr (frm, FrmGetObjectIndex (frm, objID))); }
static void MainFormFindButtonPressed(AppContext* appContext, FormType* form) { const char* newWord=NULL; UInt16 index=FrmGetObjectIndex(form, fieldWordInput); Assert(frmInvalidObjectId!=index); FieldType* field=static_cast<FieldType*>(FrmGetObjectPtr(form, index)); const char* prevWord=ebufGetDataPointer(&appContext->currentWordBuf); Assert(field); newWord=FldGetTextPtr(field); if (newWord && (StrLen(newWord)>0) && (!prevWord || 0!=StrCompare(newWord, prevWord))) StartWordLookup(appContext, newWord); else if (mainFormShowsDefinition!=appContext->mainFormContent) { const char* currentDefinition=ebufGetDataPointer(&appContext->currentDefinition); if ( NULL != currentDefinition ) { // it can be NULL if we didn't have a definition and pressed "GO" // with no word in text field cbNoSelection(appContext); appContext->mainFormContent=mainFormShowsDefinition; diSetRawTxt(appContext->currDispInfo, const_cast<char*>(currentDefinition)); FrmUpdateForm(formDictMain, redrawAll); } } }
/* ** Go to the record specified gadgetID and open the specified ** "field" (the note dialog, the details dialog, ...) */ static void GotoRecordField(UInt16 gadgetID, UInt16 field) { FormType* frm = FrmGetActiveForm(); DynamicButtonType* btn = (DynamicButtonType*) FrmGetGadgetData(frm, FrmGetObjectIndex(frm, gadgetID)); p.dbI = btn->value; LoadRecordData(); switch (field) { case ffNote: DoNoteDialog(0, 0); break; case ffDetails: d.detailsWithSketch = false; FrmPopupForm(RecordDetailsForm); break; case ffAlarm: recordUnsetCountdown(); FrmGotoForm(TimeForm); break; default: /* ignore */ } }
static void AnnotationFormInit( void ) { FormType* annotationForm; annotationForm = FrmGetFormPtr( frmAnnotation ); if ( ( entryP->flags & ANNOTATION_BOOKMARK ) && entryP->id.indexInParagraph == NEW_ANNOTATION ) { SetFormTitle( annotationForm, strAddBookmarkTitle ); } else { SetFormTitle( annotationForm, strAnnotationTitle ); } scrollBar = GetObjectPtr( frmAnnotationScrollBar ); if ( Prefs()->scrollbar == SCROLLBAR_LEFT ) { SetObjectPosition( annotationForm, frmAnnotationField, false ); SetObjectPosition( annotationForm, frmAnnotationScrollBar, true ); } field = GetObjectPtr( frmAnnotationField ); CtlSetUsable( GetObjectPtr( frmAnnotationDelete ), entryP->id.indexInParagraph != NEW_ANNOTATION ); FrmDrawForm( annotationForm ); InsertText( field, data ); if ( entryP->id.indexInParagraph == NEW_ANNOTATION ) FldSetSelection( field, 0, StrLen( data ) ); else FldSetInsertionPoint( field, 0 ); UpdateFieldScrollbar( field, scrollBar ); FrmSetFocus( annotationForm, FrmGetObjectIndex( annotationForm, frmAnnotationField ) ); }
static void NewGameGetPlayerName( UInt16 field, Int16 player) { FormPtr frm = FrmGetActiveForm(); Char *buff; if( tmppref[player].type == PlayerNone ) { return; } buff = FldGetTextPtr( FrmGetObjectPtr( frm, FrmGetObjectIndex( frm, fldNGname0+player ) ) ); if( tmppref[player].type == PlayerHuman ) { StrCopy( tmppref[player].hname, buff ); } if( tmppref[player].type == PlayerAI ) { StrCopy( tmppref[player].aname, buff ); } }
static Boolean ApplicationHandleEvent( EventPtr event ) { FormPtr frm; FieldPtr fld; FieldAttrType fldattr; Int formId; Boolean handled = false; if( event->eType == frmLoadEvent ) { formId = event->data.frmLoad.formID; frm = FrmInitForm( formId ); FrmSetActiveForm( frm ); switch( formId ) { case mainFormID: FrmSetEventHandler( frm, MyMainFormHandleEvent ); fld = FrmGetObjectPtr( frm, FrmGetObjectIndex( frm, dataFieldID ) ); FldGetAttributes( fld, &fldattr ); fldattr.hasScrollBar=true; FldSetAttributes( fld, &fldattr ); break; default: break; } handled = true; } return handled; }
/*********************************************************************** * * FUNCTION: PrvUpdateTimeFields * * DESCRIPTION: Update the current time and new time displayed if they have * changed in the time zone dialog. Also used to update these * times in the daylight saving time dialog. * * PARAMETERS: frm - the time zone or daylight saving time dialog * * RETURNED: nothing * * REVISION HISTORY: * Name Date Description * ---- ---- ----------- * peter 4/13/00 Initial Revision * ***********************************************************************/ static void PrvUpdateTimeFields (FormPtr frm, DateTimeType *currentTimeP, DateTimeType *newTimeP, MemHandle currentTimeHandle, MemHandle newTimeHandle, UInt16 currentTimeFieldID, UInt16 newTimeFieldID) { DateTimeType now, then; UInt32 delta; TimSecondsToDateTime(TimGetSeconds(), &now); if (now.minute != currentTimeP->minute || now.hour != currentTimeP->hour || now.day != currentTimeP->day || now.month != currentTimeP->month || now.year != currentTimeP->year) { then = *currentTimeP; *currentTimeP = now; PrvSetTimeField(frm, currentTimeFieldID, currentTimeHandle, currentTimeP, true); if (FldGetTextLength(FrmGetObjectPtr (frm, FrmGetObjectIndex (frm, newTimeFieldID))) != 0) { delta = TimDateTimeToSeconds(newTimeP) - TimDateTimeToSeconds(&then); TimSecondsToDateTime(TimDateTimeToSeconds(currentTimeP) + delta, newTimeP); PrvSetTimeField(frm, newTimeFieldID, newTimeHandle, newTimeP, true); } } } // PrvUpdateTimeFields
// Audio CD static Boolean AudioCDTabSave() { ControlType *cck3P; FieldType *fld2P, *fld3P; ListType *list1P, *list2P; UInt16 firstTrack; FormPtr frmP; frmP = FrmGetActiveForm(); cck3P = (ControlType *)GetObjectPtr(TabAudioCDMP3Checkbox); fld2P = (FieldType *)GetObjectPtr(TabAudioCDLengthSecsField); fld3P = (FieldType *)GetObjectPtr(TabAudioCDFirstTrackField); list1P = (ListType *)GetObjectPtr(TabAudioCDDriverList); list2P = (ListType *)GetObjectPtr(TabAudioCDFormatList); firstTrack = StrAToI(FldGetTextPtr(fld3P)); if (firstTrack < 1 || firstTrack > 999) { TabSetActive(frmP, myTabP, 2); FrmSetFocus(frmP, FrmGetObjectIndex(frmP, TabAudioCDFirstTrackField)); FrmCustomAlert(FrmErrorAlert, "Invalid track value (1...999)", 0, 0); return false; } gameInfoP->musicInfo.sound.CD = CtlGetValue(cck3P); gameInfoP->musicInfo.sound.drvCD = LstGetSelection(list1P); gameInfoP->musicInfo.sound.frtCD = LstGetSelection(list2P); gameInfoP->musicInfo.sound.defaultTrackLength = StrAToI(FldGetTextPtr(fld2P)); gameInfoP->musicInfo.sound.firstTrack = firstTrack; return true; }
/*********************************************************************** * * FUNCTION: PrvSetTimeField * * DESCRIPTION: Set the given field's text to show a time and day of week. * * PARAMETERS: frm - a pointer to the form containing the field to set * timeFieldID - the ID of the field to set * timeHandle - the handle used for storing the text for this field * time - a pointer to the date and time to show in the field * drawField - whether to draw field after setting its text * * RETURNED: nothing * * REVISION HISTORY: * Name Date Description * ---- ---- ----------- * peter 3/7/00 Initial Revision * ***********************************************************************/ static void PrvSetTimeField(FormType * frm, UInt16 timeFieldID, MemHandle timeHandle, DateTimeType *time, Boolean drawField) { FieldType * timeFieldP; Char * timeString, * timeZoneDOWFormatString, * currentDOWString; MemHandle resHandle; TimeFormatType timeFormat; // Format to display time in timeFormat = (TimeFormatType)PrefGetPreference(prefTimeFormat); timeString = MemHandleLock(timeHandle); TimeToAscii(time->hour, time->minute, timeFormat, timeString); currentDOWString = timeString + StrLen(timeString); currentDOWString[0] = ' '; currentDOWString++; resHandle = DmGetResource(strRsc, DOWformatString); ErrNonFatalDisplayIf(resHandle == NULL, "Missing string resource"); timeZoneDOWFormatString = MemHandleLock(resHandle); DateTemplateToAscii(timeZoneDOWFormatString, time->month, time->day, time->year, currentDOWString, dowLongDateStrLength); MemHandleUnlock(resHandle); MemHandleUnlock(timeHandle); timeFieldP = FrmGetObjectPtr (frm, FrmGetObjectIndex (frm, timeFieldID)); FldSetTextHandle(timeFieldP, timeHandle); if (drawField) FldDrawField(timeFieldP); }
/*********************************************************************** * * FUNCTION: RepeatChangeRepeatOn * * DESCRIPTION: This routine is called when one of the weekly "repeat on" * push button is pushed. This routine checks * if all the buttons has been turned off, if so the day * of the week of the appointment's start date is turn on. * * PARAMETERS: event - pointer to and event * * RETURNED: nothing * ***********************************************************************/ static void RepeatChangeRepeatOn(EventType* event) { UInt16 id = 0; UInt16 dayOfWeek = 0; FormType* frm = FrmGetFormPtr(RepeatForm); Boolean on = false; UInt16 i = 0; const UInt16 idx = FrmGetObjectIndex(frm, RepeatDayOfWeek1PushButton); /* Check if any of the buttons are on. */ for (; i < daysInWeek; i++) { if (FrmGetControlValue(frm, idx + i) != 0) { on = true; break; } } /* If all the buttons are off, turn on the start date's button. */ if (!on) { dayOfWeek = DayOfWeek (d.frm_date.month, d.frm_date.day, d.frm_date.year /*+ firstYear*/); /* frm_date is DateTimeType */ dayOfWeek = (dayOfWeek - d.repeat_start_of_week + daysInWeek) % daysInWeek; id = RepeatDayOfWeek1PushButton + dayOfWeek; CtlSetValue(GetObjectPointer(frm, id), true); } /* Update the display of the repeat description. */ RepeatDrawDescription(frm); }
Char * GetTextFromField ( UInt16 fieldID ) { FieldType *fldP; FormType * frmP; frmP = FrmGetActiveForm(); fldP = FrmGetObjectPtr (frmP, FrmGetObjectIndex ( frmP, fieldID )); /* Find field pointer */ return FldGetTextPtr (fldP); }