|
Post by jarychk on Aug 8, 2022 17:49:22 GMT
This idea has come up somewhere. Another way to make something LIKE the NOTICE box. This uses more code than simply NOTICE...
gosub [msgstring]
nomainwin
WindowWidth = 550 WindowHeight = 345
statictext #main.statictext1, msg$, 30, 46, 480, 185 button #main.button2, "OK", [button2Click], UL, 214, 256, 122, 25 open "Try like NOTICE" for dialog_modal as #main print #main, "trapclose [quit.main]"
print #main, "font ms_sans_serif 10" playwave "beep" wait
[quit.main] Close #main END
[button2Click] 'Perform action for the button named 'button2' 'Insert your own code here close #main wait
[msgstring] msg$="Static Text information for something to try as if a substitution for Notice Box." _ +chr$(13)+"Display some message for the user, ensure that user must see and have the" _ +chr$(13)+" chance to read and think, and only then, user would close the dialog and continue with the rest of the program." _ +chr$(13)+"**********************************************************************************************" return
Something strange I find is that the OK button will not appear until AFTER the system sound (ding or beep or whatever) has played.
|
|
|
Post by tsh73 on Aug 8, 2022 20:11:08 GMT
Interesting. Actually as posted, it plays error sound because it can not find "beep" file. But even if I put full path to existing sound file - and I hear this file - button do not appear until after sound.
I kind of circumvented it with
timer 1, [beep] wait [beep] timer 0 playwave "beep" wait
As a side note, there is a
function CustomNotice$(title$, message$, buttons$) in JB FreeForm, menu Output | Add Custom Function.
|
|
|
Post by jarychk on Aug 8, 2022 21:33:21 GMT
All that makes me very curious. If PLAYWAVE "beep" is making the code play the error-sound, where does JB automatically know where to look; into which file directory path in Windows, the find whatever "beep" or other is to be played? One could certainly make some use of this information.
|
|
|
Post by jarychk on Aug 8, 2022 22:03:47 GMT
A brief web search and looking through a file path directory, and some code-development steps, this shows how to find what is what about some WAV files.
'ShallWePlayAWav.bas Aug. 8, 2022
[looping]
input "Shall we play a WAV ? ";answer$
if left$(answer$,1)="y" or left$(answer$,1)="Y" then filedialog "open a file (WAV) to be played.","C:\Windows\Media\*.wav",sound$ else end end if
IF sound$="" then END
playwave sound$
goto [looping]
END
|
|
|
Post by Rod on Aug 9, 2022 5:47:01 GMT
How about adding the optional ,async flag. Do we still have the same delay?
Yes async solves the problem
playwave "beep",async
|
|