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 Err SaveMessageIn(DmOpenRef db, Int16 category) { FormPtr form = FrmGetActiveForm(); if (FormIsNot(form, FormReply)) return frmErrNotTheForm; FieldPtr fieldTo = (FieldPtr) GetObjectPtr(form, FieldTo); FieldPtr fieldCompose = (FieldPtr) GetObjectPtr(form, FieldCompose); char* pszTo = FldGetTextPtr(fieldTo); char* pszCompose = FldGetTextPtr(fieldCompose); if ((pszTo == NULL) || (StrLen(pszTo) == 0)) { ShowMsg("No phone number set."); return -1; } if ((pszCompose == NULL) || (StrLen(pszCompose) == 0)) { FrmCustomAlert(AlertCustom, "Alert", "No message composed.", ""); return -1; } UInt8 state = 0; if (category == CAT_OUTBOX) { SendPref spref; ReadSendPreference(spref); if (spref.requestReport) RequestReport(state); } NewRecordInCategory(db, pszTo, pszCompose, category, state); return errNone; }
// 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; }
Err SendReply(DmOpenRef db, gb2312_table& table) { MethodLogger log("SendReply"); FormPtr form = FrmGetActiveForm(); if (FormIsNot(form, FormReply)) return frmErrNotTheForm; FieldPtr fieldTo = (FieldPtr) GetObjectPtr(form, FieldTo); FieldPtr fieldCompose = (FieldPtr) GetObjectPtr(form, FieldCompose); ListPtr list = (ListPtr) GetObjectPtr(form, ListGroups); Int16 sel = LstGetSelection(list); char* pszTo = FldGetTextPtr(fieldTo); char* pszCompose = FldGetTextPtr(fieldCompose); Err err = -1; Boolean emptyTo = false; if ((pszTo == NULL) || (StrLen(pszTo) == 0)) { emptyTo = true; } Boolean emptyGroup = false; if ((sel == noListSelection) || (sel == 0)) { emptyGroup = true; } if (emptyTo && emptyGroup) { ShowMsg("Please set To or Group."); goto exit; } if ((pszCompose == NULL) || (StrLen(pszCompose) == 0)) { FrmCustomAlert(AlertCustom, "Alert", "No message composed.", ""); goto exit; } if (emptyGroup) SendTheSMS(db, table, pszTo, pszCompose); else { PhoneGroupPtr group = LoadPhoneGroupByUniqId(g_PhoneGroups[sel - 1]->GetUniqId()); UInt32 count = group->GetPhoneGroupItemCount(); for (UInt32 i = 0; i < count; ++i) { PhoneGroupItemPtr item = group->GetPhoneGroupItem(i); SendTheSMS(db, table, item->GetPhone(), pszCompose); } delete group; } exit: return err; }
static void SelectUsingFingerAddr() { FormPtr form = FrmGetActiveForm(); if (FormIsNot(form, FormReply)) return; UInt16 mode = g_ComposeMode; char* pszTo = FldGetTextPtr((FieldPtr) GetObjectPtr(form, FieldTo)); char* pszCompose = FldGetTextPtr((FieldPtr) GetObjectPtr(form, FieldCompose)); char* pszReference = FldGetTextPtr((FieldPtr) GetObjectPtr(form, FieldReference)); UInt16 lenTo = 0; if (pszTo) lenTo = StrLen(pszTo); UInt16 lenCompose = 0; if (pszCompose) lenCompose = StrLen(pszCompose); UInt16 lenReference = 0; if (pszReference) lenReference = StrLen(pszReference); UInt16 size = sizeof(UInt16) + lenTo + 1 + lenCompose + 1 + lenReference + 1; char* ftrBuf = NULL; Err err = FtrPtrNew(appFileCreator, (UInt16) FEATURE_FINGER_ADDR, size, (void**) &ftrBuf); if (err) return; DmSet(ftrBuf, 0, size, 0); UInt16 offset = 0; DmWrite(ftrBuf, offset, &mode, sizeof(UInt16)); offset += sizeof(UInt16); if (lenTo) { DmWrite(ftrBuf, offset, pszTo, lenTo); } offset += lenTo + 1; if (lenCompose) { DmWrite(ftrBuf, offset, pszCompose, lenCompose); } offset += lenCompose + 1; if (lenReference) { DmWrite(ftrBuf, offset, pszReference, lenReference); } FasRequestSearch(appFileCreator); }
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 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 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); } } }
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)); }
wxString wxControl::GetFieldLabel() { FieldType* field = (FieldType*)GetObjectPtr(); if(field==NULL) return wxEmptyString; return FldGetTextPtr(field); }
Char * GetTextFromField ( UInt16 fieldID ) { FieldType *fldP; FormType * frmP; frmP = FrmGetActiveForm(); fldP = FrmGetObjectPtr (frmP, FrmGetObjectIndex ( frmP, fieldID )); /* Find field pointer */ return FldGetTextPtr (fldP); }
// Show a registration dialog where a user enters registration code. // if fDeleteAfterCancel is set to true, we'll remove the registration code // from preferences. We want this behavior if "re-enter registration code" was // pressed after registration process failed (this was an invalid registration code // so we don't want the client to send it to the server -> so we erase it). // If this dialog was brought by "Register" menu item, then we don't want to // touch the registration code (we assume it's correct) // TODO: maybe if we're called from "Register" menu and registartion code // is already present (i.e. valid) we should make it harder to edit it by accident // (e.g. make it read only until user makes some action like pressing a "edit" button) static void MainFormHandleRegister(AppContext* appContext, bool fDeleteAfterCancel) { FormType* form=FrmInitForm(formRegistration); if (!form) { FrmAlert(alertMemError); return; } DefaultFormInit(appContext, form); FrmSetEventHandler(form, RegistrationFormHandleEvent); UInt16 button=FrmDoDialog(form); if (buttonRegister!=button) { if (fDeleteAfterCancel) { appContext->prefs.regCode[0] = '\0'; SavePreferencesInoah(appContext); } goto Exit; } UInt16 index=FrmGetObjectIndex(form, fieldRegCode); Assert(frmInvalidObjectId!=index); const FieldType* field=static_cast<FieldType*>(FrmGetObjectPtr(form, index)); Assert(field); const char* regCode=FldGetTextPtr(field); int regCodeLen = (int)FldGetTextLength(field); if ( (NULL != regCode) && (regCodeLen>0) ) { // save the registration code in preferences so that we can // send it in all requests if (regCodeLen>MAX_REG_CODE_LENGTH) { // this is laziness: reg code longer than MAX_REG_CODE_LENGTH // is invalid for sure so we should just display such message // but we'll just use truncated version and go on with normal // processing regCodeLen=MAX_REG_CODE_LENGTH; } SafeStrNCopy((char*)appContext->prefs.regCode, sizeof(appContext->prefs.regCode), regCode, regCodeLen); RemoveNonDigits( (char*)appContext->prefs.regCode ); // save preferences just for sure - so that we don't loose regCode // in case of a crash SavePreferencesInoah(appContext); // send a registration query to the server so that the user // knows if he registered correctly // it doesn't really matter, in the long run, because every time // we send a request, we also send the registration code and // if it's not correct, we'll reject the query StartRegistration(appContext, (const char*)appContext->prefs.regCode); } Exit: FrmDeleteForm(form); }
static Boolean WordsListFormFieldChanged(AppContext* appContext, FormType* form, EventType* event) { UInt16 index=FrmGetObjectIndex(form, fieldWordInput); Assert(index!=frmInvalidObjectId); FieldType* field=static_cast<FieldType*>(FrmGetObjectPtr(form, index)); Assert(field); index=FrmGetObjectIndex(form, listProposals); Assert(index!=frmInvalidObjectId); ListType* list=static_cast<ListType*>(FrmGetObjectPtr(form, index)); Assert(list); const char* word=FldGetTextPtr(field); // TODO: get length of the word via FldGetTextLength() if (word && *word) { UInt16 proposal=WordsListFormFindClosestProposal(appContext, list, word); LstSetSelection(list, proposal); } return true; }
static void SaveAnnotation( void ) { FieldType* field; Char* note; UInt16 length; field = GetObjectPtr( frmAnnotationField ); note = FldGetTextPtr( field ); if ( note == NULL ) { length = 0; data[ 0 ] = 0; } else { length = StrLen( note ); StrCopy( data, note ); } AddAnnotation( entryP, data ); }
static Err ForwardCurrentRecord(DmOpenRef db) { FormPtr form = FrmGetActiveForm(); if (FormIsNot(form, FormReply)) return frmErrNotTheForm; MemHandle memHandle = 0; SMSDbRecordType smsRecord; Err err = GetSMSRecord(db, g_SelectedCategory, GetCurrentIndex(), smsRecord, memHandle, true); RETURN_ERR_ON_ERR(err); CheckNullPointer(memHandle); FieldPtr fieldTo = (FieldPtr) GetObjectPtr(form, FieldTo); SetFieldText(fieldTo, smsRecord.phoneNumber); SetFieldText((FieldPtr) GetObjectPtr(form, FieldCompose), smsRecord.content); FldSetSelection(fieldTo, 0, StrLen(FldGetTextPtr(fieldTo))); FrmSetFocus(form, FrmGetObjectIndex(form, FieldTo)); MemHandleUnlock(memHandle); return errNone; }
// Music static Boolean MusicTabSave() { ControlType *cck1P, *cck2P; ListType *list1P, *list2P, *list3P; FieldType *fld1P; UInt16 tempo; FormPtr frmP; frmP = FrmGetActiveForm(); cck1P = (ControlType *)GetObjectPtr(TabMusicMusicCheckbox); cck2P = (ControlType *)GetObjectPtr(TabMusicMultiMidiCheckbox); list1P = (ListType *)GetObjectPtr(TabMusicDriverList); list2P = (ListType *)GetObjectPtr(TabMusicRateList); list3P = (ListType *)GetObjectPtr(TabMusicQualityList); fld1P = (FieldType *)GetObjectPtr(TabMusicTempoField); tempo = StrAToI(FldGetTextPtr(fld1P)); if (tempo < 50 || tempo > 200) { TabSetActive(frmP, myTabP, 0); FrmSetFocus(frmP, FrmGetObjectIndex(frmP, TabMusicTempoField)); FrmCustomAlert(FrmErrorAlert, "Invalid tempo value (50...200)", 0, 0); return false; } gameInfoP->musicInfo.sound.music = CtlGetValue(cck1P); gameInfoP->musicInfo.sound.multiMidi = CtlGetValue(cck2P); gameInfoP->musicInfo.sound.drvMusic = LstGetSelection(list1P); gameInfoP->musicInfo.sound.rate = LstGetSelection(list2P); gameInfoP->fmQuality = LstGetSelection(list3P); gameInfoP->musicInfo.sound.tempo = tempo; return true; }
bool handleProcessSoftKeyStroke(PointType * start, PointType * end) { Err err; UInt32 romVersion; RexxletHackPrefs * prefs = 0; // For romVersion-specific behavior. FtrGet(sysFtrCreator, sysFtrNumROMVersion, &romVersion); if (romVersion < sysMakeROMVersion(3, 0, 0, sysROMStageRelease, 0)) { goto passthru; } // Avoid re-entering, only because there's typically not enough // stack space to handle this. If we did our own stack, then maybe... UInt32 isRexxletRunning = 0; err = FtrGet(CREATORID, FEATURE_ISREXXLETRUNNING, &isRexxletRunning); if (err == errNone && isRexxletRunning == 1) { goto passthru; } // Set prefs and check to see if this is our custom penstroke. // If not, pass it thru. prefs = RexxletHackPrefs__ctor(); Int16 strokeIndex = myStroke(start, end, prefs); if (strokeIndex == -1) { goto passthru; } StrokeDescriptor * stroke = RexxletHackPrefs__strokeDescriptor(prefs, strokeIndex); // Set up the Rexxlet launch code's param type. struct RexxAppLaunchRexxletParamType r; MemSet((void *)&r, sizeof(struct RexxAppLaunchRexxletParamType), 0); r.iflags.pauseWhenDone = stroke->flags.pauseWhenDone; r.iflags.copyAndPaste = stroke->flags.copyAndPaste; r.iflags.defaultInput = stroke->flags.defaultInput; r.iflags.defaultOutput = stroke->flags.defaultOutput; r.iflags.defaultError = stroke->flags.defaultError; r.script = RexxletHackPrefs__url(prefs, strokeIndex + 1); // allow a null script...it will pop up the url dialog to prompt for one // if (r.script == 0 || StrLen(r.script) == 0) { // goto passthru; // } r.iflags.args = stroke->flags.args; if (stroke->flags.args == RexxAppLaunchRexxletParamType::ARGS_SELECTION) { FieldType * activeField = MyFrmGetActiveField(); if (activeField) { UInt16 startPosition, endPosition; FldGetSelection(activeField, &startPosition, &endPosition); Int32 len = endPosition - startPosition; if (len > 0) { char * p = FldGetTextPtr(activeField); if (p) { r.args = (char *)MemPtrNew(len + 1); if (r.args) { MemMove(r.args, &p[startPosition], len); r.args[len] = '\0'; } } } } } // no more literal scripts...could be done if we really wanted, e.g., // not in the configuration (we don't want to store scripts in prefs), // but instead to allow the user to use the current selection as the script, // much in the same way we allow the clipboard, e.g., selection: // r.script = "say \"This is the identity Rexxlet! Enter something to return, and press Enter when done:\"; parse pull x; return x"; // r.script = "say \"Please enter numbers to add and press Enter when done:\"; parse pull n; r=0; do i=1 to words(n); if datatype(word(n,i))=\"NUM\" then r=r+word(n,i); end; return r"; // r.script = "parse arg s; say s; return s"; // PGR idea: use currently selected text! if (romVersion < sysMakeROMVersion(5, 0, 0, sysROMStageRelease, 0)) { EvtFlushNextPenStroke(); } // Remember that a rexxlet is active because we're not // going to allow then to be "stacked" for now...not enough stack space! FtrSet(CREATORID, FEATURE_ISREXXLETRUNNING, 1); Rexxlet(r); FtrSet(CREATORID, FEATURE_ISREXXLETRUNNING, 0); if (r.args && stroke->flags.args == RexxAppLaunchRexxletParamType::ARGS_SELECTION) { MemPtrFree(r.args); } if (prefs) { RexxletHackPrefs__dtor(prefs); } return true; passthru: if (prefs) { RexxletHackPrefs__dtor(prefs); } return false; }
Boolean DialogGetNames() { FormPtr prevForm, frm; Word hitButton; Boolean retVal = false; CharPtr text; Int i; FieldPtr fp; VoidPtr vPtr; Word oIdx; // Save previous form prevForm = FrmGetActiveForm(); // Init new form frm = FrmInitForm( frmGetNames); // Set it FrmSetActiveForm(frm); // Set Controls for( i = stor.tmpplayers ; i<MaxPlayers ; i++ ) { fp = GetObjectPtr( fieldGetNamesPlayer[i] ); FldSetUsable ( fp, false ); FldEraseField( fp ); ShowControl( fieldGetNamesLabel[i], 0 ); } FrmDrawForm(frm); for( i=0; i < stor.tmpplayers ; i++ ) { SetFieldTextFromStr( fieldGetNamesPlayer[i], stor.player[i].name ); } FrmSetFocus( frm, FrmGetObjectIndex(frm, fieldGetNamesPlayer[0]) ); // Set the handler // FrmSetEventHandler(frm, DialogNewGameHandleEvent); hitButton = FrmDoDialog(frm); // Get Controls if ( hitButton == btn_OK_frmGetNames ) { for( i=0 ; i<stor.tmpplayers ; i++ ) { oIdx = FrmGetObjectIndex( frm, fieldGetNamesPlayer[i]); vPtr = FrmGetObjectPtr( frm, oIdx ); text = FldGetTextPtr( vPtr ); StrCopy( stor.player[i].name, text ); } retVal = true; } // Delete the form, we're not using it FrmDeleteForm(frm); // Restore previous form. if (prevForm) { FrmSetActiveForm(prevForm); } return retVal; }
void DialogVarients() { FormPtr prevForm, frm; Word hitButton; Word fldIndex; Char tmpString[3]; CharPtr text; // Save previous form prevForm = FrmGetActiveForm(); // Init new form frm = FrmInitForm( frmVariants ); // Set it FrmSetActiveForm(frm); FrmDrawForm(frm); // Set Controls CtlSetValue( GetObjectPtr(check_Bump ), stor.flags & flag_Bump ); CtlSetValue( GetObjectPtr(check_Eclipse ), stor.flags & flag_Eclipse ); CtlSetValue( GetObjectPtr(check_Sampler ), stor.flags & flag_Sampler ); CtlSetValue( GetObjectPtr(check_nTW ), stor.flags & flag_nTW ); CtlSetValue( GetObjectPtr(check_FullHouse), stor.flags & flag_FullHouse ); CtlSetValue( GetObjectPtr(check_Suspend ), stor.flags & flag_Suspend ); // Fill in WinScore with previous value. StrIToA( tmpString, stor.nTrainWrecks ); SetFieldTextFromStr( fldnTrainWrecks, tmpString ); StrIToA( tmpString, stor.nSuspend ); SetFieldTextFromStr( fldnSuspend, tmpString ); // Set the focus to this field so the user can just start typing. fldIndex = FrmGetObjectIndex(frm, fldnTrainWrecks); FrmSetFocus( frm, fldIndex ); // Set the handler FrmSetEventHandler(frm, DialogVariantsHandleEvent); hitButton = FrmDoDialog(frm); // Get Controls text = FldGetTextPtr( FrmGetObjectPtr( frm, fldIndex ) ); if( text != NULL ) { stor.nTrainWrecks = StrAToI( text ); } else { stor.nTrainWrecks = 3; } fldIndex = FrmGetObjectIndex(frm, fldnSuspend); text = FldGetTextPtr( FrmGetObjectPtr( frm, fldIndex ) ); if( text != NULL ) { stor.nSuspend = StrAToI( text ); } else { stor.nSuspend = 10; } // Delete the form, we're not using it FrmDeleteForm(frm); // Restore previous form. if (prevForm) { FrmSetActiveForm(prevForm); } }
void DialogNewGame() { FormPtr prevForm, frm; Word hitButton; Char tmpString[5]; CharPtr text; Word fldIndex; Int x; // Save previous form prevForm = FrmGetActiveForm(); // Init new form frm = FrmInitForm( frmNewGame ); // Set it FrmSetActiveForm(frm); FrmDrawForm(frm); // Set Controls // cbtnVal & pbtnVal stor.tmpplayers = stor.numplayers; stor.tmpcomputers = stor.numcomputers; if ( stor.numplayers > 0 ) { x = stor.numplayers; } else { x = 1; } CtlSetValue( GetObjectPtr( pbtnVal[x - 1] ), true ); if ( stor.numcomputers > 0 ) { x = stor.numcomputers; } else { x = 0; } CtlSetValue( GetObjectPtr( cbtnVal[x] ), true ); // Fill in WinScore with previous value. if ( stor.winscore > 9999 ) { // Sanity check... stor.winscore = 300; } StrIToA( tmpString, stor.winscore ); SetFieldTextFromStr( fld_winscore, tmpString ); // Set the focus to this field so the user can just start typing. fldIndex = FrmGetObjectIndex(frm, fld_winscore); FrmSetFocus( frm, fldIndex ); // Set the handler FrmSetEventHandler(frm, DialogNewGameHandleEvent); hitButton = FrmDoDialog(frm); if ( hitButton == btn_OK_frmNewGame ) { text = FldGetTextPtr( FrmGetObjectPtr (frm, fldIndex) ); if ( text != NULL ) { stor.winscore = StrAToI( text ); } else { stor.winscore = 300; } stor.numplayers = stor.tmpplayers; stor.numcomputers = stor.tmpcomputers; } // Delete the form, we're not using it FrmDeleteForm(frm); // Restore previous form. if (prevForm) { FrmSetActiveForm(prevForm); } if ( hitButton == btn_OK_frmNewGame ) { NewGame(); } DrawState(); }
Boolean Ln2SlFormHandleEvent(EventPtr e) { Boolean handled = false; DateType dt = {0, 0}; FormPtr frm = FrmGetFormPtr(Ln2SlForm); switch (e->eType) { case frmOpenEvent: if(gbVgaExists) VgaFormModify(frm, vgaFormModify160To240); DateSecondsToDate(TimGetSeconds(), &dt); DateToAsciiLong(dt.month, dt.day, dt.year + 1904, gPrefdfmts, gAppErrStr); SetFieldTextFromStr(Ln2SlFormInput, gAppErrStr); FrmDrawForm(frm); handled = true; break; case ctlSelectEvent: switch(e->data.ctlSelect.controlID) { case Ln2SlFormOk: FrmReturnToForm(0); handled = true; break; case Ln2SlFormConvert: { HappyDaysFlag dummy; Int16 year, month, day; Char* input; int ret; input = FldGetTextPtr(GetObjectPointer(frm, Ln2SlFormInput)); if ((ret = AnalysisHappyDays(input, &dummy, &year, &month, &day))) { int syear, smonth, sday; int leapyes = CtlGetValue(GetObjectPointer(frm, Ln2SlFormInputLeap)); ret = lunarL2S(lunarRefNum, year, month, day, leapyes, &syear, &smonth, &sday); if (ret == errNone) { Char temp[15]; SysCopyStringResource(temp, DayOfWeek(smonth, sday, syear) + SunString); DateToAsciiLong(smonth, sday, syear, gPrefdfmts, gAppErrStr); StrNCat(gAppErrStr, " [", AppErrStrLen); StrNCat(gAppErrStr, temp, AppErrStrLen); StrNCat(gAppErrStr, "]", AppErrStrLen); FldDrawField(SetFieldTextFromStr(Ln2SlFormResult, gAppErrStr)); } else DisplayInvalidDateErrorString(Ln2SlFormResult); } else { DisplayInvalidDateErrorString(Ln2SlFormResult); } handled = true; break; } default: break; } break; case menuEvent: handled = TextMenuHandleEvent(e->data.menu.itemID, Ln2SlFormInput); break; default: break; } return handled; }
void DialogNewGame() { FormPtr prevForm, frm; UInt16 hitButton; Char tmpString[5]; Char *text; UInt16 x; UInt16 num; // Save previous form prevForm = FrmGetActiveForm(); FrmSetFocus( prevForm, noFocus ); // Init new form frm = FrmInitForm( frmNewGame ); // Set it FrmSetActiveForm(frm); FrmDrawForm(frm); for( x = 0; x < MaxPlayers; x++ ) { tmppref[x].type = GetPlayerType( x ); StrCopy( tmppref[x].hname, pref.player[x].hname ); StrCopy( tmppref[x].aname, pref.player[x].aname ); DrawUserType( x, tmppref[x].type ); NewGameSetPlayerName( fldNGname0+x, x ); } // Fill in WinScore with previous value. if ( pref.winscore > 9999 ) { // Sanity check... pref.winscore = DEFAULT_WINSCORE; } StrIToA( tmpString, pref.winscore ); SetFieldTextFromStr( fld_winscore, tmpString ); // Fill in Opening Roll with previous value. if ( pref.openingroll > pref.winscore || pref.openingroll <= 0 ) { // Sanity check... pref.openingroll = DEFAULT_OPENINGROLL; } StrIToA( tmpString, pref.openingroll ); SetFieldTextFromStr( fld_openingroll, tmpString ); SetFocus( fld_openingroll ); // Set the handler FrmSetEventHandler(frm, DialogNewGameHandleEvent); hitButton = FrmDoDialog(frm); FrmSetFocus( frm, noFocus ); if ( hitButton == btn_OK_frmNewGame ) { /* Get the score needed to win */ pref.winscore = DEFAULT_WINSCORE; text = FldGetTextPtr( GetObjectPtr( fld_winscore ) ); if ( text != NULL ) { num = StrAToI( text ); if( num <= 9999 && num >= 50 ) { pref.winscore = num; } } /* Get the score needed to open game */ pref.openingroll = DEFAULT_OPENINGROLL; text = FldGetTextPtr( GetObjectPtr( fld_openingroll ) ); if ( text != NULL ) { num = StrAToI( text ); if( num <= pref.winscore && num >= 0 ) { pref.openingroll = num; } } pref.totalplayers = 0; for( x = 0; x < MaxPlayers; x++ ) { pref.player[x].type = tmppref[x].type; NewGameGetPlayerName( fldNGname0 + x, x ); StrCopy( pref.player[x].hname, tmppref[x].hname ); StrCopy( pref.player[x].aname, tmppref[x].aname ); if( tmppref[x].type != PlayerNone ) { pref.totalplayers++; } } if( pref.totalplayers > 0 ) { NewGame(); } } // Delete the form, we're not using it FrmDeleteForm(frm); // Restore previous form. if (prevForm) { FrmSetActiveForm(prevForm); } DrawState(); }
Boolean Sl2LnFormHandleEvent(EventPtr e) { Boolean handled = false; DateType dt = {0, 0}; FormPtr frm = FrmGetFormPtr(Sl2LnForm); switch (e->eType) { case frmOpenEvent: if(gbVgaExists) VgaFormModify(frm, vgaFormModify160To240); DateSecondsToDate(TimGetSeconds(), &dt); DateToAsciiLong(dt.month, dt.day, dt.year + 1904, gPrefdfmts, gAppErrStr); SetFieldTextFromStr(Sl2LnFormInput, gAppErrStr); FrmDrawForm(frm); handled = true; break; case ctlSelectEvent: switch(e->data.ctlSelect.controlID) { case Sl2LnFormConvert: { HappyDaysFlag dummy; Int16 year, month, day; int lyear, lmonth, lday; Char* input; int ret = false; input = FldGetTextPtr(GetObjectPointer(frm, Sl2LnFormInput)); if ((ret = AnalysisHappyDays(input, &dummy, &year, &month, &day))) { int leapyes = 0; ret = lunarS2L(lunarRefNum, year, month, day, &lyear, &lmonth, &lday, &leapyes); if (ret == errNone) { if (leapyes) { StrCopy(gAppErrStr, "#)"); } else { StrCopy(gAppErrStr, "-)"); } DateToAsciiLong(lmonth, lday, lyear, gPrefdfmts, &gAppErrStr[2]); FldDrawField(SetFieldTextFromStr(Sl2LnFormResult, gAppErrStr)); } else DisplayInvalidDateErrorString(Sl2LnFormResult); } else DisplayInvalidDateErrorString(Sl2LnFormResult); handled = true; break; } case Sl2LnFormOk: FrmReturnToForm(0); handled = true; break; default: break; } break; case menuEvent: handled = TextMenuHandleEvent(e->data.menu.itemID, Sl2LnFormInput); break; default: break; } return handled; }
/* ** FinishXferMode */ void FinishXferMode(void) { KleenexType kleenex; DtbkRepeatInfoType repeat; FormType* frm = FrmGetActiveForm(); SysDBListItemType* pluglistP = NULL; Int16 current_plug = -1; UInt32 result; Boolean is_goto = false; Err err = errNone; Char cat_name[dmCategoryLength]; Char* note = NULL; UInt16 attr; /* Zero the kleenex */ MemSet(&kleenex, sizeof(KleenexType), 0); /* Bail if no plugins installed */ if (!d.xfer.pluglistH) { FrmAlert(NoPluginInstalled); return; } /* Lock the plugin list */ pluglistP = MemHandleLock(d.xfer.pluglistH); current_plug = GetCurrentXferAppListIndex(); if (current_plug == -1) { FrmAlert(NoPluginSelected); MemHandleUnlock(d.xfer.pluglistH); return; } /* Set the version */ if (pluglistP[current_plug].version & IBVERSION_PICTURE) kleenex.version = IBVERSION_PICTURE; else if (pluglistP[current_plug].version & IBVERSION_ORIG) kleenex.version = IBVERSION_ORIG; else abort(); /* Add flag notifier */ kleenex.version |= IBVERSION_FLAGS; /* Set flags */ if (d.hires) kleenex.flags = IBFLAG_HIRES; /* Set the current record index */ kleenex.sketchRecordNum = p.dbI; /* Set the pick text */ kleenex.text = GetLink(FldGetTextPtr(GetObjectPointer(frm, XferField))); if (!kleenex.text) { FlashWaitMessage(XferNoTextString); MemHandleUnlock(d.xfer.pluglistH); return; } /* Set the title text */ kleenex.title = MemHandleLock(d.record_name); /* Set the category text */ DmRecordInfo(d.dbR, p.dbI, &attr, NULL, NULL); CategoryGetName(d.dbR, attr & dmRecAttrCategoryMask, cat_name); kleenex.category = cat_name; /* Set the note */ note = MemHandleLock(d.record_note); if (StrLen(note)) kleenex.note = note; /* Set the seconds for the alarm */ if (recordIsAlarmSet) kleenex.alarm_secs = d.record.alarmSecs; /* Set the repeat information */ kleenex.repeat = &repeat; switch (d.record.repeatInfo.repeatType) { case repeatDaily: case repeatWeekly: case repeatMonthlyByDay: case repeatMonthlyByDate: case repeatYearly: repeat.repeatType = d.record.repeatInfo.repeatType - 1; /* fix offset caused by repeatHourly */ repeat.repeatFrequency = d.record.repeatInfo.repeatFrequency; repeat.repeatEndDate = d.record.repeatInfo.repeatEndDate; repeat.repeatOn = d.record.repeatInfo.repeatOn; repeat.repeatStartOfWeek = d.record.repeatInfo.repeatStartOfWeek; break; case repeatNone: case repeatHourly: default: kleenex.repeat = NULL; } /* Set the priority */ kleenex.priority = d.record.priority + 1; /* DiddleBug priority is zero-based */ /* Set the completion flag */ if ((d.xfer.complete || (xferCompleteIsAlways)) && !(xferCompleteIsNever)) kleenex.is_complete = 1; else kleenex.is_complete = 0; /* Load the sketch data */ if (kleenex.version & IBVERSION_PICTURE) { if (!d.sonyClie || !d.hires) { kleenex.data = BmpGetBits(WinGetBitmap(d.winbufM)); kleenex.data_size = BmpBitsSize(WinGetBitmap(d.winbufM)); } else { kleenex.data = BmpGetBits(WinGetBitmap(d.winbufM)); kleenex.data_size = HRBmpBitsSize(d.sonyHRRefNum, WinGetBitmap(d.winbufM)); } } /* Call the plugin */ err = SysAppLaunch(pluglistP[current_plug].cardNo, pluglistP[current_plug].dbID, 0, boogerPlugLaunchCmdBlowNose, (MemPtr)&kleenex, &result); /* Clean up some stuff */ MemHandleUnlock(d.xfer.pluglistH); MemPtrFree(kleenex.text); if (err || result) { FrmAlert(PluginError); return; } /* Just to save some typing */ is_goto = (((p.flags&PFLAGS_XFER_GOTO) || (xferGotoIsAlways)) && !(xferGotoIsNever)); if (!is_goto) FlashWaitMessage(XferSavingString); /* Clean up some more */ MemHandleUnlock(d.record_name); MemHandleUnlock(d.record_note); /* Delete the sketch if selected */ if (p.flags&PFLAGS_XFER_DELETE) DoCmdRemove(); /* Goto the new sketch if required */ if (is_goto) { /* Clean up */ MemHandleFree(d.xfer.pluglistH); d.xfer.pluglistH = NULL; /* Switch to other application */ err = SysUIAppSwitch(kleenex.booger.cardNo, kleenex.booger.dbID, kleenex.booger.cmd, kleenex.booger.cmdPBP); /* Clean up on error */ if (err && kleenex.booger.cmdPBP) MemPtrFree(kleenex.booger.cmdPBP); } else { if (kleenex.booger.cmdPBP) MemPtrFree(kleenex.booger.cmdPBP); } CancelXferMode(); }
/*********************************************************************** * * FUNCTION: RepeatGetUIValues * * DESCRIPTION: This routine gets the current repeat settings of the * ui gadgets in the repeat dialog box * * * PARAMETERS: frm - pointer to the repeat dialog * repeatP - RepeatInfoType structure (fill-in by this routine) * * RETURNED: nothing * ***********************************************************************/ void RepeatGetUIValues (FormType* frm, RepeatInfoType* repeatP) { UInt16 freq; UInt16 i; UInt16 id; UInt16 index; Char* str = NULL; /* Get the repeat type. */ index = FrmGetControlGroupSelection(frm, RepeatTypeGroup); id = FrmGetObjectId(frm, index); if (id == RepeatYearly) { repeatP->repeatType = repeatYearly; } else if (id <= RepeatWeekly) { repeatP->repeatType = (RepeatType) (id - RepeatNone); } else { index = FrmGetControlGroupSelection(frm, RepeatByGroup); id = FrmGetObjectId(frm, index); if (id == RepeatByDayPushButton) repeatP->repeatType = repeatMonthlyByDay; else repeatP->repeatType = repeatMonthlyByDate; } /* Get the repeat end date. */ repeatP->repeatEndDate = d.repeat_end_date; /* Get the repeat frequency. */ str = FldGetTextPtr(GetObjectPointer(frm, RepeatFrequenceField)); if (str) freq = StrAToI(str); else freq = 0; if (freq) repeatP->repeatFrequency = freq; else repeatP->repeatFrequency = 1; /* ** Get the start day of week. If the original repeat type, that is the ** repeat type when the dialog was first displayed, is weekly then ** use the start date in the repeat info (the unedit data), otherwise ** use the current start of week. */ if (repeatP->repeatType == repeatWeekly) { if (d.tmp_repeat.repeatType == repeatWeekly) repeatP->repeatStartOfWeek = d.tmp_repeat.repeatStartOfWeek; else repeatP->repeatStartOfWeek = PrefGetPreference(prefWeekStartDay); } else { /* For all other repeat types, the repeatStartOfWeek field is meaningless. */ repeatP->repeatStartOfWeek = 0; } /* If the repeat type is weekly, get the day of the week the event repeats on. */ if (repeatP->repeatType == repeatWeekly) { repeatP->repeatOn = 0; index = FrmGetObjectIndex(frm, RepeatDayOfWeek1PushButton); for (i = 0; i < daysInWeek ; i++) { if (FrmGetControlValue(frm, index + ((i - d.repeat_start_of_week + daysInWeek) % daysInWeek))) repeatP->repeatOn |= (1 << i); } } else if (repeatP->repeatType == repeatMonthlyByDay) { /* ** If the repeat type is monthly by day, get the day of the month (ex: ** first Friday) of the start date of the event. */ if (d.tmp_repeat.repeatType == repeatMonthlyByDay) repeatP->repeatOn = d.tmp_repeat.repeatOn; else repeatP->repeatOn = DayOfMonth (d.frm_date.month, d.frm_date.day, d.frm_date.year); } else { /* For all other repeat types, the repeatOn field is meaningless. */ repeatP->repeatOn = 0; } }
static Boolean ExamDetailsFormSave(void) { MemHandle newExam=NULL; UInt16 index = dmMaxRecordIndex; ListType *course; ControlType *course_tr, *date_tr, *time_tr; Char *room; Char empty[1]={'\0'}; FieldType *fldRoom; course = GetObjectPtr(LIST_exd_course); course_tr = GetObjectPtr(LIST_exd_course_trigger); date_tr = GetObjectPtr(SELECTOR_exd_date); time_tr = GetObjectPtr(SELECTOR_exd_time); fldRoom = GetObjectPtr(FIELD_exd_room); room = FldGetTextPtr(fldRoom); if (room == NULL) room=empty; if (gExamsLastSelRowUID == 0) { // New record newExam = DmNewRecord(DatabaseGetRefN(DB_MAIN), &index, sizeof(ExamDBRecord)); } else { // Load record DmFindRecordByID(DatabaseGetRefN(DB_MAIN), gExamsLastSelRowUID, &index); newExam = DmGetRecord(DatabaseGetRefN(DB_MAIN), index); } if (! newExam) { // Could not create entry FrmAlert(ALERT_nomem); return false; } else { UInt16 attr=0; ExamDBRecord ex, *ep; ep = (ExamDBRecord *)MemHandleLock(newExam); ex.type=TYPE_EXAM; ex.course=gExamDetailsItemIDs[LstGetSelection(course)]; ex.note = (gExamsLastSelRowUID == 0) ? 0 : ep->note; ex.date.year = gExamDetailsDate.year; ex.date.month = gExamDetailsDate.month; ex.date.day = gExamDetailsDate.day; ex.begin.hours = gExamDetailsBegin.hours; ex.begin.minutes = gExamDetailsBegin.minutes; ex.end.hours = gExamDetailsEnd.hours; ex.end.minutes = gExamDetailsEnd.minutes; ex.flags = 0x0000; StrNCopy(ex.room, room, sizeof(ex.room)); DmWrite(ep, 0, &ex, sizeof(ExamDBRecord)); MemHandleUnlock(newExam); DmReleaseRecord(DatabaseGetRef(), index, false); DmRecordInfo(DatabaseGetRef(), index, &attr, NULL, NULL); attr |= DatabaseGetCat(); DmSetRecordInfo(DatabaseGetRef(), index, &attr, NULL); DatabaseSort(); } AlarmReset(DatabaseGetRef()); return true; }
/*! * \brief the create button is pressed in the new city form */ static void cnCreateButtonPressed(void) { char *pGameName; FormPtr form; UInt8 level = 0; UInt8 width; UInt8 height; FieldPtr fp; MemHandle mh; MemPtr mp; InitGameStruct(); form = FrmGetActiveForm(); if (FrmGetControlValue(form, FrmGetObjectIndex(form, buttonID_Easy))) level = 0; if (FrmGetControlValue(form, FrmGetObjectIndex(form, buttonID_Medium))) level = 1; if (FrmGetControlValue(form, FrmGetObjectIndex(form, buttonID_Hard))) level = 2; setDifficultyLevel(level); if (FrmGetControlValue(form, FrmGetObjectIndex(form, buttonID_dis_off))) level = 0; if (FrmGetControlValue(form, FrmGetObjectIndex(form, buttonID_dis_one))) level = 1; if (FrmGetControlValue(form, FrmGetObjectIndex(form, buttonID_dis_two))) level = 2; if (FrmGetControlValue(form, FrmGetObjectIndex(form, buttonID_dis_three))) level = 3; setDisasterLevel(level); fp = (FieldPtr)GetObjectPtr(form, fieldID_width); mh = FldGetTextHandle(fp); mp = MemHandleLock(mh); width = (UInt8)StrAToI(mp); MemHandleUnlock(mh); fp = (FieldPtr)GetObjectPtr(form, fieldID_height); mh = FldGetTextHandle(fp); mp = MemHandleLock(mh); height = (UInt8)StrAToI(mp); MemHandleUnlock(mh); setMapSize(width, height); ConfigureNewGame(); pGameName = FldGetTextPtr((FieldPtr)GetObjectPtr(form, fieldID_newGameName)); if (pGameName != NULL) { MemSet(game.cityname, CITYNAMELEN, '\0'); StrNCopy((char *)game.cityname, pGameName, CITYNAMELEN); while (GameExists((char *)game.cityname)) { UInt16 slen = StrLen((char *)game.cityname); if (slen < CITYNAMELEN-1) { game.cityname[slen-1] = '0' - 1; game.cityname[slen] = '\0'; slen++; } game.cityname[slen - 1]++; } SaveGameByName((char *)game.cityname); CleanSaveGameList(); if (LoadGameByName((char *)game.cityname) != -1) { FrmEraseForm(form); form = FrmGetFormPtr(formID_files); if (form != NULL) { FrmEraseForm(form); FrmDeleteForm(form); } FrmGotoForm(formID_pocketCity); } else { UpdateSaveGameList(); } } else { game.cityname[0] = '\0'; WriteLog("No name specified\n"); } }
static Boolean URLFormDoCommand(UInt16 command) { GlobalsPtr gP = GetGlobals(); Boolean handled = false; if (!gP) return false; switch (command) { // Menus // Control Objects case kURLOpenButton: { Char *navigationText = FldGetTextPtr(GetObjectPtr(kURLField)); Boolean openInNewTab = false; if (navigationText && StrLen(navigationText)) { if (gP->navigationOpen) { MemPtrFree(gP->navigationOpen); } gP->navigationOpen = StrDup(navigationText); if (CtlGetValue(GetObjectPtr(kURLOpenInNewTabCheckbox))) { openInNewTab = true; } FrmReturnToForm(0); if (openInNewTab) { FrmUpdateForm(kMainForm, frmUpdateNewTab); } FrmUpdateForm(kMainForm, URLFormDetermineRequestType(navigationText)); } } break; case kURLCancelButton: FrmReturnToForm(0); break; // Handle inserting text using the insert buttons, or list. case kWWWPushButton: case kCOMPushButton: case kORGPushButton: case kNETPushButton: case kSlashPushButton: case kDotPushButton: case kHTMLPushButton: { FieldPtr urlFldP = GetObjectPtr(kURLField); const Char *buttonLabelP = CtlGetLabel(GetObjectPtr(command)); FldInsert(urlFldP, buttonLabelP, StrLen(buttonLabelP)); CtlSetValue(GetObjectPtr(command), 0); handled = true; } break; case kMoreTrigger: { ListPtr moreListP = GetObjectPtr(kMoreList); FieldPtr urlFldP = GetObjectPtr(kURLField); Int16 selection = LstPopupList(moreListP); if (selection >= 0) { const Char *selectionP = LstGetSelectionText(moreListP, selection); FldInsert(urlFldP, selectionP, StrLen(selectionP)); } handled = true; } break; // Default default: break; } return handled; }
/******************************************************************************** * Description: this is the function responsible for checking the * input password value of the authentication form. * ******************************************************************************/ static void checkPassword (void) { MemPtr pass1, scratch = NULL; char *input; UInt16 index = 0; MemHandle rec; mdKey in; ListType *list; // compact text and get a pointer. FldCompactText (GetObjectFromActiveForm (PasswordField)); input = FldGetTextPtr (GetObjectFromActiveForm (PasswordField)); list = GetObjectFromActiveForm (selPopupList); // if SysPass is defined, free it. this happens when Strip locks // itself after the timeout. if (SysPass) MemPtrFree (SysPass); // if its the first time the user has used the program we need // to set some things up. if (input && StrLen (input)) { // read the password from the database, decrypt with the input text. if ((rec = DmQueryRecord (PasswordDB, index))) { pass1 = MemHandleLock (rec); if ((scratch = MemPtrNew (24))) { UInt16 chk = LstGetSelection (list); //printf("%d\n", LstGetSelection(list)); switch (chk) { case 0: UnpackPassword_old (pass1, scratch, input, 1); break; case 1: UnpackPassword_old (pass1, scratch, input, 2); break; case 2: UnpackPassword_old (pass1, scratch, input, 0); break; } } MemHandleUnlock (rec); } // the message digest of the password they provided should be exactly the // same as the message digest that was just decrypted out of the password // database. Do a MemCmp to make sure they are the same. md5_string (input, in); if ((!MemCmp (in, scratch, 16)) && input) { // if so, copy the password onto the system-password if ((SysPass = MemPtrNew (StrLen (input) + 1))) StrCopy (SysPass, input); if (scratch) MemPtrFree (scratch); md_string(SysPass, NewSysPass); cryptSwitch (LstGetSelection (list)); } else { // FAILURE!!!!!! // free the memory and tell the user they entered the wrong password. FieldType *fld = GetObjectFromActiveForm (PasswordField); FrmCustomAlert (GenericError, "The password you entered is incorrect", NULL, NULL); FldSetSelection (fld, 0, FldGetTextLength (fld)); LstDrawList (list); if (scratch) { MemPtrFree (scratch); SysPass = NULL; } } } // null string is always wrong!!! else { FrmCustomAlert (GenericError, "You forgot to enter a password!!", NULL, NULL); LstDrawList (list); } }