Friday, November 24, 2017

#1 2016-07-25 12:36:45 pm

Jonathan Engelhardt
Member
Registered: 2010-06-11
Posts: 57

Drag and drop table cell from one table to another

Hi there,

Im New to ASOC and i would need some help towards the right direction

In my OSX APP i have two separate object based tables (A+B) with cocoa bindings for each column and an arrayController for each. Both work perfect.

I'd like to drag and drop a table Cell from table A to B -> the cell should be ADDED to the row in table B but NOT deleted from A.

So i have two questions:

1.) How do i enable DRAG/DROP behaviour for my tables in ASOC? I found a lot of examples in pure ObjC but it's still tricky for me to translate that into ASOC language

2.) How can i add the above mentioned behaviour?

I don't want someone to write down the complete Code for me - i want to learn with the right amount of help.

Pat


Filed under: table, cell, asoc, drag and drop

Offline

 

#2 2016-07-25 07:19:20 pm

Shane Stanley
Member
From:: Australia
Registered: 2002-12-07
Posts: 5179

Re: Drag and drop table cell from one table to another

What you want to do is complex, regardless of the language. If you search around here, you will find example code for dragging a row within a table (I assume you mean row rather than cell -- otherwise it's even more complicated). I suggest you get that part working first, before moving to drag and drop between separate tables.


Shane Stanley <sstanley@myriad-com.com.au>
www.macosxautomation.com/applescript/apps/

Offline

 

#3 2016-07-27 12:33:06 am

Jonathan Engelhardt
Member
Registered: 2010-06-11
Posts: 57

Re: Drag and drop table cell from one table to another

Thank you Stanley.

I'm getting closer and managed drag & drop of rows from one table to another.

Now I'm stocked at identifying the cell the user clicked on. Any help on that? (ASObjC)

Offline

 

#4 2016-07-27 01:48:29 am

Shane Stanley
Member
From:: Australia
Registered: 2002-12-07
Posts: 5179

Re: Drag and drop table cell from one table to another

You will probably have to do something like subclass the table view, override -mouseDown: to get the point of the mouse click, and then use -columnAtPoint: and -rowAtPoint: to calculate the cell.


Shane Stanley <sstanley@myriad-com.com.au>
www.macosxautomation.com/applescript/apps/

Offline

 

#5 2016-07-27 01:52:28 am

Jonathan Engelhardt
Member
Registered: 2010-06-11
Posts: 57

Re: Drag and drop table cell from one table to another

Sounds logical. I'll try that and give feedback

Offline

 

Board footer

Powered by FluxBB

RSS (new topics) RSS (active topics)