Click and select a line in a table 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
user#606
Posts: 217
Joined: Sun Jan 27, 2008 12:25 pm
Contact:

Click and select a line in a table field

Post by user#606 » Mon May 05, 2008 4:28 pm

Can anyone confirm if it is possible to click on a line in a table field as the trigger to carry out a piece of code.
At the moment, I click on the line and use a button to detect the hilited line and do the code bit.

Why use two clicks if one will do?

Any ideas?

The actual code I use at the moment, with a button is :-

on mouseUp
global TableResult
set the itemdelimiter to tab

put the hilitedline of field "DaySkyResultsTable" into selectedLineInt --Get the selected row number
set the itemdelimiter to tab

put line selectedLineInt of field "DaySkyResultsTable" into itemsInFieldLine

put item 1 of ItemsInFieldLine into field "CurrentRoom"
put item 2 of ItemsInFieldLine into field "DayLightFactorFLD"
put item 3 of ItemsInFieldLine into field "WglazedArea"
put item 4 of ItemsInFieldLine into field "AroomArea"
put item 5 of ItemsInFieldLine into field "Rreflectance"
put item 6 of ItemsInFieldLine into field "Mcorrection"
put item 7 of ItemsInFieldLine into field "TglazedTrans"
put item 8 of ItemsInFieldLine into field "ThetaSky"
put item 9 of ItemsInFieldLine into field "FactorH"
put item 10 of ItemsInFieldLine into field "FactorY"
put item 11 of ItemsInFieldLine into field "FactorX"
put item 12 of ItemsInFieldLine into field "FactorD"
put item 13 of ItemsInFieldLine into field "RoomWidth"

put empty into line selectedLineInt of field "DaySkyResultsTable"

End Mouseup

Klaus
Posts: 14198
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Post by Klaus » Mon May 05, 2008 7:44 pm

Hi user#606,

you can use the field itself to trigger your mouseup!

Put this into the script of your field:

Code: Select all

on mouseUp 
  global TableResult 
  put the selectedtext of me into itemsInFieldLine
  set the itemdelimiter to tab 

  put item 1 of ItemsInFieldLine into field "CurrentRoom" 
  ...
  put item 13 of ItemsInFieldLine into field "RoomWidth" 
End Mouseup
That's it :-)


Best

Klaus


P.S.
ANY object can have scripts resp. can be clicked!

user#606
Posts: 217
Joined: Sun Jan 27, 2008 12:25 pm
Contact:

Post by user#606 » Tue May 06, 2008 8:47 am

Thank you Klaus,

I will give this a try.
I need to put this script into the table object now, not the original button I presume.

Klaus
Posts: 14198
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Post by Klaus » Tue May 06, 2008 9:25 am

user#606 wrote:Thank you Klaus,
I will give this a try.
I need to put this script into the table object now, not the original button I presume.
You wanted to get rid of that extra button, right?
Yes, that's what I meant with "Put this into the script of your field:"...


Best

Klaus

Post Reply