Re: On Drag Over Behavior

2019-02-14 Thread Chip Scheide via 4D_Tech
right -
On Drag Over - return a value to allow/stop the drop event
On Drop - do NOT return any value

> 
>> Also, if the “On drop” event code has $0, make sure $0 returns 0 or 
>> simply (for the moment) comment out the $0 line.
> 
> Yes

Hell is other people 
 Jean-Paul Sartre
**
4D Internet Users Group (4D iNUG)
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**

Re: On Drag Over Behavior

2019-02-14 Thread John J Foster via 4D_Tech
Hey Chip,

I do understand how to get what I want but it appears that the UI optics have 
changed from earlier versions.

However, thanks for sharing your logic and code fragments.

John...

> conceptually - 4D should do the cursor change for you
> 
> (declaimer: not v17)
> I have selection list boxes which I allow the user to drag data from 
> other list boxes in other windows/processes.
> In the On Begin Drag Over I setup a process variable, 
> ptr_Drag_n_Drop_Source, which holds a pointer to the source table.
> 
> In the On Drag Over event - I test for valid data, and return either 0 
> or -1. By returning either value to the droppable area you should 
> trigger 4D's cursor change to indicate a droppable area, and whether 
> the data being dragged is valid for the drop area.
> 
> i.e.
> // Drop area object - object method
> Case of
> :(Form event = On Drag Over)
> 
> // the below 2 lines can be substituted with test for the data type(s) 
> on the pasteboard
>  DRAG AND DROP 
> PROPERTIES($Source_Object;$Source_Element;$Source_Process_Number)
>  GET PROCESS 
> VARIABLE($Source_Process_Number;ptr_Drag_n_Drop_Source;$Source_Table)
> 
> // is_allowed is just for this example and is whatever criteria is 
> valid in your circumstances
>  if (Is_allowed($Source_Table))   
>   $0:=0
>  else
>   $0:=-1
>  end if
> end case
> 
> 
> Chip

**
4D Internet Users Group (4D iNUG)
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**

Re: On Drag Over Behavior

2019-02-14 Thread John J Foster via 4D_Tech
Hi Jeremy

> Have you checked the property inspector for the drop variable?

Yes.

> In particular are these 2-properties check-marked for the drop variable?
> 1) “Droppable” in the “Action” theme
> 2) “On drop” in the “Event” theme


Yes

> Also, if the “On drop” event code has $0, make sure $0 returns 0 or simply 
> (for the moment) comment out the $0 line.

Yes

> Then try dragging to the drop variable. When the pointer is over the drop 
> variable, does the cursor automatically change to a plus sign?

Drum roll please… I discovered that the object being dragged from also has to 
have the droppable property set. If not it dragging from works and the value is 
being dropped to test variable correctly. But if I deselect the droppable 
property of the listbox then the plus sign button doesn’t show.

> Using the pasteboard for drag and drop is so much easier.

I’m learning this now. It certainly seems to be a lot more flexible. In this 
case it’s real simple.

Anyway, thanks for responding Jeremy. I was going to respond after I was 
certain how I got it working for those who have this challenge in the future. 
Like maybe me again! 

Appreciate,
John…



> 
>> On Feb 14, 2019, at 11:55 AM, John J Foster via 4D_Tech 
>> <4d_tech@lists.4d.com > wrote:
>> 
>> would like to see the variable get hi lighted or something. But nothing 
>> happens and I don’t recall if I have to do something else?
> 

**
4D Internet Users Group (4D iNUG)
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**

Re: On Drag Over Behavior

2019-02-14 Thread Keisuke Miyako via 4D_Tech
I think the cursor no longer changes automatically in 4D cocoa (64-bit), v16 
and above.

2019/02/15 9:48、Jeremy French via 4D_Tech 
<4d_tech@lists.4d.com>のメール:
Then try dragging to the drop variable. When the pointer is over the drop 
variable, does the cursor automatically change to a plus sign?



**
4D Internet Users Group (4D iNUG)
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**

Re: On Drag Over Behavior

2019-02-14 Thread Jeremy French via 4D_Tech
Have you checked the property inspector for the drop variable?

In particular are these 2-properties check-marked for the drop variable?
1) “Droppable” in the “Action” theme
2) “On drop” in the “Event” theme

Also, if the “On drop” event code has $0, make sure $0 returns 0 or simply (for 
the moment) comment out the $0 line.

Then try dragging to the drop variable. When the pointer is over the drop 
variable, does the cursor automatically change to a plus sign?

Something like this:

https://i.postimg.cc/SKb4z3ZL/p01-dropable-mouse-indicator.png 


> On Feb 14, 2019, at 11:55 AM, John J Foster via 4D_Tech 
> <4d_tech@lists.4d.com> wrote:
> 
> would like to see the variable get hi lighted or something. But nothing 
> happens and I don’t recall if I have to do something else?

**
4D Internet Users Group (4D iNUG)
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**

Re: On Drag Over Behavior

2019-02-14 Thread Jeremy French via 4D_Tech
Hi John,

Using the pasteboard for drag and drop is so much easier.

4D changes clipboards briefly during the drag and drop events. 

Whatever was in the pasteboard **before** “On Begin Drag Over” is restored 
**after** the “On Drop” event completes.

This means you can store drag information in the pasteboard during the “On 
Begin Drag Over” event. Then retrieve that information during the “On Drop” 
event. This “silent” pasteboard switching allows storing drag information 
during the “On Begin Drag Over” event and retrieving that information during 
the “On Drop” event. After “On Drop” completes, whatever was in the pasteboard 
before “On Begin Drag Over” is returned to the pasteboard.

You also need to set 1-specific property for the source object: enable the “On 
Begin Drag Over” event.

2-specific properties are needed for the destination object: enable both 
“Droppable” action and “On Drop” event.

In the source object, have code like this:

---
Case of
  :(form event=On Begin Drag Over)

   // Create an object containing info you want to get on drop. Then store in 
pasteboard.
  $o := New object(….)
 SET TEXT TO PASTEBOARD(JSON Stringify($o)

End case
---

In the destination object, have code like this:

---
Case of
  :(form event=On Begin Drag Over)

   // Retrieve the drop information
  $json_t:=Get text from pasteboard
  SET TEXT TO PASTEBOARD(JSON Stringify($o))
  $o:=JSON Parse($json_t)

End case
---

Best regards,
Jeremy

> On Feb 14, 2019, at 11:55 AM, John J Foster via 4D_Tech 
> <4d_tech@lists.4d.com> wrote:
> 
> am also in process of learning to use the pasteboard to get rid of the 
> obsolete command. Any help would be appreciated.

**
4D Internet Users Group (4D iNUG)
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**

Re: On Drag Over Behavior

2019-02-14 Thread Chip Scheide via 4D_Tech
conceptually - 4D should do the cursor change for you

(declaimer: not v17)
I have selection list boxes which I allow the user to drag data from 
other list boxes in other windows/processes.
In the On Begin Drag Over I setup a process variable, 
ptr_Drag_n_Drop_Source, which holds a pointer to the source table.
 
In the On Drag Over event - I test for valid data, and return either 0 
or -1. By returning either value to the droppable area you should 
trigger 4D's cursor change to indicate a droppable area, and whether 
the data being dragged is valid for the drop area.

i.e.
// Drop area object - object method
Case of
:(Form event = On Drag Over)

// the below 2 lines can be substituted with test for the data type(s) 
on the pasteboard
  DRAG AND DROP 
PROPERTIES($Source_Object;$Source_Element;$Source_Process_Number)
  GET PROCESS 
VARIABLE($Source_Process_Number;ptr_Drag_n_Drop_Source;$Source_Table)
  
// is_allowed is just for this example and is whatever criteria is 
valid in your circumstances
  if (Is_allowed($Source_Table))   
   $0:=0
  else
   $0:=-1
  end if
end case


Chip

On Thu, 14 Feb 2019 20:14:02 +, Keisuke Miyako via 4D_Tech wrote:
> Hello,
> 
> you can use SET CURSOR
> 
> 9019 for no-entry, 9016 for plus.
> 
> https://doc.4d.com/4Dv17/4D/17/SET-CURSOR.301-3729694.en.html
> 
>> 2019/02/15 1:55、John J Foster via 4D_Tech <4d_tech@lists.4d.com>のメール:
>> 
>> I have an interface with an Listbox on the left side and four text 
>> variables on the right.
>> 
>> When I drag over the text areas I want the variable to reflect that 
>> It’s in a receptive drop state. I am dragging some concatenated 
>> data that drops on top of the variable. This works but I need to 
>> reflect from a UI perspective that something can happen.
> 
> 
> 
> **
> 4D Internet Users Group (4D iNUG)
> Archive:  http://lists.4d.com/archives.html
> Options: https://lists.4d.com/mailman/options/4d_tech
> Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
> **
---
Gas is for washing parts
Alcohol is for drinkin'
Nitromethane is for racing 
**
4D Internet Users Group (4D iNUG)
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**

Re: On Drag Over Behavior

2019-02-14 Thread Keisuke Miyako via 4D_Tech
Hello,

you can use SET CURSOR

9019 for no-entry, 9016 for plus.

https://doc.4d.com/4Dv17/4D/17/SET-CURSOR.301-3729694.en.html

> 2019/02/15 1:55、John J Foster via 4D_Tech <4d_tech@lists.4d.com>のメール:
>
> I have an interface with an Listbox on the left side and four text variables 
> on the right.
>
> When I drag over the text areas I want the variable to reflect that It’s in a 
> receptive drop state. I am dragging some concatenated data that drops on top 
> of the variable. This works but I need to reflect from a UI perspective that 
> something can happen.



**
4D Internet Users Group (4D iNUG)
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**

On Drag Over Behavior

2019-02-14 Thread John J Foster via 4D_Tech
Hi All,

V17R4 Mac

I have an interface with an Listbox on the left side and four text variables on 
the right.

When I drag over the text areas I want the variable to reflect that It’s in a 
receptive drop state. I am dragging some concatenated data that drops on top of 
the variable. This works but I need to reflect from a UI perspective that 
something can happen.

The only thing I could find in the NUG was:

_O_DRAG AND DROP PROPERTIES($srcObject;$srcElement;$srcProcess) 

If ($srcObject=$1)
$0:=0
Else 
$0:=-1
End if 

I think I would like to see the variable get hi lighted or something. But 
nothing happens and I don’t recall if I have to do something else?

Note: I am also in process of learning to use the pasteboard to get rid of the 
obsolete command. Any help would be appreciated.

Thanks,
John…


**
4D Internet Users Group (4D iNUG)
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**