mwan@PacBell.COM (Miu Wang) (12/03/90)
Help...I've just started playing with HC 2.0 and have a proble with the "returnInField" message. I have a script: on returnInField do something pass returnInField end returnInfield What I want to do is to "do something" when the user types a "return" in a text field, then have the system do its normal thing (put a return character in the text field and move the insertion point to the beginning of the next line in the field and allow the user to continue typing. But HC does not return control to the text field after the "do something". Bummer... This script works fine: on returnInField pass returnInField end returnInField i.e., "do something" is "nothing", then I get a new line in the text field and I can continue typing. but when "do something" exists, the "pass return- Infield" does not work and I lose the insertion point. Another problem. In the Power Tools stack, there is a windoid called "Super Grouper". I cannot get the group button to work. I can get the other buttons to work (not really, since I cannot group objects, and the move and align tools complain "no objects grouped") so I definitely have the scripts in my message passing hierarchy. Any ideas on what I'm doing wrong??? ------------------------------------------------------------------------------ Miu Wang 415-867-6476 ------------------------------------------------------------------------------ This space provided by permission of the Minister of Disinformation...... :-)
jk3t+@andrew.cmu.edu (Jonathan King) (12/04/90)
mwan@PacBell.COM (Miu Wang) writes: > Help...I've just started playing with HC 2.0 and have a proble with the > "returnInField" message. > I have a script: > > on returnInField > do something > pass returnInField > end returnInfield > > What I want to do is to "do something" when the user types a "return" in a > text field, then have the system do its normal thing (put a return character > in the text field and move the insertion point to the beginning of the next > line in the field and allow the user to continue typing. But HC does not > return control to the text field after the "do something". Bummer... Without knowing for sure what "something" you are doing, I can't be *sure* I know what the problem is, but I'm *almost sure* I know what is wrong. The answer depends on two subtle points about the insertion point in HC and how you can clobber it. First, in HC, the current location of the insertion point can be found by looking at "the selected chunk"--the insertion point is sort of a null selection. So, if the insertion point was between character 2 and 3 of card field "foo", then the selected chunk would return "char 3 to 2 of card field foo". Note that this is a "negative" selection; if the selectedChunk had returned "char 2 to 3 of card field foo" then this would mean that characters two and three had been selected. Second, the selection is a pretty fragile thing in Hypercard, and a huge number of "something"s you could be doing will unselect it, which would then cause the selectedChunk to return 'empty' and might cause weird things to happen when the returnInField message eventually reaches Hypercard. So here's a possible fix: on returnInField --insertionPoint is just a mnemonic name, and doesn't imply that the --selectedChunk always returns the insertion point. To be picky you --should test whether selectedChunk is returning an insertionPoint or --actual selected text. put the selectedChunk into insertionPoint --save the insertion do something --do your dance select insertionPoint --restore the insertion pass returnInField --let HC do whatever. end returnInField > Miu Wang 415-867-6476 jking
kofoid@bioscience.utah.edu (Eric Kofoid) (12/04/90)
In article <2419@pbhyg.PacBell.COM> mwan@PacBell.COM (Miu Wang) writes: > [...] > I have a script: > > on returnInField > do something > pass returnInField > end returnInfield > > What I want to do is to "do something" when the user types a "return" in a > text field, then have the system do its normal thing (put a return character > in the text field and move the insertion point to the beginning of the next > line in the field and allow the user to continue typing. But HC does not > return control to the text field after the "do something". Bummer... >[...] Try this: on returnInField put selectedChunk into thePos -- Following line is a dummy example of something -- which can be done at this point: put the ticks put return after thePos pass returnInField end returnInField Cheers, Eric Kofoid __________________________________________________________________ | Eric Kofoid; Dept. Biology, U. of Utah; SLC, UT 84112 | | (801) 581-3592 | | kofoid@bioscience.utah.edu | | | | -- The University of Utah is blameless for anything I've said -- | |__________________________________________________________________
mrx@dhw68k.cts.com (Mark Murphy) (12/06/90)
In article <2419@pbhyg.PacBell.COM> mwan@PacBell.COM (Miu Wang) writes: > >Help...I've just started playing with HC 2.0 and have a proble with the >"returnInField" message. > >I have a script: > > on returnInField > do something > pass returnInField > end returnInfield > >What I want to do is to "do something" when the user types a "return" in a >text field, then have the system do its normal thing (put a return character >in the text field and move the insertion point to the beginning of the next >line in the field and allow the user to continue typing. But HC does not >return control to the text field after the "do something". Bummer... > What does your "do something" do? If your handler manipulates another field, you will run into problems because the current selection will become unselected. If you are doing this, the way around it is to get the current selection... save it... do what you have to do... then reselect the original selection. I must warn you, it can be cosmetically unpleasing. -- mark mrx@dhw68k.cts.com
robertw@informix.com (Rob Weinberg) (12/06/90)
In article <2419@pbhyg.PacBell.COM> mwan@PacBell.COM (Miu Wang) writes: >In the Power Tools stack, there is a windoid called "Super >Grouper". I cannot get the group button to work. I can get the other buttons >to work (not really, since I cannot group objects, and the move and align >tools complain "no objects grouped") so I definitely have the scripts in my >message passing hierarchy. Any ideas on what I'm doing wrong??? Grouping with Super Grouper does work for me, but it didn't at first. I'm trying to think what I missed the first few times I tried it. This is the desirable scenario: 1- Open Super Grouper palette. 2- Click on the "Group" icon. 3- The cursor turns into a big "+". 4- Click on the objects you wish to group. YOU WILL NOT GET ANY VISUAL CONFIRMATION AT THIS POINT that objects are being selected. 5- Click back onto the Super Grouper palette. NOW you will get visual confirmation that your selected objects are being grouped. It may be necessary to click back unto Super Grouper *before* clicking on a non-object area of the card (?). I hope this works. > Miu Wang -- * Rob Weinberg, graphics & publishing ***** Does a falling tree make a sound * * {uunet,pyramid}!infmx!robertw ***** if 1: no one hears it * * => Ask me about me. ***** BUT 2: it is not known that * * => Ask Informix about Informix ***** no one hears it? *