Basic4ppc - Windows Mobile Development  

Go Back   Basic4ppc - Windows Mobile Development > Main Category > Questions & Help Needed
Home Register FAQ Members List Search Today's Posts Mark Forums Read

Questions & Help Needed Post any question regarding Basic4ppc.


Bad screen refresh with sound command


Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 05-09-2008, 06:28 PM
pmu5757's Avatar
Knows the basics
 
Join Date: Sep 2007
Location: Metz (France)
Posts: 53
Default Bad screen refresh with sound command

Hello,
When I use the "sound" command in my program, I've got problems with different controls on the form : all controlls should appear before the sound command runs and only some of them do that; the others appear after the sound command ends.

Here is the part of the code concerned.

Could anybody help me ?

Thank You

Pascal - France.

Code:
Sub App_Start
.......
If CBOptionsVocal.Checked Then
		Sleep (1000)
		Dire (Nb1)
		Select Operation
            Case "+"
                Sound (".\sons\" & CbOptionsLangue.Item(CbOptionsLangue.SelectedIndex) & "_" & "plus.wav")
            Case "-"
                Sound (".\sons\" & CbOptionsLangue.Item(CbOptionsLangue.SelectedIndex) & "_" & "moins.wav")
            Case "x"
                Sound (".\sons\" & CbOptionsLangue.Item(CbOptionsLangue.SelectedIndex) & "_" & "fois.wav")
            Case ":"
                Sound (".\sons\" & CbOptionsLangue.Item(CbOptionsLangue.SelectedIndex) & "_" & "divise.wav")
		End Select
		Sleep (1200)
		Dire (Nb2)
	End If
....
End Sub

Sub Dire (temp)
	Sound (".\sons\" & CbOptionsLangue.Item(CbOptionsLangue.SelectedIndex) & "_" & temp & ".wav")
	Sleep (1200)
End Sub
Reply With Quote
  #2 (permalink)  
Old 05-09-2008, 06:49 PM
agraham's Avatar
Basic4ppc Expert
 
Join Date: Jul 2007
Location: Cheshire, UK
Posts: 1,896
Awards Showcase
Beta Tester Forum Contributer 
Total Awards: 2
Default

Try a DoEvents just before playing the sound. Hopefully this will let the controls be drawn.
Reply With Quote
  #3 (permalink)  
Old 05-09-2008, 07:13 PM
pmu5757's Avatar
Knows the basics
 
Join Date: Sep 2007
Location: Metz (France)
Posts: 53
Default Bad screen refresh with sound command

Sorry Agraham, but it doesn't work better...

Here is my new code with your idea...

Code:
	If CBOptionsVocal.Checked Then
		Sleep (1000)
		Dire (Nb1)
		Select Operation
            Case "+"
				DoEvents 
                Sound (".\sons\" & CbOptionsLangue.Item(CbOptionsLangue.SelectedIndex) & "_" & "plus.wav")
            Case "-"
				DoEvents 
                Sound (".\sons\" & CbOptionsLangue.Item(CbOptionsLangue.SelectedIndex) & "_" & "moins.wav")
            Case "x"
				DoEvents 
                Sound (".\sons\" & CbOptionsLangue.Item(CbOptionsLangue.SelectedIndex) & "_" & "fois.wav")
            Case ":"
				DoEvents 
                Sound (".\sons\" & CbOptionsLangue.Item(CbOptionsLangue.SelectedIndex) & "_" & "divise.wav")
		End Select
		Sleep (1200)
		Dire (Nb2)
	End If
End Sub

Sub Dire (temp)
	DoEvents 
	Sound (".\sons\" & CbOptionsLangue.Item(CbOptionsLangue.SelectedIndex) & "_" & temp & ".wav")
	Sleep (1200)
End Sub
__________________
Pascal
Reply With Quote
  #4 (permalink)  
Old 05-09-2008, 07:30 PM
agraham's Avatar
Basic4ppc Expert
 
Join Date: Jul 2007
Location: Cheshire, UK
Posts: 1,896
Awards Showcase
Beta Tester Forum Contributer 
Total Awards: 2
Default

Quote:
Originally Posted by pmu5757 View Post
Sorry Agraham, but it doesn't work better...
Strange! I would have expected that to draw all the outstanding controls. Can you post a bit of code that shows the effect and are we talking about the device or desktop or both? Is this in the IDE and/or compiled with either compiler?
Reply With Quote
  #5 (permalink)  
Old 05-09-2008, 08:30 PM
pmu5757's Avatar
Knows the basics
 
Join Date: Sep 2007
Location: Metz (France)
Posts: 53
Default Bad screen refresh with sound command

My application is for desktop.
Here is a version without the "doevent" : Operations for children

You'll find the whole source code (an old one but still with the problem), and a link to download the whole application (with the sound files)

Before launching questions in the main form, you must check "vocal" in the options form.

Thank you.

Pascal.
__________________
Pascal
Reply With Quote
  #6 (permalink)  
Old 05-09-2008, 08:49 PM
Cableguy's Avatar
Basic4ppc Expert
 
Join Date: Apr 2007
Location: N 41º11'30.30" W 8º39'46.60"
Posts: 1,463
Awards Showcase
Forum Contributer 
Total Awards: 1
Default

As almost every single command, the DoEvents is very usefull when placed in the correct place...
Here's my altered code, working very fast, and a bit more smooth in the "talking", at least, for my taste...
Attached Files
File Type: sbp op.sbp (10.4 KB, 6 views)
__________________
Paulo Gomes
Porto, Portugal

PC: Dual-Core 1,8Ghz, 2GB RAM, 80GB HD
PPC: Qtek9000, 1GB SD

DLL Version Listing
Reply With Quote
  #7 (permalink)  
Old 05-09-2008, 09:53 PM
pmu5757's Avatar
Knows the basics
 
Join Date: Sep 2007
Location: Metz (France)
Posts: 53
Default

You are wright Cableguy : only one "doevents" is necessary, and before the first "sound" command.
I didn't apply very well Agraham's advice.
It works now.
Thank you both for your help.
__________________
Pascal
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Shell command J12345T Questions & Help Needed 2 06-08-2008 10:49 AM
Help on Sqlite Update Command jeterry Questions & Help Needed 13 03-31-2008 09:45 AM
Command to create a database in sqlite mozaharul Questions & Help Needed 5 03-30-2008 04:38 AM
Draw and Refresh faster hung Questions & Help Needed 3 08-01-2007 02:00 PM
No refresh on device rosmalen Bug Reports 5 06-16-2007 10:10 PM


All times are GMT. The time now is 02:20 PM.


Powered by vBulletin® Version 3.6.12
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.1.0