Select a line in a table

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
Glenn Boyce
Posts: 137
Joined: Thu Jul 24, 2008 11:22 pm

Select a line in a table

Post by Glenn Boyce » Tue May 19, 2009 11:09 pm

I have purchased the Listmagic table addon. It highlights a line and allows you to right lick on it to copy the line. I want to double click on the line and automatically copy the line detail, put it into a variable and go to a different card to paste the information into some specific fields. I can't work out the doubleclick and copy script. Anyone there who can help?

cheers

Glenn

Glenn Boyce
Posts: 137
Joined: Thu Jul 24, 2008 11:22 pm

Post by Glenn Boyce » Thu May 21, 2009 12:49 am

No one has answered this topic. I now have exactly the same issue with a normal table field. how do I know what line I am clicking on? Once I have that I can select it and put it into a variable etc.

Janschenkel
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 977
Joined: Sat Apr 08, 2006 7:47 am
Contact:

Post by Janschenkel » Thu May 21, 2009 7:09 am

Hi Glenn,

For your ListMagic question, you're better off emailing Jim Buffalini of So Smart Software - I'm not sure if they have a forum on their website, but it is quite possible that your fellow ListMagic users haven't noticed your question on this runrev.com forum. I'm not a ListMagic user, so I can't help you there.

But I can lend a hand with a regular table field question. Start a separate test stack, and drag a table field onto it; use the inspector palette to set the name of this field to "MyTableField", turn off cell editing and turn on list behavior, as otherwise we won't be able to receive the necessary events.
Set the field script to:

Code: Select all

on mouseDoubleUp
  answer the hilitedLine of me
end mouseDoubleUp
Test it by doubleclicking on the table field: you should get a dialog box which tells you the line you double-clicked on.

Next you add the contectual menu support, so drag a popup menu onto your stack, and name it "MyPopUpButton"; next you set its script to:

Code: Select all

on menuPick pItemName
  answer the hilitedLine of field "'MyTableField" && "->" && pItemName
end menuPick
And now you wire things up by adding the following to the field script:

Code: Select all

on mouseUp pButton
  if pButton is 3 then -- it's a right-mouse click
    popup button "MyPopUpButton"
  end if
end mouseUp
Now use the mouse to select a line in your table field, and right-click; the popup menu should display, and when you select an item from it, you should get a dialog box which tells you the selected line of the field and which item you picked from the popup menu.

HTH,

Jan Schenkel.
Quartam Reports & PDF Library for LiveCode
www.quartam.com

Glenn Boyce
Posts: 137
Joined: Thu Jul 24, 2008 11:22 pm

Post by Glenn Boyce » Thu May 21, 2009 9:36 pm

That is sooo cool! Opens a whole world of possibilities now!
I presume the " ' " before MyTableField in second script is a typo.
I also presume you would hide the pop up menu.

cheers

Glenn

Post Reply