Allowing user to change size and location of a field

Mark Schonewille m.schonewille at economy-x-talk.com
Wed Mar 7 12:58:35 EST 2012


Hi Glen,

Your script works for me, but not in the IDE. I have created a front script. I do also see the behaviour you describe. You can solve this by adding another field. The field can be off-window but should not be invisible. Use the following as a front script:

on mouseDown theButton
   if the cResize of the target is true then
        if theButton is 3 AND the shiftkey is down then
              get the selected of the target
              switch it
                    case  "true"
                          set the selected of the target to false
                          set the tool to browse
                          select empty
                          focus on fld 2
                          break
                    case  "false"
                          set the selected of the target to true
                          set the tool to pointer
                          break
              end switch
        else
              pass mouseDown
           end if
   else
      pass mouseDown
   end if
end mouseDown

The user will now be able to click in the first field and edit the text.

I'd adjust the mouseDown script to make sure that other objects can't be selected or you could set the cantSelect of all other objects to false.

--
Best regards,

Mark Schonewille

Economy-x-Talk Consulting and Software Engineering
Homepage: http://economy-x-talk.com
Twitter: http://twitter.com/xtalkprogrammer
KvK: 50277553

Download the Installer Maker Plugin 1.7 for LiveCode here http://qery.us/za

On 7 mrt 2012, at 17:32, Glen Bojsza wrote:

> Hello,
> 
> I would like to allow a user to be able to change the size and location of
> a text field in an application.
> 
> The following allows the user to select the field via right-shift click and
> then with the pointer tool move the field to where they want and resize the
> field.
> 
> With the next right-shift click the field is deselected and the browse tool
> is shown.
> 
> Problem is the user cannot put text into the field anymore?
> 
> Am I approaching this correctly?
> 
> on mouseDown theButton
>   if theButton is 3 AND the shiftkey is down then
>      get the selected of me
>      switch it
>         case  "true"
>            set the selected of me to false
>            set the tool to browse
>            select empty
>            break
>         case  "false"
>            set the selected of me to true
>            set the tool to pointer
>            break
>      end switch
>   else
>      pass mouseDown
>      end if
> end mouseDown
> 
> Another question which may not be able to be answered is... can you limit
> the number of characters in the field based on the new size the user has
> made?
> 
> thanks,
> 
> Glen





More information about the use-livecode mailing list