Great thread.

I'd like to second Sarah's and Dan's recommendation..that is putting the scripts as high as possible in the message path (with buttons and controls at the top, not the bottom like Dan likes them;-)

But, I try and never script a mouseUp handler more than a few lines. For instance, I might have the script of button "Delete Row":

on mouseUp
  put altSelectedLine() into tLineNum
  deleteRow tLineNum
end mouseUp

Then I'd have also in the same button script:

function altSelectedLine
  put the hilitedlines of fld "test" into tLineNum
  if tLineNum is empty then
    answer "Please choose a row!"
    exit to top
  end if
  return tLineNum
end altSelectedLine

This function can be called by any button which needs to know the hilitedline number of fld "test." So, I leave it in this button's script until I create a new button "Edit Row", then I move it to the next level, the card script.

Also in this button's script:

on deleteRow pLineNum
  if pLineNum is "all" then
    put empty into fld "test"
  else
    delete line pLineNum of fld "test"
  end if
end deleteRow

Now, if later I need a 'stripAndship' handler for resetting my project to 'new', I might end up putting this 'deleteRow' handler in the stack script because it would be called as such:

on stripAndShip
   deleteRow "all"
   --> DO OTHER RESET STUFF
end stripAndShip

So, the idea is to keep the handlers and functions high up, and progressively demote them as you have more objects taking advantage of the same function.

HTH,
Chipp

_______________________________________________
use-revolution mailing list
[email protected]
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution

Reply via email to