• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag
 

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: How do you build GUIs in Smile? (was Re: Plotting question)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How do you build GUIs in Smile? (was Re: Plotting question)


  • Subject: Re: How do you build GUIs in Smile? (was Re: Plotting question)
  • From: Andy Wylie <email@hidden>
  • Date: Fri, 23 Aug 2002 20:29:01 +1200

on 23/8/02 1:51 AM +1200: has wrote:

> First thing to realise is that although all objects in Smile are attachable
> (i.e. you can hook a script to it), attaching code to dialog widgets won't
> actually do anything as all widget events are passed directly to the dialog
> window. So the only thing you attach a script to is the dialog itself.
>
or a group box
>
> Second, you'll find a list of the events you require in Smile's dictionary.
> You have to read carefully: AS dictionaries don't unfortunately distinguish
> between the messages that you'd normally send to the app (e.g. 'check
> syntax') and the messages that the app sends for _you_ to handle (e.g.
> 'click in'). So you have to work out which is which from reading the
> descriptions. (Looking at the event handlers in existing dialogs' code will
> also help you here.)
>
or read the 'Custom Dialog' help section where these commands are described.
>
> Third (and this one particularly peeves me, although working around it is
> straightforward enough), rather than passing a reference to the widget that
> sent the message (or even just its name), Smile just hands you a simple
> index number that matches the index of the widget as seen in the dialog.
>
> The problem here is that index numbers 1. are liable to change as you edit
> the dialog layout, and 2. make for horribly non-self-explanatory code
> (which in turn increases the chance of making errors as you write/modify
> the thing). Hence, I offer you a very simple rule of thumb which I do
> recommend you adhere to:
>
> * NEVER use literals when referring to your dialog's widgets. Ever. *
>
> i.e. The following approach should be avoided like the plague:
>
> on click in theDlog item number i
> if i = 1 then
> ...
> else if i = 2 then
> ...
>
> or:
>
> set contents of dialog item 3 to newValue
>
>
> You might think this is a lot of unnecessary bloat and bother, but trust me on
>this: it will make your code much simpler to write, debug, modify and,
> perhaps most importantly, read.
>
I don't have any such bother and can only imagine your were scarred at a
tender age to make such recommendations. I suggest commenting and use of
group boxes with a manageable the number of objects which works just fine
for me.

_____________________________ Andy
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.

References: 
 >Re: How do you build GUIs in Smile? (was Re: Plotting question) (From: has <email@hidden>)

  • Prev by Date: Running an applescript from another applescript
  • Next by Date: Re: QuickTime: playing two movies
  • Previous by thread: Re: How do you build GUIs in Smile? (was Re: Plotting question)
  • Next by thread: Re: How do you build GUIs in Smile? (was Re: Plotting question)
  • Index(es):
    • Date
    • Thread