Attaching DB in SQLite

Hi,

In one of my applications I use a SQLiteDatabase as a Main DB and let the user attach an other DB to the Main DB.
From the OpenDialog window he can choose the DB File to attach, in a second window he assigns an alias name for the attached DB.

I have a problem when I sandbox my application.

If NOT sandboxed, the window to assign an alias name opens immediately after closing the OpenDialog window.
If sandboxed, after closing the OpenDialog window - nothing happens! It looks like the application has freezed.
But as soon the mouse is moved, the window to assign an alias name pops up.

My Questions:
Is this normal behavior?
How can I overcome this?
Can I simulate the mouse movement with code?

I have tried to refresh the main window, to call App.doEvents - but with no success.

regards Peter

How are you calling “the window to assign an alias name”? Is it your app.DefaultWindow? Are you doing Window.Show at some place in your code? Which window IS your app.DefaultWindow?

Ooo, ouch. Don’t do that!

The window to assign an alias name is of type ‘Sheet Window’. In a method ‘ShowWindow’ I do some initialization of variables and
call then ‘self.ShowModal’ to open the window.

It is opend within the application ‘main window’.

Are you calling this “showwindow” method from the open event of your main window? If so, maybe try setting a short period timer in your main window to call the method and its .showmodal method after the open event has completed.

What I have found out now, it is the OpenDialog window which behaves strange.

Sandboxed:

  • If I open the OpenDialog as Sheetwindow with ‘dlg.ShowModalWithin(…)’ the application seems to freeze after opening a file.
    I have to move the mouse cursor to unfreeze.
  • If I open the OpenDialog with ‘dlg.ShowModal’, everthing is ok.

not Sandboxed:

  • opening the OpenDialog in either way works normal.

Is this a bug or normal behavior?

Please show the code you are using to open both of the windows in question.

This is the code to open the OpenDialog window to select the DBFile to attach:

  • this code causes the application to freeze after selecting a file (Sandboxed)

    Dim f As FolderItem
    Dim dlg As new OpenDialog
    dlg.InitialDirectory = SpecialFolder.Desktop
    dlg.Title = App.ApplicationName
    dlg.PromptText = “Choose SQLite Database”
    // open file, if user pressed Cancel return Nil
    f =dlg.ShowModalWithin(wndMain)
    if (f = Nil) then return Nil
    // all ok, return File
    return f

if I use f =dlg.ShowModal all is ok (Sandboxed)

The window to assign an alias name to the attached DB is opend with following code:
(the parameter ‘db’ is the DB to attach)

if (db = Nil) then return
// initialize local variables
m_ExitButton = gBUTTON_Cancel
// show sheet window
lblHeader.Text = Replace(lblHeader.Text, “@d”, db.DatabaseFile.DisplayName)
self.ShowModal

Again, it looks like if sandboxed and I open the OpenDialog window as SheetWindow it freeze until I move the mouse cursor.

Is it not possible to just use this instead and avoid the problem?
My guess is there’s some confusion by the system when you open two modal windows in succession. If you don’t need to specify a single window as the parent, then it seems all is well.

Roger, thank you.

That’s my conclusion as well, avoid opening OpenDialog window as SheetWindow. (when Sandboxing)
I have changed my program accordingly.