realbasic-nug
[Top] [All Lists]

Re: problem with KeyDown event and Valentina

To: REALbasic NUG <realbasic-nug at lists dot realsoftware dot com>
Subject: Re: problem with KeyDown event and Valentina
From: johnf <jfabiani at yolo dot com>
Date: Fri, 30 Dec 2005 18:45:23 -0800
Delivered-to: realbasic-nug at lists dot realsoftware dot com
References: <de7f5fea2ddae9af2294d5db249cded5 at declareSub dot com>
On Friday 30 December 2005 16:11, Charles Yeomans wrote:
> I'm seeing a curious problem in the interaction of a KeyDown event
> handler and Valentina.  I have an EditField that holds a date.  When
> the date is changed, I retrieve some data from the database and load it
> into a Listbox.  The + and - minus keys increment and decrement the
> date, and so trigger the database search.
>
> The immediate problem is that when I type several + or - quickly, my
> application crashes silently.  Vigorous logging shows that a call is
> made to Valentina's SQLSelect function before the previous one has
> returned, which I suspect is causing Valentina to crash.  This happens
> because the EditField.KeyDown event handler is being called in response
> to a key press before the previous KeyDown event handler has exited;
> the log data suggests that REALbasic is calling the next KeyDown while
> Valentina is in the middle of its SQLSelect call.
>
> I wonder how this can happen.  I guess that somehow a cycle of the
> event loop is occurring while Valentina is executing an SQLSelect ot
> something; I am most perplexed.  This only occurs when connecting to a
> remote database; I don't know if Valentina is just so much faster
> locally that no timing problem occurs, or if there is something more
> fundamentally different.
>
> --------------
> Charles Yeomans

I was having the same issue with Postgres (but I did not crash).  I think the 
idea of non-blocking/asynchronous sql requests is very difficult to get my 
head around.  In my case I was waiting for a SQL statement to tell me if data 
was returned or not.  So I could call my lookup routines.  But I could not 
figure out a reliable way of waiting for the sql request to finish before 
going onto the next code statement.  Even adding a loop with a timer did not 
work.  Others on this list suggested that I checkout the obsever patterns. 

We really need a way to make synchronous SQL calls.  If you figure out a way 
to insure that a SQL statement finishs before executing the next code 
statement please post it.

BTW I think it is a speed issue.

John
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>


<Prev in Thread] Current Thread [Next in Thread>