Clickline problem

Creating desktop or client-server database solutions?

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
Jordy
Posts: 32
Joined: Sat Feb 27, 2016 3:59 am

Clickline problem

Post by Jordy » Mon Apr 11, 2016 1:52 am

Hello,
I am attempting to allow users to click on a disabled text Field to get the click line
then there is a button to delete the line that was clicked on.
It would be cool if the line was highlighted or changed color but its not mandatory.

CODE IN THE TEXT FIELD :
global gLine
on mouseup
select the clickLine
put the value of the clickLine into gLine
end mouseup

CODE IN THE BUTTON :
global gLine
on mouseUp
delete line gLine of fld "Inv1"
end mouseUp

Bonus points if anyone knows how to disable a field without making the contents of the field "greyscale"

THANKS!

AxWald
Posts: 578
Joined: Thu Mar 06, 2014 2:57 pm

Re: Clickline problem

Post by AxWald » Mon Apr 11, 2016 8:00 am

Hi,

don't "Disable" it - set it to "Lock text" & "List behaviour"!
No script required in the field.

In the button just this:

Code: Select all

delete line (word 2 of the selectedline of fld "MyField") of fld "MyField"
Have fun!
All code published by me here was created with Community Editions of LC (thus is GPLv3).
If you use it in closed source projects, or for the Apple AppStore, or with XCode
you'll violate some license terms - read your relevant EULAs & Licenses!

Jordy
Posts: 32
Joined: Sat Feb 27, 2016 3:59 am

Re: Clickline problem

Post by Jordy » Mon Apr 11, 2016 11:41 am

Thanks AxWald!
I will lock text instead of disable.

I had seen some other posts talking about delete (word 2 of .... And I didn't understand cause I want to delete the line not word 2. Now I understand that word 2 is actually referencing the clickline not the field.

Problem solved Thanks A lot

AxWald
Posts: 578
Joined: Thu Mar 06, 2014 2:57 pm

Re: Clickline problem

Post by AxWald » Mon Apr 11, 2016 3:13 pm

Hi,

OK, it's a strange expression, right. But let's have a look:

Code: Select all

delete line (word 2 of the selectedline of fld "MyField") of fld "MyField"
"the selectedline" returns something like "line 2 of field 3". Would be cool if we just could write:

Code: Select all

delete the selectedLine
Looks quite OK, but for whatever reason it doesn't work at all. And with " of fld "MyField"" added it doesn't even compile ...
(I'm sure some Guru will come soon with a more elegant solution ...)

So, "the selectedline of fld "MyField"" returns "line 2 of field 3".
"Word 2" of it is "2" (words are delimited by spaces).
So, basically, we "delete line 2 of fld "MyField"" ;-)

We could also:

Code: Select all

do "delete " & the selectedline of fld "MyField"
:lol:

For more fun, try above mentioned "delete the selectedLine" in a mouseup handler in the field ...

Hope I could add to the confusion :) Have fun!
All code published by me here was created with Community Editions of LC (thus is GPLv3).
If you use it in closed source projects, or for the Apple AppStore, or with XCode
you'll violate some license terms - read your relevant EULAs & Licenses!

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7238
Joined: Sat Apr 08, 2006 8:31 pm
Location: Minneapolis MN
Contact:

Re: Clickline problem

Post by jacque » Tue Apr 12, 2016 10:03 pm

This works too, though it may be just as confusing:

Code: Select all

delete line (the hilitedline of me) of me
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

Post Reply

Return to “Databases”