🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: comp.sys.next.programmer
2 messages
2 total messages Started by Mike Matthews Sat, 05 Sep 1992 16:51
Defaults Database management
#769
Author: Mike Matthews
Date: Sat, 05 Sep 1992 16:51
31 lines
1684 bytes
I've looked through the Next Developer files in Librarian and have read the
section on defaults, but I must be extremely dense because I still can't
figure this one out.

How can I flush the registration table of defaults to the .NeXTdefaults
database?  NXWriteDefaultsVector() takes what's in your vector and dumps it
to the database and puts the new values into the registration table.

I tried changing the vector information (a la strcpy) but that gave an
"invalid operands to binary +" error on compile so there's something going on
behind the scenes that I don't grok too well.

All the update & write calls seem to go from database to registration table.
I want to go the other way!  I've NXSetDefault'd just fine;
NXGetDefaultValue calls show the new value.

I don't want to call NXWriteDefault because I want to have a 'revert to
saved' button (i.e. I don't want to commit changes until the user says so).

It's gotta be simple.

Doesn't it?

Any help greatly appreciated.  [for the curious, I'm putting a Preferences
panel in Missile Command since the #define's were a bit unplayable for my
tastes... all that's not working - far as I can tell - is saving the damn
defaults!!!]
------
Mike Matthews, matthews@oberon.umd.edu (NeXTmail accepted)
------
The earth is like a tiny grain of sand, only much, much heavier.
Re: Defaults Database management
#812
Author: Brad Nelson
Date: Mon, 07 Sep 1992 15:44
55 lines
2791 bytes
In article <15314@umd5.umd.edu> matthews@oberon.umd.edu (Mike Matthews)  
writes:
>I've looked through the Next Developer files in Librarian 
>and have read the section on defaults, but I must be 
>extremely dense because I still can't figure this one out. 

That makes two of us.

>How can I flush the registration table of defaults to the 
>.NeXTdefaults database? NXWriteDefaultsVector() takes 
>what's in your vector and dumps it to the database and 
>puts the new values into the registration table. 
>
>I tried changing the vector information (a la strcpy) but 
>that gave an "invalid operands to binary +" error on 
>compile so there's something going on behind the scenes 
>that I don't grok too well. 

I think that's because the vector is static - it's supposed
to be the "default defaults".

[munch]

>It's gotta be simple. 
>
>Doesn't it? 

I must be dense too, I couldn't figure out a simple way to do
that.  The thing that confused me was that I assumed that
NXWriteDefaults() was simply a batched version of NXWriteDefault().
Bzzzt!  The two functions don't do the same thing at all.  I can't
imagine why NXWriteDefaults() even exists, given the way it works.
(It writes the vector to disk, not the table)

The values in your NXDefaultsVector will always be available to your
program as soon as you NXRegisterDefaults(), so why would you ever
want to write the _vector_ to the defaults database?  Wouldn't it
make more sense to have NXWriteDefaults() write the _table_ to the
database rather than the vector?  Or, better yet, NXWriteDefaults()
could go through the table and write only the values that are 
different from the ones in the vector.

I guess the thing that confused me was that the docs say "To 
maximize efficiency, you should use one call to NXWriteDefaults() 
rather than several calls to NXWriteDefault() to write multiple values." 
Sure, sure.  You use NXSetDefault() to update a value in the table,
then you call NXWriteDefaults() to write the vector to the database
and re-register, which overwrites the value you just NXSetDefault()ed
with the one in the vector.  

Can anyone explain why this stuff works the way it does?  Is there
an easy way to write the defaults in the _table_ out to the 
database, rather than NXWriteDefault()-ing them individually?

-Brad        brad%raven@kakwa.ucs.ualberta.ca
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads