Page 1 of 1

Click and select a line in a table field

Posted: Mon May 05, 2008 4:28 pm
by user#606
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

Posted: Mon May 05, 2008 7:44 pm
by Klaus
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!

Posted: Tue May 06, 2008 8:47 am
by user#606
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.

Posted: Tue May 06, 2008 9:25 am
by Klaus
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