-
Do events,,Sleep
I have an sql app that queries an Access database through ODBC. Each record
contains a GIF that I want to display one after the other (using repaint).
The program loops through each record in the database but loops so fast
I only the last GIF is displayed.I tried Thread.Sleep() but it puts the entire
app to sleep. Is there anyway to achieve a Do Events type statement that
is available in VB?
thanks in advance
-
Re: Do events,,Sleep
Lookup Thread.yeild() in the API reference.
"kevin" <krg9263@aol.com> wrote:
>
>I have an sql app that queries an Access database through ODBC. Each record
>contains a GIF that I want to display one after the other (using repaint).
>The program loops through each record in the database but loops so fast
>I only the last GIF is displayed.I tried Thread.Sleep() but it puts the
entire
>app to sleep. Is there anyway to achieve a Do Events type statement that
>is available in VB?
>
>thanks in advance
-
Re: Do events,,Sleep
Solution is simple !
Just check for paint status.
using this u can check the status. If status is not set ,
means not completly painted, just revolve the loop
but don't give increment to the database pointer.
If status is set then make increment.
-Ashish
"kevin" <krg9263@aol.com> wrote:
>
>I have an sql app that queries an Access database through ODBC. Each record
>contains a GIF that I want to display one after the other (using repaint).
>The program loops through each record in the database but loops so fast
>I only the last GIF is displayed.I tried Thread.Sleep() but it puts the
entire
>app to sleep. Is there anyway to achieve a Do Events type statement that
>is available in VB?
>
>thanks in advance
-
Re: Do events,,Sleep
I guess you will need to force an immediate paint. Repaint will just post a
new event into the event queue. I have worked on an equal problem, but can
not remember exectly how I solved it. A possibility would be to call the
paint(Graphics g) method yourself, but then you will need to find out the
legal Graphics parameter, or maybe it works with the repaint method with 0ms
as parameter for the max delay. I guess the graphics parameter can be
created with the getGraphics method. However, the repaints will happen, but
it will still happen to fast (and end up with the last picture within a
fraction of a second).
with Thread.sleep(), you will put the current thread into a sleap, and this
is including the repaint of your images (i think).
I think for looping through your pictures, it would be nicer to have it as
some kind of a time-event. This should be possible, timing will not be 100%
perfect, but it will do what you want. Then you only need to do a simple
repaint() in order to update the image. you can use swings Timer class for
that: http://java.sun.com/j2se/1.3/docs/ap...ing/Timer.html
"kevin" <krg9263@aol.com> wrote in message news:3990c025$1@news.devx.com...
>
> I have an sql app that queries an Access database through ODBC. Each
record
> contains a GIF that I want to display one after the other (using repaint).
> The program loops through each record in the database but loops so fast
> I only the last GIF is displayed.I tried Thread.Sleep() but it puts the
entire
> app to sleep. Is there anyway to achieve a Do Events type statement that
> is available in VB?
>
> thanks in advance
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
Forum Rules
|
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL
|
Bookmarks