At 12:45 AM -0400 30/9/1999, Andu wrote:
>>Scott Rossi <[EMAIL PROTECTED]> wrote:
>>
>>> Is there anyway to prevent the text field portion of a combobox button
>>> from automatically hiliting when its parent stack becomes active?
>>
>>I have had to override this behavior on two applications. MetaCard
>>automatically selects the first unlocked field it finds whenever the
>>card opens. It is almost never the behavior I want (not very Mac-like,)
>>and I wish it were optional. Scott, can we get a property setting for
>>this so we can turn it off?
>
>Comboboxes have a different function then list fields but I agree, list
>field's current behavior in this respect makes no sense. Why not select the
>fifth line? The field cannot assume a default line arbitrarily nor that
>there should be one. This is optional behavior and should be scripted.
I can't speak for combo boxes, but you can control selection in list
fields when a card opens with "the hilitedLines" property.
on openCard
set the hilitedLines of field 1 to x
end openCard
However, if you want nothing to be selected, you need to explicitly
focus on the field first.
on openCard
focus field 1
set the hilitedLines of field 1 to 0
end openCard
Linking the selection to a local variable (script local) can be
useful for retaining a selection when returning to a card.
local lcHilitedLines
on openCard
focus field 1
set the hilitedlines of field 1 to lcHilitedLines
end openCard
on iChanged
put the hilitedLines of field 1 into lcHilitedLines
end iChanged
Call the "iChanged" handler from a selectionChanged handler in the
field itself. I guess a custom property in the field could be used
instead of a local. This might depend on whether you want the
selection to persist after saving the stack. As the local will always
be empty when the stack loads (assuming it is destroyed on close),
you will start with an empty selection.
As for what should be default behavior, I don't know. Whatever it is,
I'm sure it won't be right for my next project. :)
Cheers
Dave Cragg