[19 Jan 2010] Query about Events

Contains all messages from the Hollywood mailing list between 01/2006 and 08/2012
Locked
Dwayne

[19 Jan 2010] Query about Events

Post by Dwayne »

Note: This is an archived post that was originally sent to the Hollywood mailing list on Tue, 19 Jan 2010 13:43:28 +1100

Hi,

I have been working my media centre project (the one I uploaded to the Hollywood Website) and have encountered a problem that I would like some clarification on.

Essentially what is happening is I am running a function called main menu and in this function are several events that check for key presses. left and right to move through the menus, esc to quit and enter to select the menu option.

When enter is checked for it determines which option is selected from a table and enters function that is referenced by that menu option i.e.

Code: Select all

menuoptions={[1]=tvshowsMenu} ; this is the table with references to the functions
menuoptions[msg.userdata.menuid] () ; this calls the function based on the menuid that is current when entered is pushed in the event check function
so in the tvshowsMenu I setup the display, create new events relating to this screen bu twhen I enter the repeat waitevent () forever loop I get an error. (wrong usage/parameters for this command! Read the Documentation! which is referring to the WaitEvent () call.

Is this not working because I have called the new function from another function which had events and I need to re-initialise the events??

Any help would be appreciated as I am at somewhat of an impasse. I feel it is probably a design issue but I need to know what the design limits are in order for me to rectify it.

If it helps for me to list the function names and to indicate where one exists and another starts as well as where the installeventhandler function is being called let me know.

Regards,

Dwayne

-- Using Opera's revolutionary e-mail client: http://www.opera.com/mail/
User avatar
airsoftsoftwair
Posts: 5830
Joined: Fri Feb 12, 2010 2:33 pm
Location: Germany
Contact:

[20 Jan 2010] Re: Query about Events

Post by airsoftsoftwair »

Note: This is an archived post that was originally sent to the Hollywood mailing list on Wed, 20 Jan 2010 17:34:23 +0100
Hi,

I have been working my media centre project (the one I uploaded to the Hollywood Website) and have encountered a problem that I would like some clarification on.

Essentially what is happening is I am running a function called main menu and in this function are several events that check for key presses. left and right to move through the menus, esc to quit and enter to select the menu option.

When enter is checked for it determines which option is selected from a table and enters function that is referenced by that menu option i.e.

menuoptions={[1]=tvshowsMenu} ; this is the table with references to the functions

menuoptions[msg.userdata.menuid] () ; this calls the function based on the

menuid that is current when entered is pushed in the event check function

so in the tvshowsMenu I setup the display, create new events relating to this screen bu twhen I enter the repeat waitevent () forever loop I get an

error. (wrong usage/parameters for this command! Read the Documentation! which is referring to the WaitEvent () call.
Hmm, are you trying to call WaitEvent() from a function that was called by WaitEvent()? That won't work. An event function that got called by WaitEvent() can't call WaitEvent() again. You somehow need to return control to your main WaitEvent(). WaitEvent() inside event callbacks is not supported.

As a rule of thumb, good scripts should only call WaitEvent(). I.e. this is all you should need as a main loop:

Code: Select all

Repeat
  WaitEvent
Forever
Dwayne

[21 Jan 2010] Re: Query about Events

Post by Dwayne »

Note: This is an archived post that was originally sent to the Hollywood mailing list on Thu, 21 Jan 2010 17:51:02 +1100

Thanks, I will re-implement what I am trying to do so that there is only one waitevent loop.
Locked