Can someone please remove my name from this message service? My e-mail
address is:[EMAIL PROTECTED]
-----Original Message-----
From: Scott Johnson [mailto:[EMAIL PROTECTED]]
Sent: Sunday, September 12, 1999 1:30 AM
To: [EMAIL PROTECTED]
Subject: Re: how to tell when Preferences are running?
Richard Bram wrote:
> Not sure what's going on, but somehow if I call LstGetSelectionText
> just after LstPopupList returns, I either get a warning about
> reading from low memory, or else I get a bus error.
Do you first verify that the list even _has_ any text before calling
LstGetSelectionText? If it's the kind of list that uses a draw
callback function and leaves the text pointer null (or stuffs some
cookie value in there) then LstGetSelectionText will crash.
Basically for a custom drawn list like that, there is no way for your
hack to retrieve item text, since the program that owns the list
supplies the text in a proprietary way at draw time. (One could even
draw pictures in the list instead of text.)
> Is there something strange about the Preference app
> that might make List functions "funny"?
You didn't say which list(s) crashes your hack, but the source code to
the Formats panel (in SDK) shows that the popup in the upper right
corner indeed uses the callback/null-text approach. All the other
system Prefs panels probably do the same thing.
> Well, to just avoid the whole situation, I'd like to be able
> to know if the user is running the Preferences app.
This probably won't help, if the above theory is correct, since
callback lists are common. (My app uses them heavily.)
> But I see that SysCurAppDatabase is different depending upon which
> module is active, so there is no easy test to know when Prefs is
> running. Is there any other way for a hack to know when the Prefs
> app is active?
The "current" app is different for each "module" because each module
is in fact a separate application. It's a head-slappingly simple
plugin architecture: a Prefs panel is basically just a regular app but
with DB type of 'panl' instead of 'appl'. They switch among
themselves when you choose from the list in the corner. The actual
Prefs app you tap on in the Launcher, is a bootstrap to immediately
switch to the right actual 'panl' application.
So you can tell if a Prefs panel is up by checking if the current app
database type is 'panl' instead of 'appl'. (Actually you should use
symbol sysFileTPanel instead of 'panl' for sharper code.)
-slj-