Weather / Spam / www |
Lyon Weather
aldweb against spam
|
|
|
|
|
|
|
- Forum - iziBasic
Warning: A non-numeric value encountered in /web5/aldweb/www/aldweb_com/www/thread.php on line 257
Topic # 1238 |
Menu Close Event |
28/07/2005 @ 14:50 by MikeF
|
I've noticed on my 'Reviews' application that once I recompiled it with iziBasic 5.2 (previously used 5.0) each menu selection now returns two events - a 'selection' event and the new 'close' event. Is this deliberate?
I had expected the close event to occur only when the menu was closed without making a selection (as a selection implies a close event anyway) so hadn't checked through my code to see how it would handle the extra events. |
|
|
Warning: A non-numeric value encountered in /web5/aldweb/www/aldweb_com/www/thread.php on line 497
Answer n° 1 -------- 28/07/2005 @ 22:50 by aldweb
visitor |
Hello Mike,
This new close menu event was indeed added, in version 5.1 and I remember very well of it because I spent hours and hours to implement it! So, there was a good reason for doing it
This is indeed absolutely required for real time games (the one to thank for giving me the information is Leonard: http://izibasic.aldweb.com/leonard/) that need to know when to stop/start again the animation after the menu was closed. I spent that number of hours because this event is not provided by Palm OS so I had to trick the system to simulate one...
Now, in a way, you are right, the close event is usually not needed if a selection was made and I understand very well your point of view.
But, between the time the selection is made and the time the menu is really closed there might be a few system ticks and the real time game programmer would rather capture the right event... Otherwise some drawing could occur on top of the menu, which is then erased, erasing at the same time what was drawn.
And also, to be honest with you, since my trick succeeded to capture/simulate this close event, I was so happy with it (remember that I spent hours and hours on this topic!) that I'd rather leave it that way.
I also believe that the succession of events is clean this way: 1. a menu is opened 2. eventually, a menu item is selected 3. the menu is closed
Now, in a usual case, all you need to do in a source code is: 1. was there a menu event? (EVENT 1001) 2. what item was eventually selected? (MENUITEM >0) At this stage, I believed that this change would cause no change in users existing source codes. I always pay very much attention to the compatibility topic so that any source code of a previous version should compile and run the same way with a new iziBasic version.
So, I hope that you will allow me to ask you one question. I ask it to the friend that you are and not at all in a commercial way at all as I should probably do with the famous reviewer at a great web site (dear other readers, you should bookmark this site if not already done: http://www.palm247.com) that you are... well you know my sense of humour! So here is the question: maybe was your source code not really optimized? Maybe is this the good opportunity to optimize it now? (I cheated, I asked 2 questions!)
You see, I could write a full story on this topic! So, I better stop now!
Cheers,
@+ aldweb |
|
|
Warning: A non-numeric value encountered in /web5/aldweb/www/aldweb_com/www/thread.php on line 497
Answer n° 2 -------- 28/07/2005 @ 23:06 by MikeF
visitor |
My code? Not optimised? How dare you Sir!
OK...actually 'not well bounded' would be a better description as I was simply testing for a value less than 6 (and -1 is less than 6!). It is already corrected and I'm happy for it to remain so.
I can understand the need for the event (my day job being real-time software for aircraft rather than games) and have seen a few PalmOS utilities that overwrite their menu windows and then close them.
Congratulations on making it work! |
|
|
Warning: A non-numeric value encountered in /web5/aldweb/www/aldweb_com/www/thread.php on line 497
Answer n° 3 -------- 28/07/2005 @ 23:25 by KHertan
visitor |
Oh my god ... it s was only that ... i m thinking that a endif is lost between one of my 48 conditional test ...
Thanks for the detailed answer. |
|
|
Warning: A non-numeric value encountered in /web5/aldweb/www/aldweb_com/www/thread.php on line 497
Answer n° 4 -------- 28/07/2005 @ 23:36 by aldweb
visitor |
Reading you Khertan, I think that I shall really start to think about some counter at compilation time that would check that the number of [IF test THEN] and [ENDIF] is the same at the end of the compilation process.
Cheers,
@+ aldweb |
|
|
Warning: A non-numeric value encountered in /web5/aldweb/www/aldweb_com/www/thread.php on line 497
Answer n° 5 -------- 28/07/2005 @ 23:40 by aldweb
visitor |
Mike,
Some good code could be:
M=MENUITEM IF M>0 THEN 'not open and not close SELECT CASE M CASE 1 ' Item 1 was selected CASE 2 ' Item 2 was selected END SELECT END IF There, you are sure to deal with available menu items only...
I have always tried to put negative values in iziBasic for "strange" cases. For instance with DOEVENTS (or WAITEVENT).
Cheers,
@+ aldweb |
|
|
topic active
topic closed
Sticky
New message -
Correct message
Close topic
Make sticky
|
|
|
|
|
|