On Wed, 1 Dec 1999, Robert Foster wrote:
> If an app hasn't been run, then it is very likely that the prefs haven't
> been initialised yet. Specifically, When MemoPad is run for the first time,
> it will initialise the prefs, and therefore prefs.currentCategory. (I'm only
> guessing here, I haven't looked at the source code yet)
That's kind of what I thought.
> Therefore, if it hasn't been run, then prefs.currentCategory hasn't been
> initialised, giving you your problem.
>
> Maybe you should check to see whether the prefs have been initialised or
> not:
>
> prefsVersion = PrefGetAppPreferences(sysFileCMemo, 0, &prefs,
> &prefsSize, TRUE);
> if (prefsVersion == noPreferenceFound)
> // Then there won't be a valid prefs.currentCategory!
This will probably work. I was thinking of testing the specific
value of prefs.currentCategory but did not know how to check for
valid category but this is a better way.
> Hope this helps.
>
> Robert Foster
> Mountain Visions P/L
> [EMAIL PROTECTED]
>
> -----Original Message-----
> From: Mike Davis [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, 30 November 1999 13:47
> To: [EMAIL PROTECTED]
> Subject: POSE Error: Bad Category - ???
>
>
> I have a form that displays a Catetory Popup Trigger and my
> app initialized the display to MemoPad's current category. But
> it appears that there is some problem with the category, initially,
> until I go into MemoPad, once.
>
> I am consistently getting this error, in POSE:
>
> "Category.c, Line:462, Bad Category". This error goes away
> after I go into MemoPad, once, after the error. The error
> will repeat every time I start the app, until I go into MemoPad.
> Then I don't see the error again.
>
> Here is the code to setup the initial label for my Category Popup
> Trigger.
>
> void GetMemoDBPrefs(void) {
> MemoPreferenceType prefs;
> Word prefsSize;
> Int prefsVersion;
>
> prefsSize = sizeof(MemoPreferenceType);
> prefsVersion = PrefGetAppPreferences(sysFileCMemo, 0, &prefs,
> &prefsSize, TRUE);
> CurrentCategory = prefs.currentCategory;
> CategoryGetName(ImportDB, CurrentCategory, CategoryName);
> CategorySetTriggerLabel(GetObjectPtr(trgCategory), CategoryName);
> }
>
> I think what is happening is that CategorySetTrigger is trying to set
> an invalid category. So, when I go into MemoPad the first time, the
> value is set correctly. Just a guess.
>
> But if I am right, what is the initial value of category? And how
> do I prevent this initial error?
>
> Any idea what could be causing this?
> --
> -----------------------------------------------------------------
> Discussion Group: http://www.halcyon.com/ipscone/wwwboard/
>
> Protect your constitutional rights. Your favorite one may be next!
> -----------------------------------------------------------------
>
>
>
----------------------------------------------------
Shoot-to-Win
Protect the 2nd Amendment
----------------------------------------------------