[futurebasic] Old bad habit #427

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : April 2001 : Group Archive : Group : All Groups

From: Paul Bruneau <paul_bruneau@...>
Date: Mon, 23 Apr 2001 14:27:17 -0400
Hi List-

Every so often, when I am re-doing something in my big application, I
will say to myself "well, since I'm redoing it anyway, I might as well
do it right this time"

This happens pretty often, because I sort of learned FB (and Mac)
programming as I went (some of you might have been there too).

Anyway, I am quite sure that I do menus wrong.

When something in my program happens and I need to put a checkmark next
to a menu item (for instance), I will do it right then. In other words,
I keep the menus accurate at any given time by just modifying them as
soon as the thing that they depend upon changes.

I seem to have read somewhere that instead what I should do is only
worry about it just before the system displays the menu to the user.
Something like this:

1. User clicks a menu
2. My program receives a "hey, program, the user has just clicked your
menu" (is this like a preview event??)
3. My program sets all the menu items to their appropriate settings
depending on the state of the world
4. The system then takes over to handle the menu drawing and selecting
5. The system tells my program which item was actually selected.

Is this how it should work? Is there some code where it is done the
right way that someone can point me toward?

Thanks,

PB