Stopping a return and backspace in an editable list field

LiveCode is the premier environment for creating multi-platform solutions for all major operating systems - Windows, Mac OS X, Linux, the Web, Server environments and Mobile platforms. Brand new to LiveCode? Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
gyroscope
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 404
Joined: Tue Jan 08, 2008 3:44 pm
Location: Kent, UK
Contact:

Stopping a return and backspace in an editable list field

Post by gyroscope » Wed Mar 25, 2009 6:52 pm

Hi, I'm working on my script collector prog today. I have a list field where the user puts in the name/heading of the particular code they have saved which is in another field.

For selection of any of the headings/lines in the list field I have the following selected in the Property Inspector, AutoHilite and List Behaviour, no probs.

For editing or deleting I have a button, whose script is:

Code: Select all

on mouseUp pMouseBtnNo
    if the hilight of me is false then
        lock screen
set the locktext of field "List Field" to true
       set the listbehavior of field "List Field" to true
     unlock screen
    else
        if the hilight of me is true then
            lock screen
     set the locktext of of field "List Field" to false
      set the listbehavior of field "List Field" to false
            unlock screen
        end if
    end if
    
end mouseUp
This works fine for editing or deleting the entries but I want the lines to be independant of each other somehow, so that backspace doesnt jump up to the line above and return doesn't jump the cursor to the line below. But clicking on any other line allows editing of that line still. Hope I've explained this OK?

Anyone have any advice here please :?:

sturgis
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 1685
Joined: Sat Feb 28, 2009 11:49 pm

Re: Stopping a return and backspace in an editable list fiel

Post by sturgis » Wed Mar 25, 2009 7:13 pm

I'm still pretty new to this stuff, but I think you'll want to look at a few things in the dictionary.
enterInField
returnInField
backspaceKey
tabKey

Somewhere here I have some code written that handles how fields are moved through with tab/enter/return so am pretty sure this will point you in the right direction.

In fact, if you do something like

Code: Select all

on enterInField
do mySpecialHandler
end enterInField

on returnInField
do mySpecialHandler
end returnInField

on tabKey
do mySpecialHandler
end tabKey

on mySpecialHandler
-- put your special code here for return, enter and tab key if you want them to all behave the same
end mySpecialHandler
I saw an example similar to this somewhere in the forums, if I can find it again i'll post a link to the other post, it was MUCH more informative.
gyroscope wrote:Hi, I'm working on my script collector prog today. I have a list field where the user puts in the name/heading of the particular code they have saved which is in another field.

For selection of any of the headings/lines in the list field I have the following selected in the Property Inspector, AutoHilite and List Behaviour, no probs.

For editing or deleting I have a button, whose script is:

Code: Select all

on mouseUp pMouseBtnNo
    if the hilight of me is false then
        lock screen
set the locktext of field "List Field" to true
       set the listbehavior of field "List Field" to true
     unlock screen
    else
        if the hilight of me is true then
            lock screen
     set the locktext of of field "List Field" to false
      set the listbehavior of field "List Field" to false
            unlock screen
        end if
    end if
    
end mouseUp
This works fine for editing or deleting the entries but I want the lines to be independant of each other somehow, so that backspace doesnt jump up to the line above and return doesn't jump the cursor to the line below. But clicking on any other line allows editing of that line still. Hope I've explained this OK?

Anyone have any advice here please :?:

gyroscope
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 404
Joined: Tue Jan 08, 2008 3:44 pm
Location: Kent, UK
Contact:

Post by gyroscope » Wed Mar 25, 2009 11:00 pm

Thank you sturgis, returninField seems to be the one.

:)

Post Reply

Return to “Getting Started with LiveCode - Experienced Developers”