[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Reopening resource files calls CurResFile!?



I believe that OpenResFile making that file current is a well known bug :-)
I don't know if it's considered an OS bug or an IM bug. I believe the
resource manager operates this way in all the systems (so it aint a 7.0 bug)

Here is what I believe is going on.  My little arrow diargrams shows the
linked list of open res files. The caret marks the current res file .
(I hope you view this in a mono space font)

initially

->MCL->system
  ^

then you open A

->A->MCL->system
  ^

then you open B

->B->A->MCL->system
  ^

then you re-open A

->B->A->MCL->system
     ^
Note: now you can't find any resources in B


then you open a Fred Window

->FredW->B->A->MCL->system
  ^
Note: Now you can see the resources in B again

I believe this correctly explains all the behavior you mentioned. You
didn't do a final cur res file after opening that Fred window, but I'll
bet it is some new id (not A's).

I don't know if this is documented anywhere. I think I did a set of
experiments to find this all out.

In oodles-of-utils I define a macro called with-res-file that handles
all this so you don't get into trouble.  It alway restores the current
res file on exit.

In addition, it has options to create a rsrc file if the one you
specified doesn't exist (or doesn't have a rsrc fork), it also has an
options to leave or not leave the specified rsrc file open depending on
if it was already open.

-ME