Starting items

Post Reply
User avatar
cogier
Site Admin
Posts: 89
Joined: Wednesday 21st September 2016 2:22pm
Location: Guernsey, Channel Islands

Starting items

Post by cogier » Thursday 09th March 2017 4:56pm

Is there a way to get something to start AFTER the Form has been displayed other than using a Timer.

Example: - I want to display a Form then play a tune. If I put it in Public Sub Form_Open() it will not show the Form until the tune has played.

User avatar
jornmo
Site Admin
Posts: 112
Joined: Wednesday 21st September 2016 1:19pm
Location: Norway

Re: Starting items

Post by jornmo » Thursday 09th March 2017 7:43pm

Try adding Wait before the play.
If Delay is not specified, the function processes all pending events and returns immediately. In that specific case, input events (keyboard and mouse) are ignored.

User avatar
cogier
Site Admin
Posts: 89
Joined: Wednesday 21st September 2016 2:22pm
Location: Guernsey, Channel Islands

Re: Starting items

Post by cogier » Thursday 09th March 2017 10:01pm

Ahh. So simple, why didn't I think of that? BUT it doesn't work!!

The attached uses a Timer to get the result I am looking for. Simply change 'bWait As Boolean = True' to
'bWait As Boolean = False' to see that it doesn't react as expected.

Please note the software is in the VERY early stages of development..
piano.tar
(7.47 MiB) Downloaded 14 times

didier18
Posts: 15
Joined: Monday 19th December 2016 10:08pm

Re: Starting items

Post by didier18 » Thursday 09th March 2017 11:18pm

Hello

Can be put the code in:
Public Sub Form_Arrange ()
or in :
Public Sub Form_Show ()

Have a good day

User avatar
jornmo
Site Admin
Posts: 112
Joined: Wednesday 21st September 2016 1:19pm
Location: Norway

Re: Starting items

Post by jornmo » Friday 10th March 2017 2:06pm

I've tried did's solution.

This works:

Code: Select all

Public Sub Form_Show()
  
  playStuff("4C2,3C2,2C2,1E2,1D2,1C8,\n")                       'Send Intro string of notes to playStuff
  
End
However, the Arrange event is not good for this.

User avatar
jornmo
Site Admin
Posts: 112
Joined: Wednesday 21st September 2016 1:19pm
Location: Norway

Re: Starting items

Post by jornmo » Friday 10th March 2017 2:09pm

Btw., '28.wav' is missing :?

User avatar
cogier
Site Admin
Posts: 89
Joined: Wednesday 21st September 2016 2:22pm
Location: Guernsey, Channel Islands

Re: Starting items

Post by cogier » Friday 10th March 2017 4:45pm

Well done Didier that did the trick, I used Form_Show()

The missing note has been recaptured!

User avatar
cogier
Site Admin
Posts: 89
Joined: Wednesday 21st September 2016 2:22pm
Location: Guernsey, Channel Islands

Re: Starting items

Post by cogier » Sunday 12th March 2017 4:11pm

UPDATE:

Form_Show() only shows the form immediately with gb.gui
Form_Arrange() does not show the form until the the routine has finished
Form_Open() does not show the form until the the routine has finished
Form_Active() shows the form immediately with gb.gui and gb.qt4

You need one Label on a form for this to work

Public Sub Form_Activate()
Dim siCount As Short
Dim siNotes As Short[] = [1, 2, 3, 4, 5, 6, 7, 8, 9, 0]

For siCount = 0 To siNotes.Max
  Label1.text &= siNotes[siCount] & " "
  Wait 0.25
Next

User avatar
jornmo
Site Admin
Posts: 112
Joined: Wednesday 21st September 2016 1:19pm
Location: Norway

Re: Starting items

Post by jornmo » Sunday 12th March 2017 4:14pm

Oooohh! I like the colours :lol:

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest