DgsSendDragNDropData

From Multi Theft Auto: Wiki
Revision as of 17:16, 23 March 2022 by Thisdp (talk | contribs) (Created page with "__NOTOC__ {{Client function}} This function makes the possibility of transfering '''dynamic''' data between dgs elements by Drag&Drop, which is useful for inventory system. ==Syntax== <syntaxhighlight lang="lua"> 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",...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
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.
  • previewVerticalAlign : A string indicates the vertical alignment of the preview relative to the cursor.

Returns

Returns true if successful, false otherwise

Example

local btn1 = dgsCreateButton(200,200,200,200,"Button1",false)
	local btn2 = dgsCreateButton(200,500,200,200,"Button2",false)
	local btn3 = dgsCreateButton(500,500,200,200,"Receive",false)
	addEventHandler("onDgsDrag",btn1,function(data)
		dgsSendDragNDropData({"From Button 1",getTickCount()})
	end,false)
	addEventHandler("onDgsDrag",btn2,function(data)
		dgsSendDragNDropData({"From Button 2",getTickCount()})
	end,false)

	addEventHandler("onDgsDrop",btn3,function(data)
		iprint("Drop","Data:",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