Page 1 of 1

Clickline problem

Posted: Mon Apr 11, 2016 1:52 am
by Jordy
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!

Re: Clickline problem

Posted: Mon Apr 11, 2016 8:00 am
by AxWald
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!

Re: Clickline problem

Posted: Mon Apr 11, 2016 11:41 am
by Jordy
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

Re: Clickline problem

Posted: Mon Apr 11, 2016 3:13 pm
by AxWald
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!

Re: Clickline problem

Posted: Tue Apr 12, 2016 10:03 pm
by jacque
This works too, though it may be just as confusing:

Code: Select all

delete line (the hilitedline of me) of me