DgsSendDragNDropData

From Multi Theft Auto: Wiki
Revision as of 17:25, 23 March 2022 by Thisdp (talk | contribs)
Jump to navigation Jump to search

This function makes the possibility of transfering dynamic data between dgs elements by Drag&Drop, which is useful for inventory system.

Syntax

bool dgsSendDragNDropData ( mixed dragData [, material preview = nil, int previewColor = tocolor(255,255,255,255), float previewOffsetX = 0, float previewOffsetY = 0, float previewWidth = 20, float previewHeight = 20, string previewHorizontalAlign = "center", string previewVerticalAlign = "center" ] )

Required Arguments

  • dragData: Any type of data that you want to transfer.

Optional Arguments

  • preview: A material element that you want to demonstrate when dragging by the cursor.
  • previewColor: An integer of the color of preview you want. This can be converted by tocolor.
  • previewOffsetX: A float of the 2D x offset of the preview in pixels far from the cursor.
  • previewOffsetY: A float of the 2D y offset of the preview in pixels far from the cursor.
  • previewWidth: A float of the width in pixels of the preview.
  • previewHeight: A float of the height in pixels of the preview.
  • previewHorizontalAlign : A string indicates the horizontal alignment of the preview relative to the cursor. Available values are as follows:
    • left
    • center
    • right
  • previewVerticalAlign : A string indicates the vertical alignment of the preview relative to the cursor. Available values are as follows:
    • top
    • center
    • bottom

Returns

Returns true if successful, false otherwise

Example

local senderA = dgsCreateButton(200,200,200,200,"SenderA",false)
local senderB = dgsCreateButton(200,500,200,200,"SenderB",false)
local receiver = dgsCreateButton(500,500,200,200,"Receiver",false)
addEventHandler("onDgsDrag",senderA,function(data)
	dgsSendDragNDropData({"From SenderA",getTickCount()})
end,false)
addEventHandler("onDgsDrag",senderB,function(data)
	dgsSendDragNDropData({"From SenderB",getTickCount()})
end,false)

addEventHandler("onDgsDrop",receiver,function(data)
	outputChatBox("Receive Data: "..inspect(data))
end,false)

See Also

Custom Cursor Functions

Multi Language Supports

Animation

3D Element

3D Interface

3D Line

3D Image

3D Text

Browser

Button

Check Box

Combo Box

Custom Renderer

Edit

Detect Area

Drag'N Drop

Grid List

Image

Memo

Menu

Label

Layout

Line

Progress Bar

Radio Button

Scale Pane

Scroll Bar

Scroll Pane

Selector

Style

Switch Button

Tab Panel

Window

Basic Shape Plugins

Circle

Quadrilateral

Rounded Rectangle

Other Plugins

Blur Box

Canvas

Chart

Color Picker

Effect 3D

Gradient

Mask

Media Browser

Nine Slice

Object Preview Supports

Paste Handler

QRCode

Remote Image

Screen Source

SVG

Tooltips