April 18, 2024, 12:15:59 AM

News:

IonicWind Snippit Manager 2.xx Released!  Install it on a memory stick and take it with you!  With or without IWBasic!


@CONTROLID

Started by hugh, November 26, 2008, 05:40:45 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

hugh

November 26, 2008, 05:40:45 PM Last Edit: November 27, 2008, 02:57:49 PM by hugh
Hi, can anyone help me on this please,  firstly, let me explain what i am trying to achieve, i am trying to enhance my bingo program.
i have buttons numbered from (1 to 75) or (1 to 90), depending on users selection at program startup
when a player shouts line or house on a number called in my Bingo Program, i want the user of the program to be able to click on a number
as it is called back to him/her by a ticket checker, and when he/she clicks on the  number called to him/her , a wave file is played = to the button clicked.
When i have the code at the beginning of my , w1handler , and i click on a button number the wave sound is played.
BUT no other buttons will respond to a click. I have put it to the end of the w1handler and now no wave sound is playedand all the other buttons respond to a click?
The following code is what is use.


case @IDCONTROL
select @CONTROLID

IF @CONTROLID >= 1 AND @CONTROLID <= 90 THEN sayit= val(ltrim$(str$(@controlid)))
PLAYWAVE "c:\\computerised_bingo\\sounds\\"+(ltrim$(str$(sayit)))+".wav",@SNDSYNC
            ENDSELECT                 




each control has a controltext value equal to the control ID.

Regards

Hugh


Ionic Wind Support Team

You have a SELECT statement with no CASE statements, which means it won't do anything and your IF statement is never executed.

Paul.
Ionic Wind Support Team

hugh

November 27, 2008, 03:09:53 PM #2 Last Edit: November 27, 2008, 03:21:02 PM by hugh
The code below works for me perfectly, BUT, no other buttons will work.?




case @idcontrol
select @controlid
case @CONTROLID
if @CONTROLID >=1 and @CONTROLID <= number THEN   PLAYWAVE "c:\\computerised_bingo\\sounds\\"+(ltrim$(str$(@controlid)))+".wav",@SNDSYNC



but this code will not work


case @idcontrol
select @controlid
if @CONTROLID >=1 and @CONTROLID <= number THEN   sayit = val(ltrim$(str$(@CONTROLID)))
case sayit
   PLAYWAVE "c:\\computerised_bingo\\sounds\\"+(ltrim$(str$(sayit)))+".wav",@SNDSYNC



But my buttons work.
any ideas?

Hugh

Ionic Wind Support Team

You don't need the second SELECT statement at all and your code is structured very badly.

CASE @IDCONTROL
         if @CONTROLID >=1 and @CONTROLID <= number THEN   sayit = val(ltrim$(str$(@CONTROLID)))

would work if you have no other controls.  If you are using other controls then please read the users guide on SELECT statements.  For example if you have two buttons, CLOSE and PLAY along with the other buttons that say a wave you could structure it like so:

CASE @IDCONTROL
       SELECT @CONTROLID
            CASE OK_BUTTON
                 ...Do whatever the OK button does
            CASE PLAY_BUTTON
                 ...Do whatever the PLAY button does
            DEFAULT
                  if @CONTROLID >=1 and @CONTROLID <= number THEN   sayit = val(ltrim$(str$(@CONTROLID)))
       ENDSELECT
....

Read and study, read and study.

http://www.ionicwind.com/guides/emergence/language_topics_conditional_statements.htm

Paul.

Ionic Wind Support Team

hugh

Hi Paul,
Thank you for that very constructive reply
i am of to bed now, no matchsticks to keep my eyes open, trying to get my program out for xmass.
will pm you for advice as how to do it.
i have created a web site, but dont know how to PUBLISH it for FREE, for my program to be downloaded.

Regards and Happy Thanksgiving.

Hugh

hugh

When i used the above code, exactly the same thing happened, and for some unknown reason my options menu failed to function.
also the clock and timer failed to function
So i decided to mix n match, ie move things about, At the end of my w1handler, i had,
My  CASE@IDMENUPICK
My CASE @IDTIMER
at the beginning of my w1handler i have
my CASE @IDMOUSEMOVE

So i moved the @IDTIMER and @IDMENUPICK routines to the start of the w1handler

and this code i inserted as the first CASE


case @idcontrol
select @controlid:


DEFAULT
if @CONTROLID >=1 and @CONTROLID <= number AND answer$ ="yes" THEN
sayit = val(ltrim$(str$(@controlid)))
PLAYWAVE "c:\\computerised_bingo\\sounds\\"+(ltrim$(str$(sayit)))+".wav",@SNDSYNC
ENDIF


Now everything works perfectly, when a line or house is called, the user just clicks on the number that is called to him/her for checking.
when clicked that number is spoken, I have a total of 108 buttons, and each one works perfectly since i have done a bit of shuffling
I dont know if its of any interest to you paul, I dont know the reason as to why all is fine now, just by moving a few bits about and placing the above code as the first
before all the rest of the CASE#
answer$ is the string i named when the [ON] button is clicked for the user to use my voice to call the numbers, it has 2 states [ON]/[OFF] as does the Sapi

I am just over the moon that it is working now.

Regards

Hugh