Menu Buttons and the text property
Bob Sneidar
bobsneidar at iotecdigital.com
Mon Feb 16 10:55:49 EST 2015
Yes, but that part of the script already works. I have no problem deleting all of the text in the combo box, as I have a special case to account for that.
Bob S
> On Feb 13, 2015, at 17:17 , Randy Hengst <iowahengst at mac.com> wrote:
>
> I'm not at my computer so this idea might just be worthless. Can the first line of your industry list be empty and when you trap for delete go to line 1?
>
>> On Feb 13, 2015, at 6:43 PM, Bob Sneidar <bobsneidar at iotecdigital.com> wrote:
>>
>> Thanks for the reply. Let me explain what I am trying to accomplish.
>>
>> I have a combo box with a property containing a list of Industry Names. Things like Retail Services, Auto Repair and such. As the user types, I want to autofill the text with the first choice in that list that matches what the user typed, then select the remaining text after it, so that typing replaces the text after the insertion point. That part works fine.
>>
>> But what happens when the user backspaces? Well it just fills in the remainder of the entry and selects after the insertion point like it normally does. I want the user to be able to delete what is there. Easy enough, I just put empty into the selectedText. But what if there *is* no selected text?? The selectedText is empty, the selected chunk is a description of the first line of the text. So it will delete the whole contents if I use that.
>>
>> Now if the selected chunk behaved in a combo box the way it does in a field, I could parse that and delete the character of the label prior to the insertion point. But it doesn’t, and no commands or functions I’ve found do.
>>
>> I did find a workaround though. The following seems to work properly. It’s a kludge in the finest tradition of epic kludges, but it works.
>>
>> on rawKeyDown pKeyCode
>> if pKeyCode = 65288 then
>> lock messages
>> if the selection is empty then
>> type numToChar(pKeyCode)
>> exit to top
>> end if
>> end if
>> pass rawKeyDown
>> end rawKeyDown
>>
>> on textChanged
>> if the label of me is empty then
>> set the text of me to the options of me
>> exit textChanged
>> end if
>>
>> put the label of me into theValue
>> put length(theValue) into theLength
>> put the Options of me into theOptions
>> filter theOptions with theValue & "*"
>>
>> if theOptions is not empty then
>> set the text of me to theOptions
>> if the text of me is among the lines of theOptions then
>> -- set the label of me to line 1 of theOptions
>> select char theLength +1 to -1 of me
>> end if
>> end if
>>
>> -- focus on me
>> pass textChanged
>> end textChanged
>>
>> _______________________________________________
>> use-livecode mailing list
>> use-livecode at lists.runrev.com
>> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
>> http://lists.runrev.com/mailman/listinfo/use-livecode
>
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
More information about the use-livecode
mailing list