Re: How do you build GUIs in Smile? (was Re: Plotting question)
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: Emmanuel <email@hidden>
- Date: Thu, 29 Aug 2002 16:45:42 +0200
At 3:51 PM +0200 22/8/02, has wrote:
>
>
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.
Providing only the index may seem not to be the good method, since indices
may change when you further edit the dialog.
However, it is the good method.
First, you can retrieve a reference to the widget and forget immediately
about the index:
---------------
on click in theDlog item number i
set theRef to dialog item i of theDlog
...
---------------
Second, other possible methods would have been, using the unique id, which
is totally useless because unpredictable, or using the control's name,
which does not really exist in OS X, since names change when the user
changes the language.
Finally, yes, it is a good habit to store the indices into properties, like
has suggests:
---------------
property dwUpdateButton : 1
property dwRevertButton : 2
property dwTitleTextField : 3
on click in theDlog item number theWidget
if theWidget is dwUpdateButton then
...
---------------
but storing the references to the widgets may still be more efficient and
readable:
---------------
on prepare theDlog
set dwUpdateButton to theDlog's dialog item 247
...
on click in theDlog item number theIndex
set theWidget to theDlog's dialog item theIndex
if theWidget is dwUpdateButton then
...
---------------
Emmanuel
_______________________________________________
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.