[comp.sys.mac] More specific Find in HyperCard

brian@ut-sally.UUCP (Brian H. Powell) (10/24/87)

     I am setting up a HyperCard stack to contain my favorite database:  my
record collection.  I want to set up different find buttons for finding
composer, finding title, etc.  I want the script for each button to bring up
the message window with:

	find "" in field "composer"
or	find "" in field "title"

where the cursor is in between the first double-quotes.

     Seems to me that I want to use "put into message" or some variation.  Is
this correct?

	Problem 1)  How do I "put" a double-quote?
	Problem 2)  How do I position the cursor?

Thanks.

Brian

chuq%plaid@Sun.COM (Chuq Von Rospach) (10/24/87)

>	Problem 1)  How do I "put" a double-quote?

	Put "Find " && quote && quote && " in field Composer"

>	Problem 2)  How do I position the cursor?

	There may be a better way, but wouldn't "Click at char 2 of word 2
	of msg" do it?

chuq

Chuq Von Rospach					chuq@sun.COM
Editor, OtherRealms					Delphi: CHUQ

graifer@net1.ucsd.edu (Dan Graifer) (10/25/87)

In article <9380@ut-sally.UUCP> brian@ut-sally.UUCP (Brian H. Powell) writes:
>
>     I am setting up a HyperCard stack to contain my favorite database:  my
>record collection.  I want to set up different find buttons for finding
>composer, finding title, etc.  I want the script for each button to bring up
>the message window with:
>
>	find "" in field "composer"
>or	find "" in field "title"
>
>where the cursor is in between the first double-quotes.
>
>     Seems to me that I want to use "put into message" or some variation.  Is
>this correct?
>
>	Problem 1)  How do I "put" a double-quote?
>	Problem 2)  How do I position the cursor?
>
>Thanks.
>
>Brian


I tried this:

on mouseUp
  put "Find" && quote & quote && "in Field Composer" into msg
  put rect of msg into mloc
  put (item 1 of mloc) + 50 into h
  put round(((item 2 of mloc) + (item 4 of mloc))/2) into v
  put " (" & h &"," & v & ")" after msg
  click at h,v
end mouseUp

but it doesn't work for one reason:  The click is not intercepted by the 
Message window, the card containing the button gets it instead.  I can
find no way to send a message to the Message window.

How about something like:
on mouseUp
  ask "Find what?"
  if it isnt empty then
    find it in field composer
  end if
end mouseUp

Good luck:
                              Dan Graifer
                              graifer@net1.UCSD.EDU
Disclaimer: Nobody ever listens to me anyways; Why should they start now?

jh7j@vax1.UUCP (Victor M. Silva) (10/27/87)

In article <9380@ut-sally.UUCP> brian@ut-sally.UUCP (Brian H. Powell) writes:
>
>I want the script for each button to bring up
>the message window with:
>
>	find "" in field "composer"
>or	find "" in field "title"
>
>where the cursor is in between the first double-quotes.
>     Seems to me that I want to use "put into message" or some variation.  Is
>this correct?
>
>	Problem 1)  How do I "put" a double-quote?
>	Problem 2)  How do I position the cursor?
>

    You can use the quote constant to place the double quotes into the msg
    window (ie. put "find" && quote & quote & ...).
    However, I think it would be better if you prompted the user with the
    ask command possibly with a default and then use the type command to
    initiate the search.  In this fashion you can keep the message window
    hidden.

  ask "Which composer?" with default
  type "find" && quote & it & quote "in field" & quote & "composer" & quote

  (Naturally, I didn't test this but I believe that it is basically
  correct).

						  -Victor M. Silva-
						  Cornell University
						   

freedman@calgary.UUCP (Dan Freedman) (10/29/87)

In article <9380@ut-sally.UUCP>, brian@ut-sally.UUCP (Brian H. Powell) writes:
> 	Problem 1)  How do I "put" a double-quote?
> 	Problem 2)  How do I position the cursor?
> 
> Thanks.
> 
> Brian
Ok, putting a double quote is as easy as including the constant "quote"
in the put command, and positioning the cursor is as easy as issuing
the "click at" command.  Something like this should do the trick:

	put "find " & quote & quote & " in field xyz"
	click at 123, 234

The arguments to click at will have to be found by experimentation, and
you might want to make them relative to the "loc of message box" so that
it will work properly even if someone moves the message box.  Also, I don't
have a mac in front of me, so I'm not sure whether "quote" is the right 
constant, but I think it is.  If not, then it's something similar.

	Dan Freedman
	University of Calgary Computer Science Department