OK,
This is getting closer, but a couple of issues remain.
I have my sub procedure that is called by the OnDocumentOpen broadcast
event. Using the suggested technique of
reading the last frame's title from the ActiveDesktop frames container
does indeed work.
However, as I put up before, the problem is that the procedure is called
twice. I am trying to find some way
to ignore the first call and act upon the second call.
So far I have tried two things. Using a static variable in the
procedure, and using a global variable in the library.
3 actually as just moving the variable out of the procedure did not work.
Here is the procedure now.
const cBaseTitle = " - OpenOffice.org Base"
'dim isInOnOpenAgain as boolean
global isInOnOpenAgain as boolean
sub onOpenDocumentMain
dim df as variant
dim DBName as string
dim HideDBFrame as boolean
'static isInOnOpenAgain as boolean
df = Stardesktop.Frames
If RIGHT((df(df.count-1).title), LEN(cBaseTitle)) = cBaseTitle Then
if isInOnOpenAgain then
dbName = LEFT((df(df.count-1).title), LEN(df(df.count-1).title)
- LEN(cBaseTitle))
isInOnOpenAgain = False
HideDBFrame = OpenDefaultForm( dbName )
'if HideDBFrame make it hidden somehow
else
isInOnOpenAgain = True
endif
End if
end sub
So - here is the problem and an oddity. If I have this library open in
the Basic editor when a base form is opened it works
as expected. The call to OpenDefaultForm happens just once. If it is not
open in the editor it fails and calls the function
twice. Any ideas on how to make the test variable isInOnOpenAgain act
like a static variable?
The oddity. While testing this libraries routines I happened to use drag
and frop to move an embedded form from one Base file to another.
Guess what happens. The onOpenDocumentMain procedure is called AND with
the library NOT in the editor it is
called only once??? For those that are interested, the dbName variable
is set to the target frame's Base name.
Anyway, I am approaching the point of thinking that perhaps this is too
much to ask of Starbasic? Also, that little oddity is gonna
be a prblem. But that can wait to be solved until after this is.
Thanks in advance
Drew
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]