modaless window stopping other windows

Hi all.

I had a thought of running an sql query in a window that was modaless, so as not to stop the app on other windows.
window1 - textbox, you type a character, it calls a method on window2 (which is set for modaless dialog and visible = false) called search
window2’s search method runs the sql query based on the text in window1

I thought, once the method is called (because it is modaless) window1 would continue to accept characters entered on the textbox.
But it pauses entry until the sql query has completed. just as if i called the method on its own window.

any ideas? or am i confusing what a modaless window does?

(also posing this on database channel)

I believe maybe so.
In order to keep your UI responsive during the search, you will need to put the search in a thread. No need to have the 2nd window. It is threads which process code, not the windows themselves.

Window <> Thread (in Xojo). The 2 windows will compete for resources. There is one UI thread for your entire app. Any code running in that main thread will block any other code on that same main thread. Put your code in a thread on Window1 and dump Window2.

Thanks guys, sounded like just what i needed.
I read the docs on threading and watched paul’s webinar and it all sounded so good.
Just tried it and it does not work!
the sql query still delays key entry until the query is returned. I have placed the query inside the thread.
Im not even doing anything with the result. Just this:

If thread1.state <> 4 then
end if
Dim sql
sql = “SELECT ID, LastName, FirstName, Suburb, Postcode FROM Customer”
Dim rs as RecordSet
rs = mydatabase.sqlSelect( sql )

oops, i also have a where clause at the end of that sql query to reduce the amount of results returned.
And the database only has 2 rows in it (just for testing) over the internet, it delays about 1 second between keystrokes.

Where is your DB located? What do you mean by “just for testing over the Internet”?
Are you just returning the recordset, or is your thread doing something else as well?
There should be no noticeable delay at all.

my database is just a free dev one from heroku
just returning the recordset (for testing) nothing else
Here is my test app project.
It has the database settings hardcoded.


Your download needed to be zipped. Can’t view it in this state.
The code that you show as being in your thread should not require a separate thread. I do this many times within my app and there is no slow down doing it in the main thread.
You didn’t answer my most important question: Where is your DB located? I suspect your slowdown is in trying to access that DB.


The database is located on the internet at
Where their servers are? I’m not sure? Im in Australia and I know they are not here.

most certainly the big slowdown is the database, i changed it to a mysqlserver DB hosted by a different site and it is a lot quicker, but the issue is persistent.


You don’t need a thread. The slowdown is in connecting to the DB over the Internet. Have you successfully done this? I know nothing about how one makes this connection.

@Roger Clary I know the lag is from accessing the db over the internet. Thats why i thought if i put the connection into a thread, my main UI could continue to operate smoothly while the thread waits for the connection, then once it has the results, they can be displayed.
A user might be able to type 2 or three characters before the query completes.
And yes, connecting to a db over the net is the same as connecting locally, except you put the host name in instead of localhost.

I’m still confused. I always thought you couldn’t do that. I see that Paul is having 2 webinars showing how to set up a web app to talk to a DB and then have a desktop app talk to the web app. What is the point of all that if you can just connect directly to an online DB?

You can, but it’s a huge security risk. So most people treat it like it can’t be done.