How can I implement the Drag and Drop of \"Datapoint to Panel\" like the Para

Discussion about recent product features & solutions!
6 posts • Page 1 of 1
michel.eijgermans
Posts:46
Joined: Mon Aug 08, 2011 11:50 am

How can I implement the Drag and Drop of \"Datapoint to Panel\" like the Para

Post by michel.eijgermans »

I'm using WinOA-3.15 on Windows10

I would like to build a panel that can drag an datapoint-name ( in Gedi ) to my panel with the same drag-drop information as para uses.

Drag&Drop from Para
- When drag&drop a datapoint the correct Symbol is used ( in most cases we have only 1 symbol per datapoint-type ) --> I've added a symbol to my datapoint-Type.
- In the Drag my datapoint-name is visible as a sort of tooltip
- Additionally my refdef is automatically filled with the correct datapoint information, which makes my only have to apply my Refdef to finish my configuration.

> Difficulty here is to figure out which datapoint are allready placed on the screen and which not. Therefor i wish to build my own configurator that can identify 'not yet' placed datapoints on a panel.

Some how i can't get the same behavior as para when i do my own Drag&Drop..

Drag&Drop from my own panel -> just following the manual
- The symbol-name can be passed in the dragstart
- I only can pass a custom drag-icon and not a datapoint name.
- Refdef on destination-panel is opened, but it doesn't have the datapoint information so i need to select it in the Refdef which i basically allready did when starting my drag-drop.

> Is there a Global which need to be filled that para uses, which i'm missing
> Is there a special 'dragstart' instruction other then described in the manual

1) Hope someone can give me an example of the dragstart which shows a datapoint-name in 'drag' that opens the symbols ( related to that datapoint-type ) refdef and uses the passed datapoint-name.
2) Hope someone can explain how Para does it..


Best regards,
Michel.

fmulder
Posts:330
Joined: Wed Feb 03, 2010 9:46 am

Re: How can I implement the Drag and Drop of \"Datapoint to Panel\" like the Para

Post by fmulder »

Hi Michel,

Let me help you:

* Make your own panel with a dp tree view
* Make a global variable g_DpBeingDragged
* In your drag event you store your dp name in this global variabele
* Drag-and-drop your icon with 'dragStart( strDragPanelFile, "", DRAG_COPY, "text/x-panel" );
* When you drop your icon then your(!) refdef panel should appear
* In your RefDef panel you get the information from the global (and reset your global, because you do not want this datapoint to be filled in when they drag the icon from the projectview)

good luck

share the fun
Frenk Mulder

mkoller
Posts:741
Joined: Fri Sep 17, 2010 9:03 am

Re: How can I implement the Drag and Drop of \"Datapoint to Panel\" like the Para

Post by mkoller »

global vars are bad!
When you want to drag information, then put that information into the data you drag.
In your panel on the objects DragStart script put something like this:

Code: Select all

  dragStart("System1:x1.", "", DRAG_COPY, "text/x-dp");
The important part here is the mime-type "text/x-dp"

fmulder
Posts:330
Joined: Wed Feb 03, 2010 9:46 am

Re: How can I implement the Drag and Drop of \"Datapoint to Panel\" like the Para

Post by fmulder »

Sorry to correct you.

text/x-dp is for dragging a datapoint. But the drag text/x-panl is used because we're dragging panel and the RefDef panel needs to know what datapoint was associated.
As fas as I know, the RefDef panel doesn't know the contents of the drag 'string'. The global var is the only solution ?

michel.eijgermans
Posts:46
Joined: Mon Aug 08, 2011 11:50 am

Re: How can I implement the Drag and Drop of \"Datapoint to Panel\" like the Para

Post by michel.eijgermans »

Hi Frenk,

Thanks for your answer, your described method indeed works but in my opinion is still a small workaround.
The reason i asked the question is that i noticed a difference when dragging from PARA/DP_TREE and dragging from my own Panel. See results

From DP_TREE/PARA
- Automatically supports the DRAG&DROP.
- When dropped: the refdef belonging to the Symbol of the DatapointType is opened
- Refdef can use standard filled in Dollar-Param: $dp
- Refdef can use standard filled in Dollar-Param: $refFilename.

This scenario is slightly different then a Drag&Drop from my Panel with an 'TABLE' where i implement my own Drag&Drop.
- Initiate DRAG&DROP via Drag-Start. 'dragStart( strDragPanelFile, "", DRAG_COPY, "text/x-panel" );'
- When dropped: the refdef belonging to the Symbol of the DatapointType is opened
- Refdef can use standard filled in Dollar-Param: $refFilename.

- The difference: Refdef CANNOT use standard filled in Dollar-Param: $dp because its empty. In someway logical because this information is not passed via my own DRAG&DROP and i don't know how to do it like the DPTREE/PARA dragdrop.


I was hoping someone can explain me what the PARA/DP_TREE does different in its Drag&Drop and how this differs with: 'dragStart( strDragPanelFile, "", DRAG_COPY, "text/x-panel" );'?
Is there a feature in the DRAG&DROP 'data' to pass so '$dp' is directly passed to the refdef without introducing an additional Global variable?

Gr. Michel.

michel.eijgermans
Posts:46
Joined: Mon Aug 08, 2011 11:50 am

Re: How can I implement the Drag and Drop of \"Datapoint to Panel\" like the Para

Post by michel.eijgermans »

Martin thanks for you info.

With dragStart("System1:x1.", "", DRAG_COPY, "text/x-dp"); the behavior is like the DP_TREE.

Gr. Michel

6 posts • Page 1 of 1