DATJN@NEUVM1.Bitnet (Jakob Nielsen Tech Univ of Denmark) (04/20/88)
Has anybody written an analysis of HyperTalk from a traditional computer science language perspective ? Some observations of my own: In the April 1988 APDAlog Newsletter, Dan Shafer recommends the following script to manage radio buttons: on mouseUp set the hilite of me to true repeat with counter = 8 to 15 if counter is not the number of me then set the hilite of - button counter to false end repeat end mouseUp Note that this code will fail under the following condition (among many other possibilities): If I have *two* set of radio buttons of this kind and remove a button from the bottommost set, then the numbers of the buttons in the topmost set will all be diminished by one - instant bug! So this coding style which is encouraged by the design of HyperCard is definitively *not* modular. One of the problems is that something which can be considered part of the state of an object (its number) is modified when changing other objects. Another case: When linking a button to a card, HyperCard changes the script of the button to include the number of the card being linked to. Modifying code instead of variables ... Here the destination information is hardwired into the code instead of being kept in a local variable of the button.
jmunkki@santra.UUCP (Juri Munkki) (04/23/88)
In article <50156@sun.uucp> DATJN@NEUVM1.Bitnet (Jakob Nielsen Tech Univ of Denmark) writes: >If I have *two* set of radio buttons of this kind and remove a button >from the bottommost set, then the numbers of the buttons in the >topmost set will all be diminished by one - instant bug! Here's what I would do, if I wanted radio buttons with hypercard. You have to have a special "findRadio" for the first button of the group. All the other buttons can have the same "findRadio". All the buttons have the same mouseUp. -- First button script for findRadio on findRadio global count add 1 to count put count end findRadio -- findRadio for other than first button in group on findRadio global theButton,count add 1 to count subtract 1 from theButton send findRadio to Button theButton end findRadio on mouseUp global theButton,count put the number of the target into theButton put 0 into count send findRadio end mouseUp Note that this program doesn't actually do any highlighting, but it does tell you which button in a script was hit. The highlighting and button handling code can be written into the first findRadio. Ok, now flame me... Juri Munkki Helsinki University of Technology Computing Centre jmunkki@santra.hut.fi jmunkki@fingate.bitnet